Posted by
Fred Damen on
Sep 01, 2018; 2:37am
URL: http://imagej.273.s1.nabble.com/Some-DICOM-questions-tp5021144p5021149.html
Greetings,
See inline...
Fred
On Fri, August 31, 2018 9:12 am, Stein Rørvik wrote:
>>From previous examples posted to this list,
> we can read DICOM tags in a macro like this:
>
> open("
http://imagej.nih.gov/ij/images/ct.dcm.zip");
This is a radiograph, i.e., planar X-Ray, not a CT.
> studyDescription = getInfo("0008,1030");
> print("Study Description: "+ studyDescription);
>
> This works fine.
> If we select Show Info, the corresponding line is listed like this:
> 0008,1030 Study Description: TEMP BONE/ST NECK W
>
> My question is:
> Is there any easy way to get returned the DICOM tag name (in the above example
> "Study Description")
> as a string if I only know the DICOM tag number?
>
> What I want to do is something similar to this:
> DicomTag = "0008,1030";
> tagValue = getDicomTagValue(DicomTag);
> tagName = getDicomTagName(DicomTag);
> print("DICOM Tag Name: "+ tagName);
> print("DICOM Tag Value: "+ tagValue);
I have included below some Java methods that I use to get the values per a
DICOM tag on a slice bases. These should be easy to convert to macro language
of your choice. Each DICOM object has a tag/value list. The DICOMTools,
i.e., builtin methods, only gives the value(s) for the tag in the first slice.
If you are trying to process MRI diffusion/ASL/fMRI/MRE you are stuck rolling
your own to get the values per slice. Usually each DICOM object is a slice,
but it does not have to be.
Note that only the public tags, i.e., odd groups, are going to have human
readable names, unless you grab the DICOM Dictionary from the vendor that
produced your DICOM dataset(s).
>
> Another question, for those who work with medical data:
>
> If I have a DICOM three node of various scans done at the same MRI
> investigation,
> do any of the DICOM tags describe where the scans are located in the patient?
> That is, some kind of patient coordinate system that is the same for all scan?
> (assuming that the patient was not moved, of course)
There is no patient coordinae system per se. There is a coordinate system for
the inside of the bore of the magnet. The sweet spot is at 0,0,0, i.e., the
most homogeneous static / RF magnetic field in the center of the bore. There
are tags for the location of the patient with reference to this coordinate
system, i.e., 0020,0032 and 0020,0037.
>
> What I want to do is to select a certain point of interest in the patient,
> and create X Y Z orthoviews of the same location in all scans.
> Since I have no expertise in radiology, locating the same structure visually
> is not so
> easy as the scans are done with different contrast methods and aligned at
> different angles.
Usually the anatomical and other datasets are collected with the same FOV,
i.e., orientation and integer multiple resolution, specifically due to problem
you are trying to solve; thus your options are going to be limited. I would
look at 3Dslice or Osirix/Horos for possible options.
>
> If there is some kind of patient coordinate system in the DICOM tags,
> I could calculate the corresponding pixel in each stack and do a reslice along
> each axis through that point.
If you insist on rolling your own, search for the aforementioned tags.
The other datasets with interesting contrast are generally much lower
resolution and under rotational interpolation do not maintain their fidelity
to the underlying anatomical dataset.
Note that the calibrated coordinates that ImageJ displays, at least for MRI
datasets, is wrong, i.e., the aforementioned coordinate system tags are
ignored.
>
> Stein
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>
public double[] getArray(ImagePlus imp, int s, String tag) {
String[] vs = getTag(imp, s, tag).split("\\\\");
double[] ia = new double[vs.length];
for(int i=0; i<vs.length; i++)
ia[i] = Double.parseDouble(vs[i]);
return ia;
}
public double getDouble(ImagePlus imp, int s, String tag) {
return Double.parseDouble(getTag(imp, s, tag));
}
public int getInt(ImagePlus imp, int s, String tag) {
return Integer.parseInt(getTag(imp, s, tag));
}
// In hind sight I named the method backwards.
// Change the [1] to [0] and it will return the tag name for humans...
public String getTag(ImagePlus imp, int s, String tag) {
for(String line : imp.getStack().getSliceLabel(s).split("\n"))
if (line.startsWith(tag))
return line.split(": ",2)[1];
return null;
}
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html