Re: Progamatically using the histogram plugin
Posted by
Wayne Rasband on
May 27, 2009; 2:08pm
URL: http://imagej.273.s1.nabble.com/Progamatically-using-the-histogram-plugin-tp3692404p3692405.html
On May 27, 2009, at 5:14 AM, Karl Wettin wrote:
> Hello forum,
>
> I want to use the histogram plugin to do some simple automated
> computer vision thingies, but I can't figure out how to load an image
> and pass it down to the plugin from my code. Looking at the plugin
> code it seems to use static things in IJ, GUI calls and what not in
> order to figure out what image to use.
>
> Didn't investigate this too much. Is there a simpler way out than to
> refactor the code to fit my needs? It would be great to use IJ as is
> and just do something like new Histogram(image).getBins().
>
> Help would be most appreciated.
Use the getStatistics() method of the ImagePlus class to get the
histogram.
ImagePlus imp = IJ.openImage(path);
int[] histogram = imp.getStatistics().histogram;
-wayne