Re: Getting the scale

Posted by Julian Cooper on
URL: http://imagej.273.s1.nabble.com/Getting-the-scale-tp3686642p3686643.html

Hi Cspr,

Where cal is a declared Calibration object and imp the ImagePlus object of
interest use:

        cal = imp.getCalibration();
        x = cal.pixelWidth; //x contains the pixel width in units
        y = cal.pixelHeight; //y contains the pixel height in units
        z = cal.pixelDepth; //z contains the pixel (voxel) depth in units

if you need the name of the unit (e.g. micron) then ij.measure.getUnit()
returns the singular form as a string and ij.measure.getUnits() the plural.

Hope this helps,

Julian

> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On
> Behalf Of Cspr
> Sent: 19 April 2010 22:00
> To: [hidden email]
> Subject: Getting the scale
>
>
> Dear user,
>
> How do you get the scale of an image? For instance when you
> open an image
> taken with a microscope the meta-data displayed just above
> the image can say
> something like "36.74x36.74 micron" followed by (512 x 512
> pixels). How can
> you get the micron information from inside java i.e. how do I
> get 36.74 or
> some magnitude of it returned from Java? I've tried the
> calibration for the
> image but no method seems to return it. Any suggestions?
>
> Thanks
> --
> View this message in context:
> http://n2.nabble.com/Getting-the-scale-tp4927899p4927899.html
> Sent from the ImageJ mailing list archive at Nabble.com.
>