Login  Register

Re: Get the pixel Size

Posted by BenDehap on Feb 01, 2016; 1:45pm
URL: http://imagej.273.s1.nabble.com/Get-the-pixel-Size-tp5015501p5015510.html

Hello Michael,

First thank you for your answer, someone give me a simple way to resolve my problem as following : 


getPixelSize (unit, pixelWidth, pixelHeight);
if (unit=="microns"){
x=pixelWidth;}
else exit ("No calibration");

but i seen that the method you propose is widely used on forums. 
Would it be possible to show me an example of code using "x" for the value of the pixel witdh and "image1" for the name of my image.

I don't know if you have the time to do it, but i'm a coding beginner and i feell a bit lost.

Thanks anyway.

Ben


2016-02-01 11:15 GMT+01:00 Michael Entrup [via ImageJ] <[hidden email]>:
Hi Ben,

each ImagePlus [1] has a method called ``getCalibration()``. It returns
the Calibration [2] instance of the ImagePlus. The Calibration Object
contains all the methods you need. ``getUnit()`` returns a String to
check if the unit is µm. ``getX(double x)`` converts a pixel value into
a physical unit.

Best regards
Michael

[1]: http://rsb.info.nih.gov/ij/developer/api/ij/ImagePlus.html
[2]: http://rsb.info.nih.gov/ij/developer/api/ij/measure/Calibration.html


On 31.01.2016 20:37, BenDehap wrote:

> Hello,
>
> I have a simple problem and reading different forums didn't help me to
> resolve it.
>
> I need for my ImageJ Plugins to attribute to a variable "x" the value of the
> pixel size in "µm" used in my pre-calibrated "image1".
>
> It would really help me if someone can help me on this case.
>
> Thanks very much.
>
> Ben
>
>
>
> --
> View this message in context: http://imagej.1557.x6.nabble.com/Get-the-pixel-Size-tp5015501.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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



If you reply to this email, your message will be added to the discussion below:
http://imagej.1557.x6.nabble.com/Get-the-pixel-Size-tp5015501p5015507.html
To unsubscribe from Get the pixel Size, click here.
NAML