Re: Problem with setCalibration() and getCalibration
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
URL: http://imagej.273.s1.nabble.com/Problem-with-setCalibration-and-getCalibration-tp5010425p5010435.html
On Nov 13, 2014, at 12:10 PM, Dawid Krzempek <
[hidden email]> wrote:
>
> Hello,
> I am writing some Imagej plugin and have few problems with value calibration.
> I am not experienced in writing programs like this one, so the solution can be very simple.
>
> I try to calibrate ImagePlus. There is my code (img1 is ImagePlus object)
>
> float [] param={146494f,3.55146f,2079.82f};
> float cTable[]=new float[65536];
> Calibration calibr=new Calibration();
> float a=param[0];
> float b=param[1];
> float c=param[2];
> for (int i=0;i<65536;i++){
> float value=-b+a/(i-c);
> if (value>10) cTable[i]=10;
> else if (value<0) cTable[i]=0;
> else cTable[i]=value;
> }
> calibr.setCTable(cTable,"Gy");
> System.out.println(calibr.calibrated());
> img1.setCalibration(calibr);;
> System.out.println(img1.getCalibration().calibrated());
>
> The output then:
>
> true
> false
>
> setCalibration() seems not working. Image is not calibrated after using this method. I was expected "true true" output Could somebody tell me, where is my mistake?
You did not make a mistake. You encountered a bug that is fixed in the latest ImageJ daily build (1.49m3). You can upgrade by using the Help>Update ImageJ command and selecting “daily build” from the drop down menu.
-wayne
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html