Dear List,
is there a way to have the "image to results" output be a single column of numbers, rather than a 2-d array? I have been using a text editor to reformat, but it is getting pretty cumbersome. Better still would be to get a whole stack to output, with each row a given pixel ID, and each column being an image/slice. JPK -- ******************************************* Jacob Pearson Keller Northwestern University Medical Scientist Training Program email: [hidden email] ******************************************* -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Jun 5, 2012, at 11:28 AM, Jacob Keller wrote:
> Dear List, > > is there a way to have the "image to results" output be a single > column of numbers, rather than a 2-d array? I have been using a text > editor to reformat, but it is getting pretty cumbersome. Better still > would be to get a whole stack to output, with each row a given pixel > ID, and each column being an image/slice. Here is JavaScript code that displays the contents of an image or stack in the Results window, with one image per column. To create a "Stack to Results" command, save it in the plugins folder, or subfolder, as "Stack_to_Results.js" and use the Help>Refresh Menus command. -wayne var imp = IJ.getImage(); var stack = imp.getStack(); var nImages = stack.getSize(); var nPixels = stack.getWidth()*stack.getHeight(); var rt = new ResultsTable(); for (var z=0; z<nImages; z++) { IJ.showProgress(z, nImages-1); IJ.showStatus((z+1)+"/"+nImages); var ip = stack.getProcessor(z+1); for (var i=0; i<nPixels; i++) { if (z==0) rt.incrementCounter(); rt.setValue("i"+(z+1), i, ip.getf(i)); } } rt.show("Results"); -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Again, right on the money!
Thanks very much, Jacob ps now I want to go back the other way: is there a way to make a "heat map" image of these pixels after re-ordering them, i.e., re-input the stack as an array of numbers (pixel ID x image number) and make an image from those data points, to be LUT-ed appropriately? I am trying to show what each (binned) pixel in a stack does over time (image#), but first sorted by a given criteria. I have done this before in gnuplot, but imageJ seems really nice, and I like the LUTs in ImageJ better. On Tue, Jun 5, 2012 at 1:16 PM, Rasband, Wayne (NIH/NIMH) [E] <[hidden email]> wrote: > On Jun 5, 2012, at 11:28 AM, Jacob Keller wrote: > >> Dear List, >> >> is there a way to have the "image to results" output be a single >> column of numbers, rather than a 2-d array? I have been using a text >> editor to reformat, but it is getting pretty cumbersome. Better still >> would be to get a whole stack to output, with each row a given pixel >> ID, and each column being an image/slice. > > Here is JavaScript code that displays the contents of an image or stack in the Results window, with one image per column. To create a "Stack to Results" command, save it in the plugins folder, or subfolder, as "Stack_to_Results.js" and use the Help>Refresh Menus command. > > -wayne > > var imp = IJ.getImage(); > var stack = imp.getStack(); > var nImages = stack.getSize(); > var nPixels = stack.getWidth()*stack.getHeight(); > var rt = new ResultsTable(); > for (var z=0; z<nImages; z++) { > IJ.showProgress(z, nImages-1); > IJ.showStatus((z+1)+"/"+nImages); > var ip = stack.getProcessor(z+1); > for (var i=0; i<nPixels; i++) { > if (z==0) rt.incrementCounter(); > rt.setValue("i"+(z+1), i, ip.getf(i)); > } > } > rt.show("Results"); > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ******************************************* Jacob Pearson Keller Northwestern University Medical Scientist Training Program email: [hidden email] ******************************************* -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |