Calibrate function for 32bits images

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Calibrate function for 32bits images

Gannier, François
Dear all (probably mostly Wayne)

When I use  Analyse/calibrate in menu, I can set the unit for the value
of a 32bits image.
With the macro recorder, I obtain:
            run("Calibrate...", "function=None"); 
the way the unit was set isn't shown and this isn't working in a macro.

In a macro, I tried:
            run("Calibrate...", "unit=ms");
but this isn't working.

More when you save the image, with the unit set, this isn't saved.

So, is It possible to add a way to set this unit in a macro for 32bits
image and add this in the imageinfo just something like that:
Calibration function: None
  Unit: "ms"

Best regards,
François


--
*François GANNIER*
Directeur Dpt Physiologie Animale
/Université de Tours - Faculté des Sciences et Techniques
Avenue Monge - 37200 TOURS
02 47 36 70 13/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Calibrate function for 32bits images

Marcel.
I could reproduce this possible bug with this macro:

run("M51 Galaxy (177K, 16-bits)");
run("32-bit");
run("Calibrate...", "function=None unit=ms");

The documentation (and the warning dialog) write that it should be possible,
see:

https://imagej.nih.gov/ij/docs/guide/146-30.html#sub:Calibrate...

The macro recorder doesn't record a changed unit with 32-bit images, too.



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Calibrate function for 32bits images

CARL Philippe (LBP)
Dear Marcel,
I'm not sure it is an issue with the picture type nor the Analyze>Calibrate... method.
I can reproduce the issue with the following small plugin:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.measure.Calibration;

public class My_Plugin implements PlugIn {

        public void run(String arg) {
                ImagePlus imp = IJ.openImage("http://wsr.imagej.net/images/m51.zip");
// IJ.run(imp, "32-bit", "");
                Calibration cal = new Calibration(imp);
                cal.pixelWidth  = 1.5;
                cal.pixelHeight = 1.4;
                cal.setXUnit    ("micronx");
                cal.setYUnit    ("microny");
                cal.setValueUnit("µs");
                imp.setCalibration(cal);
                imp.show();
                IJ.log(imp.getCalibration().getValueUnit());
                IJ.run(imp, "Show Info...", "");
        }

}

My best regards,

Philippe

----- Mail original -----
De: "Marcel." <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Mercredi 10 Juillet 2019 11:11:32
Objet: Re: Calibrate function for 32bits images

I could reproduce this possible bug with this macro:

run("M51 Galaxy (177K, 16-bits)");
run("32-bit");
run("Calibrate...", "function=None unit=ms");

The documentation (and the warning dialog) write that it should be possible,
see:

https://imagej.nih.gov/ij/docs/guide/146-30.html#sub:Calibrate...

The macro recorder doesn't record a changed unit with 32-bit images, too.



--
Sent from: http://imagej.1557.x6.nabble.com/

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Calibrate function for 32bits images

Wayne Rasband-2
In reply to this post by Gannier, François
> On Jul 10, 2019, at 4:25 AM, François Gannier <[hidden email]> wrote:
>
> Dear all (probably mostly Wayne)
>
> When I use  Analyse/calibrate in menu, I can set the unit for the value
> of a 32bits image.
> With the macro recorder, I obtain:
>             run("Calibrate...", "function=None"); \

Upgrade to the latest daily build (1.52q20) and you will get

    run("Calibrate...", "function=None unit=ms");

> the way the unit was set isn't shown and this isn't working in a macro.
>
> In a macro, I tried:
>             run("Calibrate...", "unit=ms");
> but this isn't working.

It will work if you upgrade to the daily build.

> More when you save the image, with the unit set, this isn't saved.

The unit is saved with the image.

> So, is It possible to add a way to set this unit in a macro for 32bits
> image and add this in the imageinfo just something like that:
> Calibration function: None
>   Unit: “ms"

Upgrade to the daily build, set the unit using

    run("Calibrate...", "function=None unit=ms”);

and the following information will be added to Image>Show Info window:

   Calibration function: None
     Unit: “ms"

This macro reproduces the problem:

   newImage("Untitled", "32-bit noise", 512, 512, 1);
   run("Calibrate...", "function=None unit=ms");
   run("Show Info...”);

-wayne

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Calibrate function for 32bits images

Gannier, François
In reply to this post by Gannier, François
Thank you Wayne for your very fast reactivity.
this is exactly what I needed and is working perfectly.

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html