Hi,
I would like to get the same histogram as the one obtained in Analyze, histogram - using Javascript, and get the values obtained when clicking on "List" in the histogram window in ImageJ. (without displaying the histogram) The problem is that the command recorder records nothing when I click on list, so it's not clear to me how to get the values after using the command: IJ.run(imp, "Histogram", ""); Also, if I use the getHistogram function from the ImageProcessor or ImagePlus class in the Java API, it gives a different histogram. The bin width is 1, instead of (xmax - xmin)/nBins bin width. I would like to get the same histogram as the one in Analyze, histogram. Is there an easy way to do this? Thanks, Avital -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Avital,
you could look at ij.gui.HistogramWindow, a class you can use in a plugin or script and has different constructuctors taking bin, min, max values, etc. Some of them require you to convert to 32 bit image however. Or, you could try ImagePlus#getStatistics(int mOptions, int nBins, double histMin, double histMax) and then get the histogram from ij.process.ImageStatistics#getHistogram(); Regards, David On Thu, Sep 3, 2015 at 9:34 AM, Avital Steinberg <[hidden email]> wrote: > Hi, > I would like to get the same histogram as the one obtained in Analyze, > histogram - using Javascript, and get the values obtained when clicking on > "List" in the histogram window in ImageJ. (without displaying the > histogram) > > The problem is that the command recorder records nothing when I click on > list, so it's not clear to me how to get the values after using the > command: > > IJ.run(imp, "Histogram", ""); > > Also, if I use the getHistogram function from the ImageProcessor or > ImagePlus class in the Java API, it gives a different histogram. The bin > width is 1, instead of (xmax - xmin)/nBins bin width. I would like to get > the same histogram as the one in Analyze, histogram. > > Is there an easy way to do this? > > Thanks, > Avital > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi David,
I prefer the second suggestion you gave me, since the HistogramWindow class has constructors that all display the histogram. (I don't want it to be displayed) What does int mOptions mean? This is probably exactly the solution I'm looking for. Thanks, Avital On Thu, Sep 3, 2015 at 1:22 PM, Davíð Þór Bragason <[hidden email]> wrote: > Hi Avital, > > you could look at ij.gui.HistogramWindow, a class you can use in a plugin > or script and has different constructuctors taking bin, min, max values, > etc. Some of them require you to convert to 32 bit image however. > > Or, you could try ImagePlus#getStatistics(int mOptions, int nBins, double > histMin, double histMax) and then get the histogram from > ij.process.ImageStatistics#getHistogram(); > > Regards, > David > > > On Thu, Sep 3, 2015 at 9:34 AM, Avital Steinberg < > [hidden email]> > wrote: > > > Hi, > > I would like to get the same histogram as the one obtained in Analyze, > > histogram - using Javascript, and get the values obtained when clicking > on > > "List" in the histogram window in ImageJ. (without displaying the > > histogram) > > > > The problem is that the command recorder records nothing when I click on > > list, so it's not clear to me how to get the values after using the > > command: > > > > IJ.run(imp, "Histogram", ""); > > > > Also, if I use the getHistogram function from the ImageProcessor or > > ImagePlus class in the Java API, it gives a different histogram. The bin > > width is 1, instead of (xmax - xmin)/nBins bin width. I would like to get > > the same histogram as the one in Analyze, histogram. > > > > Is there an easy way to do this? > > > > Thanks, > > Avital > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Hi Avital,
the int mOption comes from the Measurements interface. The constants are defined in the source below. You can add them to get what you want, e.g. if you call ImagePlus#getStatistics() without arguments it actually calls getStatistics( AREA+MEAN+MODE+MIN_MAX). package ij.measure; public interface Measurements { public static final int AREA=1,MEAN=2,STD_DEV=4,MODE=8,MIN_MAX=16, CENTROID=32,CENTER_OF_MASS=64,PERIMETER=128, LIMIT=256, RECT=512, LABELS=1024,ELLIPSE=2048,INVERT_Y=4096,CIRCULARITY=8192, SHAPE_DESCRIPTORS=8192,FERET=16384,INTEGRATED_DENSITY=0x8000, MEDIAN=0x10000, SKEWNESS=0x20000, KURTOSIS=0x40000, AREA_FRACTION=0x80000, SLICE=0x100000, STACK_POSITION=0x100000, SCIENTIFIC_NOTATION=0x200000, ADD_TO_OVERLAY=0x400000, NaN_EMPTY_CELLS=0x800000; /** Maximum number of calibration standard (20) */ public static final int MAX_STANDARDS = 20; } On Thu, Sep 3, 2015 at 11:14 AM, Avital Steinberg <[hidden email] > wrote: > Hi David, > I prefer the second suggestion you gave me, since the HistogramWindow class > has constructors that all display the histogram. (I don't want it to be > displayed) > > What does int mOptions mean? This is probably exactly the solution I'm > looking for. > > Thanks, > Avital > > > > On Thu, Sep 3, 2015 at 1:22 PM, Davíð Þór Bragason <[hidden email]> > wrote: > > > Hi Avital, > > > > you could look at ij.gui.HistogramWindow, a class you can use in a plugin > > or script and has different constructuctors taking bin, min, max values, > > etc. Some of them require you to convert to 32 bit image however. > > > > Or, you could try ImagePlus#getStatistics(int mOptions, int nBins, double > > histMin, double histMax) and then get the histogram from > > ij.process.ImageStatistics#getHistogram(); > > > > Regards, > > David > > > > > > On Thu, Sep 3, 2015 at 9:34 AM, Avital Steinberg < > > [hidden email]> > > wrote: > > > > > Hi, > > > I would like to get the same histogram as the one obtained in Analyze, > > > histogram - using Javascript, and get the values obtained when > clicking > > on > > > "List" in the histogram window in ImageJ. (without displaying the > > > histogram) > > > > > > The problem is that the command recorder records nothing when I click > on > > > list, so it's not clear to me how to get the values after using the > > > command: > > > > > > IJ.run(imp, "Histogram", ""); > > > > > > Also, if I use the getHistogram function from the ImageProcessor or > > > ImagePlus class in the Java API, it gives a different histogram. The > bin > > > width is 1, instead of (xmax - xmin)/nBins bin width. I would like to > get > > > the same histogram as the one in Analyze, histogram. > > > > > > Is there an easy way to do this? > > > > > > Thanks, > > > Avital > > > > > > -- > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Thanks a lot,
Avital On Thu, Sep 3, 2015 at 2:42 PM, Davíð Þór Bragason <[hidden email]> wrote: > Hi Avital, > > the int mOption comes from the Measurements interface. The constants are > defined in the source below. You can add them to get what you want, e.g. if > you call ImagePlus#getStatistics() without arguments it actually calls > getStatistics( AREA+MEAN+MODE+MIN_MAX). > > package ij.measure; > > public interface Measurements { > > public static final int AREA=1,MEAN=2,STD_DEV=4,MODE=8,MIN_MAX=16, > CENTROID=32,CENTER_OF_MASS=64,PERIMETER=128, LIMIT=256, RECT=512, > LABELS=1024,ELLIPSE=2048,INVERT_Y=4096,CIRCULARITY=8192, > SHAPE_DESCRIPTORS=8192,FERET=16384,INTEGRATED_DENSITY=0x8000, > MEDIAN=0x10000, SKEWNESS=0x20000, KURTOSIS=0x40000, AREA_FRACTION=0x80000, > SLICE=0x100000, STACK_POSITION=0x100000, SCIENTIFIC_NOTATION=0x200000, > ADD_TO_OVERLAY=0x400000, NaN_EMPTY_CELLS=0x800000; > /** Maximum number of calibration standard (20) */ > public static final int MAX_STANDARDS = 20; > > } > > > On Thu, Sep 3, 2015 at 11:14 AM, Avital Steinberg < > [hidden email] > > wrote: > > > Hi David, > > I prefer the second suggestion you gave me, since the HistogramWindow > class > > has constructors that all display the histogram. (I don't want it to be > > displayed) > > > > What does int mOptions mean? This is probably exactly the solution I'm > > looking for. > > > > Thanks, > > Avital > > > > > > > > On Thu, Sep 3, 2015 at 1:22 PM, Davíð Þór Bragason <[hidden email]> > > wrote: > > > > > Hi Avital, > > > > > > you could look at ij.gui.HistogramWindow, a class you can use in a > plugin > > > or script and has different constructuctors taking bin, min, max > values, > > > etc. Some of them require you to convert to 32 bit image however. > > > > > > Or, you could try ImagePlus#getStatistics(int mOptions, int nBins, > double > > > histMin, double histMax) and then get the histogram from > > > ij.process.ImageStatistics#getHistogram(); > > > > > > Regards, > > > David > > > > > > > > > On Thu, Sep 3, 2015 at 9:34 AM, Avital Steinberg < > > > [hidden email]> > > > wrote: > > > > > > > Hi, > > > > I would like to get the same histogram as the one obtained in > Analyze, > > > > histogram - using Javascript, and get the values obtained when > > clicking > > > on > > > > "List" in the histogram window in ImageJ. (without displaying the > > > > histogram) > > > > > > > > The problem is that the command recorder records nothing when I click > > on > > > > list, so it's not clear to me how to get the values after using the > > > > command: > > > > > > > > IJ.run(imp, "Histogram", ""); > > > > > > > > Also, if I use the getHistogram function from the ImageProcessor or > > > > ImagePlus class in the Java API, it gives a different histogram. The > > bin > > > > width is 1, instead of (xmax - xmin)/nBins bin width. I would like to > > get > > > > the same histogram as the one in Analyze, histogram. > > > > > > > > Is there an easy way to do this? > > > > > > > > Thanks, > > > > Avital > > > > > > > > -- > > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > > > > > -- > > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > > > > -- > > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |