Posted by
Julian Cooper on
Apr 20, 2010; 1:49pm
URL: http://imagej.273.s1.nabble.com/Getting-the-scale-tp3686642p3686648.html
Sorry if I misunderstood,
I'm puzzled as well. If your imagewindow displays 36.95x36.95 microns
(512x512) in the subtitle then the image must be scaled, in which case the
cal.pixelWidth etc. will not return 1.0. It should return something like
0.07217 (i.e. 36.95/512). Only if the image has not been scaled then it will
return 1.0 pixels.
The values in the subtitle of the imagewindow are calculated by ImageJ using
imp.getWidth()*cal.pixelWidth and similar. The source can been seen at
http://rsbweb.nih.gov/ij/developer/source/ij/gui/ImageWindow.java.html(createSubtitle() method).
To scale the image in java you would need to calculate the appropriate
pixelWidth etc and assign it to cal.pixelWidth etc., as well as using the
setUnit() method (in ij.measure.Calibration) to set the name of the unit.
Kind regards,
Julian
> -----Original Message-----
> From: ImageJ Interest Group [mailto:
[hidden email]] On
> Behalf Of Cspr
> Sent: 19 April 2010 23:28
> To:
[hidden email]
> Subject: Re: Getting the scale
>
>
> Thank you for your suggestion.
>
> I might have mislead you slightly in my formulation of the
> question. See
> what I actually want is the scale or the ratio of pixels to
> microns. Using
> the cal.pixelwidth and similar calls simply returns 1.0 as
> the image IS in
> pixels. However I want that information in microns, hence I
> need to know the
> number of microns to pixels or vice-versa.
>
> When I open an image in ImageJ Fiji and run Analyze -> Set
> Scale it gives me
> a Distance in Pixels and it is THAT value I would so dearly like, but
> apparently no call within ImageJ allows me to extract either
>
> A) The microns of the image shown in the header of the image as e.g.
> 36.95x36.95 microns (512x512); 8-bit; 256K - i.e.
> B) The Distance in Pixels
>
> So from Java I would like to either get the Distance in
> Pixels or the micron
> number (in the above case that would be 36.95).
>
> I'm honestly baffled why it is so difficult to get that information.
> --
> View this message in context:
>
http://n2.nabble.com/Getting-the-scale-tp4927899p4928293.html> Sent from the ImageJ mailing list archive at Nabble.com.
>