I am a lapsed Java programmer that is now trying to write ImageJ2 stuff. I’m currently working on a plugin but having a very hard time getting even basic stuff to work. My currently problem is a simple maximum Z-projection. My current code looks like this:
int projected_dimensions = new int[cropped.numDimensions() - 1]; Img<FloatType> proj = (Img<FloatType>) ij.op().create().img(new FinalDimensions(projected_dimensions), new FloatType()); UnaryComputerOp maxOp = Computers.unary(ij.op(),Ops.Stats.Max.class,RealType.class, Iterable.class); Img<T> projection = (Img<T>) ij.op().transform().project(proj, cropped, maxOp, 2);
“cropped” is the image I want to Z-project (actually a RandomAccessibleInterval). At the moment, this code gives a division by zero error (Exception in thread “Run$_main” java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.ArithmeticException: / by zero) on the projection line. Is there anything obviously wrong with my code? Am I going at this the right way?
Thanks in advance!