Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
I need to examine pixels in images in stacks, row-by-row, but don't know
how to get the image data. 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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
> 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 ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Thank you kindly, Sir!
On Tue, Apr 2, 2019 at 9:46 AM Wayne Rasband <[hidden email]> wrote: > > 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 > ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |