Hi Gary,
Has anyone got any experience of accessing the DICOM header within a plugin?
> How do I get retrieving this data with my plugin?
>
If the calibration is set (via Image::Properties, usually this is set
during file import by the DICOM reader), then you can access this
information in a plugin using:
ImagePlus imp = ...; // my image
Calibration cal = imp.getCalibration();
double physicalX = cal.pixelWidth;
double physicalY = cal.pixelHeight;
double physicalZ = cal.pixelHeight;
String spaceUnit = cal.unit;
double physicalT = cal.frameInterval;
String timeUnit = cal.timeUnit;
There are other fields of Calibration too that apply in certain cases;
check out the Javadoc:
http://fiji.sc/javadoc/ij/measure/Calibration.htmlAnd the source code:
http://fiji.sc/Calibration.javaIf for some reason your calibration is not set when importing the DICOM
file, then try a different DICOM reader. There are multiple options:
1) The DICOM reader built in to ImageJ (used by File > Open)
2) The TUDOR DICOM Tools:
http://santec.tudor.lu/project/dicom3) Bio-Formats:
http://fiji.sc/Bio-Formats;http://loci.wisc.edu/bio-formats/imagejNote that Bio-Formats is part of Fiji (
http://fiji.sc/).
If none of the above options read your calibration information correctly,
and you know it is stored properly in the file header, then feel free to
report a bug to the respective project maintainers. In the case of
Bio-Formats, see:
http://loci.wisc.edu/bio-formats/bug-reporting. Or you
can use Fiji's "Report a Bug" and "Upload Sample Image" commands in the
Help menu.
HTH,
Curtis
On Thu, Apr 19, 2012 at 10:15 AM, Gary <
[hidden email]> wrote:
> Hi,
>
> I have hit a stumbling block, I'm currently working on a DICOM image and I
> require a measurement of distance (mm) rather than number of pixels
> between two
> points.
>
> The Dicom header contains a tag on the pixel spacing.
>
> Has anyone got any experience of accessing the DICOM header within a
> plugin?
> How do I get retrieving this data with my plugin?
>
> Thanks for your time
>
> Gary
>