Re: Problem with Maximum intensity projection

Posted by Fred Damen on
URL: http://imagej.273.s1.nabble.com/Problem-with-Maximum-intensity-projection-tp5020309p5020322.html

Greetings,

I would like to second Kenneth's frustration with my version of fetching the
requisite values:

  for(int iz=0; iz<nz; iz++) {
      IJ.showStatus("NonLinearFit: z="+iz);
      IJ.showProgress(((float)iz)/nz);

      for(int ix=0; ix<nx; ix++)
         for(int iy=0; iy<ny; iy++) {
            for(int if=0; if<nf; if++)
               y[if] =
((FloatProcessor)is.getProcessor(imp.getStackIndex(1,iz+1,if+1))).getf(ix,iy);
               process(x,y);
            }
      }

Ages ago, I tried using the various getVoxel(s) methods to no avail.  If
memory serves, they would always return the same value. So once I got the
aforementioned code working I just copy and paste every time I need it; which
is always.

I would assume that this inner loop can be done extremely more efficiently
under the hood than through the interface, i.e., repeated calls to
is.getProcessor and imp.getStackIndex are not free; notice the need for
showStatus and showProgress. Can the  getVoxels and setVoxels methods that
include the frame dimension be included.

Thanks for listening,

Fred


On Fri, March 23, 2018 11:30 am, Kenneth Sloan wrote:
...

> Obligatory question: I tried to use getVoxels - but failed miserably.  After a
> few attempts, I just
> rolled my own.
>
> This is slower than dirt - but I hope it's clear.
>
> And, as always - I welcome corrections to my chronic mis-understanding of the
> API.
>  --
> Kenneth Sloan
> [hidden email]
> Vision is the art of seeing what is invisible to others.
...

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