Problem with setCalibration() and getCalibration
Posted by
Dawid Krzempek on
URL: http://imagej.273.s1.nabble.com/Problem-with-setCalibration-and-getCalibration-tp5010425.html
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?
The goal of calibration is working on calibrated (Gy) values, not on signal values. Is there any other way to achieve it?
Thanks for your help
David
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html