Hi
I am trying to use imglib2 for some morphological operations:
final ImagePlus imp = new Opener().openImage(id);
Img<UnsignedByteType> img1 = ImagePlusAdapter.wrap(imp);
List<Shape> strel = StructuringElements.disk(6, 2, 0);
final Img<UnsignedByteType> op = Closing.close(img1, strel, 1);
But this throws me the following exception:
[ERROR] Module threw exception
java.lang.ClassCastException: net.imglib2.type.numeric.ARGBType cannot be cast to net.imglib2.type.numeric.RealType
at net.imglib2.algorithm.morphology.Dilation.dilateFull(Dilation.java:698)
at net.imglib2.algorithm.morphology.Dilation.dilate(Dilation.java:60)
at net.imglib2.algorithm.morphology.Closing.close(Closing.java:48)
at AllenJ2D.run(AllenJ2D.java:125)
at org.scijava.command.CommandModule.run(CommandModule.java:201)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:167)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:126)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:65)
at org.scijava.thread.DefaultThreadService$2.call(DefaultThreadService.java:191)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
I don’t really understand what’s happening here. Where does suddenly the ARGBType come from? Also I checked the tests
and here it’s used in the same way.
Does anybody have an idea why this exception jumps at me?
Felix