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



_______________________________________________
ImageJ-devel mailing list
[email protected]
http://imagej.net/mailman/listinfo/imagej-devel

Reply via email to