Posted by
Avital Steinberg on
Dec 05, 2014; 5:24pm
URL: http://imagej.273.s1.nabble.com/How-to-use-setLocation-and-measure-tp5010795.html
Hi,
I am trying to move an ROI around in a java plugin and measure the mean
intensity. I am measuring the ImageStatistics on an ImageProcessor, since I
don't want to display the image. The problem is that it is not actually
moving the ROI around. Here is my code: (img is ImagePlus)
I am giving a simple example with two different locations, but my purpose
is to move the ROI to many different locations and measure the mean
intensities.
ImageProcessor ip = img.getProcessor();
Calibration cal = img.getCalibration();
img.setRoi(new OvalRoi(598, 380, 32, 59));
Roi roi = img.getRoi();
ImageStatistics stats = ImageStatistics.getStatistics(ip, MEAN,
cal);
IJ.log("The mean intensity is: " + stats.mean);
roi.setLocation(1056, 304);
stats = ImageStatistics.getStatistics(ip, MEAN, cal);
IJ.log("The mean intensity is now: " + stats.mean);
How should I change my code so that it would really move the ROI to a new
location and measure the mean intensity in this location?
Thanks,
Avital
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html