[ImageJ-devel] strange behaviour using calibration object.

Polder, Gerrit gerrit.polder at wur.nl
Tue Jan 29 05:26:22 CST 2013


Wayne, Johannes, Curtis,

thanks for your valuable help, I finally found out what is going on.
Two things:

- The setCalibration problem.
When I used my calibration plugin from another plugin I did a global set scale on beforehand, using:
                    IJ.run(imp, "Set Scale...", "distance=0 known=0 pixel=1 unit=pixel global"); // clear current scale
In this case overlay_im.setCalibration(cal.getCalibration()); does not work, it is obviously overruled by the global setting.
This was also the case in ij-1.47h, but I didn't notice !!!!!!!!!!!
I fixed this by running "Set Scale" in stead of copying the Calibration object.

- The ip.setroi() problem.
This problem was indeed introduced in ij-1.47i. I tested it again with ij-1.47h, and then it worked fine.
I fixed it by using ImagePlus.setRoi() as Wayne suggested.

kindly,
Gerrit.


On 29 Jan 2013, at 04:57, "Rasband, Wayne (NIH/NIMH) [E]" <rasbandw at mail.nih.gov> wrote:

> 
> On Jan 28, 2013, at 4:41 PM, Polder, Gerrit wrote:
> 
>> Wayne,
>> 
>> thanks, the thing is I have a separate class cal, it's a class I wrote myself.
>> This class implements the getCalibration functions which returns a Calibration object, in which I filled w,h and the unit.
>> So I can imagine that you can't compile it. I did show this on the last developer conference, maybe you remember it.
>> This class detects a blue area in the image and decodes the qrcode within this area and does a calibration based on a black disk with holes.
>> The number of holes determines the size of the disk. I'm currently making a separate plugin for this calibration and decode.
>> The idea is that the plugin gives a new image with only the blue area, the decoded qrcode as title and calibrated according to the disk.
>> This way this information can be used in other plugins. I don't see other ways to get this information from the plugin. 
>> Or I need to return a resultstable which is little bit of overkill in my opinion.
>> 
>> I don't see why IJ.log("1-> "+cal.getCalibration() + " - " + cal.getCalibration().scaled()); works,
>> and overlay_im.setCalibration(cal.getCalibration()); not.
>> Even more since it worked properly last week ????
>> The only thing which was changed is the Fiji update this morning, I believe ij1.47h to 1.47i, along with other libraries.
> 
> Send me a minimal, but complete, plugin that reproduces the problem I will try to figure out what is causing it.
> 
>> In the mean time I found another problem, I have implemented the run(ImageProcessor ip) in my plugin.
>> I do a ip.setroi(roi of blue region) at the end and after running the plugin this roi was set on the input image.
>> It is very handy to have this information for further processing of the input image.
>> This behavior also stopped working this morning, the roi now is set to the whole image.
> 
> It would be better to use the ImagePlus.setRoi() method to set the roi.
> 
>> Is there a way to downgrade Fiji, in order to test this with 1.47h?
> 
> You can downgrade to ImageJ 1.46 using the Help>Update ImageJ command.
> 
>> is Barry DeZonia right, does this question better fit on the regular list?
> 
> I can try to help you resolve this problem. It's a little too esoteric for the ImageJ mailing list.
> 
> Best regards,
> 
> -wayne
> 
> 
>> On 28 jan. 2013, at 21:12, "Rasband, Wayne (NIH/NIMH) [E]" <rasbandw at mail.nih.gov> wrote:
>> 
>>> On Jan 28, 2013, at 8:52 AM, Polder, Gerrit wrote:
>>> 
>>>> Since today my calibration software doesn't work anymore.
>>>> After a little bit of debugging it looks like setCalibration in ImagePlus doesn't set the calibration.
>>>> 
>>>> this code:
>>>>     ImagePlus overlay_im = new Duplicator().run(imp);
>>>>     IJ.log("1-> "+cal.getCalibration() + " - " + cal.getCalibration().scaled());
>>>>     overlay_im.setCalibration(cal.getCalibration());
>>>>     IJ.log("2-> " + overlay_im.getCalibration()+ " - " + overlay_im.getCalibration().scaled());
>>>> produces this output:
>>>> 1-> w=0.19120458891013384, h=0.19120458891013384, d=1.0, unit=mm, f=20, nc=null, table=null, vunit=Gray Value - true
>>>> 2-> w=1.0, h=1.0, d=1.0, unit=pixel, f=20, nc=null, table=null, vunit=Gray Value - false
>>> 
>>> Your code does not compile but this version works as expected:
>>> 
>>> ImagePlus imp = IJ.getImage();
>>> ImagePlus imp2 = new Duplicator().run(imp);
>>> IJ.log("1-> "+imp.getCalibration() + " - " + imp.getCalibration().scaled());
>>> IJ.log("2-> " + imp2.getCalibration()+ " - " + imp2.getCalibration().scaled());
>>> 
>>> This is the output:
>>> 
>>> 1-> w=0.02, h=0.02, d=0.02, unit=mm, f=20, nc=null, table=null, vunit=Gray Value - true
>>> 2-> w=0.02, h=0.02, d=0.02, unit=mm, f=20, nc=null, table=null, vunit=Gray Value - true
>>> 
>>> 
>>> -wayne
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 
> 








More information about the ImageJ-devel mailing list