> On Apr 2, 2019, at 11:17 AM, Robert Lockwood <
[hidden email]> wrote:
>
> I need to examine pixels in images in stacks, row-by-row, but don't know
> how to get the image data.
Use the ImageStack.getVoxel(x,y,z) method. Here is a JavaScript example:
img = IJ.createImage("Untitled", "16-bit ramp", 10, 10, 5);
stack = img.getStack();
for (z=0; z<img.getStackSize(); z++)
for (y=0; y<img.getHeight(); y++)
for (x=0; x<img.getWidth(); x++)
IJ.log(x+","+y+","+z+"="+stack.getVoxel(x,y,z));
-wayne
> The code snippet below works up to the for loop:
>
> public void processStack(final File dFile) {
> ImageStack inStack =
> ij.IJ.openImage(dFile.getPath()).getImageStack();
> System.out.println("Stack: " + dFile.getPath() + " stacks = " +
> inStack.getSize());
> final int NROWS = inStack.getHeight();
> final int NCOLS = inStack.getHeight();
> final int NSLICES = inStack.getSize();
> for(int slice = 1; slice <= NSLICES; slice++) {
> // float[] image = ???
> }
> }
> TIA
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html