Login  Register

Re: ZProjector for dummies

Posted by Tiago Ferreira-2 on Jun 05, 2014; 3:05am
URL: http://imagej.273.s1.nabble.com/ZProjector-for-dummies-tp5008014p5008019.html

Dear Jeff,


On Jun 4, 2014, at 17:25, Jeff Hardin <[hidden email]> wrote:
> I can't get the same result using calls to the ZProjector  directly that I get when I use the IJ.run("Z Project...") command.

Try calling the setImage() method _before_ setting the limits of the projection, i.e.:

  myProjector = new ZProjector();
  myProjector.setImage(imp);
  myProjector.setMethod(ZProjector.MAX_METHOD);
  myProjector.setStartSlice(1);
  myProjector.setStopSlice(4);

or, alternatively:

  myProjector = new ZProjector(imp);
  myProjector.setMethod(ZProjector.MAX_METHOD);
  myProjector.setStartSlice(1);
  myProjector.setStopSlice(4);


In short:
Before calling setImage(), the ZProjector does not know on which image to operate.
Because of that, setStartSlice() and setStopSlice() will do nothing, and the projection
will be performed on the entire stack (the default). You can check this by looking at
the ZProjector source code, and confirm that setStartSlice() and setStopSlice() will do
nothing if the image to be projected has not yet been defined:

https://github.com/imagej/imagej1/blob/master/ij/plugin/ZProjector.java#L72
https://github.com/imagej/imagej1/blob/master/ij/plugin/ZProjector.java#L78


-tiago
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html