Medical Imaging Interaction Toolkit  2018.4.99-87d68d9f
Medical Imaging Interaction Toolkit
mitkDICOMTagsOfInterestHelper.cpp
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
14 
16 
17 #include "usModuleContext.h"
18 #include "usGetModuleContext.h"
19 
20 mitk::DICOMTagPathMapType::value_type MakeLegacyEntry(const std::string& propName, const mitk::DICOMTag& tag)
21 {
22  return std::make_pair(tag, propName);
23 }
24 
25 mitk::DICOMTagPathMapType::value_type MakeEntry(const mitk::DICOMTagPath& tagPath)
26 {
27  return std::make_pair(tagPath, "");
28 }
29 
32 {
34 
35  std::vector<us::ServiceReference<mitk::IDICOMTagsOfInterest> > toiRegisters = us::GetModuleContext()->GetServiceReferences<mitk::IDICOMTagsOfInterest>();
36  if (toiRegisters.empty())
37  {
38  // bad, no service found, cannot get tags of interest
39  MITK_ERROR << "DICOM tag error: no service for DICOM tags of interest";
40  return result;
41  }
42  else if (toiRegisters.size() > 1)
43  {
44  MITK_WARN << "DICOM tag error: multiple service for DICOM tags of interest found. Using just one.";
45  }
46 
47  auto* toiRegister = us::GetModuleContext()->GetService<mitk::IDICOMTagsOfInterest>(toiRegisters.front());
48  if (!toiRegister)
49  {
50  MITK_ERROR << "Service lookup error, cannot get DICOM tag of interest service ";
51  }
52 
53  return toiRegister->GetTagsOfInterest();
54 }
55 
58 {
59  DICOMTagPathMapType result;
60  //These tags are copied from DICOMSeriesReader. The old naming style (deprecated)
61  //is kept for backwards compatibility until it is removed.
62  //Below we have also already added the properties with the new naming style
63 
64  // Patient module
65  /*dicom.patient.PatientsName*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0010)));
66  /*dicom.patient.PatientID*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0020)));
67  /*dicom.patient.PatientsBirthDate*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0030)));
68  /*dicom.patient.PatientsSex*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0040)));
69  /*dicom.patient.PatientsBirthTime*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0032)));
70  /*dicom.patient.OtherPatientIDs*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x1000)));
71  /*dicom.patient.OtherPatientNames*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x1001)));
72  /*dicom.patient.EthnicGroup*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x2160)));
73  /*dicom.patient.PatientComments*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x4000)));
74  /*dicom.patient.PatientIdentityRemoved*/ result.insert(MakeEntry(DICOMTag(0x0012, 0x0062)));
75  /*dicom.patient.DeIdentificationMethod*/ result.insert(MakeEntry(DICOMTag(0x0012, 0x0063)));
76 
77  // General Study module
78  /*dicom.study.StudyInstanceUID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x000d)));
79  /*dicom.study.StudyDate*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0020)));
80  /*dicom.study.StudyTime*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0030)));
81  /*dicom.study.ReferringPhysiciansName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0090)));
82  /*dicom.study.StudyID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0010)));
83  /*dicom.study.AccessionNumber*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0050)));
84  /*dicom.study.StudyDescription*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1030)));
85  /*dicom.study.PhysiciansOfRecord*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1048)));
86  /*dicom.study.NameOfPhysicianReadingStudy*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1060)));
87 
88  // General Series module
89  /*dicom.series.Modality*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0060)));
90  /*dicom.series.SeriesInstanceUID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x000e)));
91  /*dicom.series.SeriesNumber*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0011)));
92  /*dicom.series.Laterality*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0060)));
93  /*dicom.series.SeriesDate*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0021)));
94  /*dicom.series.SeriesTime*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0031)));
95  /*dicom.series.PerformingPhysiciansName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1050)));
96  /*dicom.series.ProtocolName*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x1030)));
97  /*dicom.series.SeriesDescription*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x103e)));
98  /*dicom.series.OperatorsName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1070)));
99  /*dicom.series.BodyPartExamined*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x0015)));
100  /*dicom.series.PatientPosition*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x5100)));
101  /*dicom.series.SmallestPixelValueInSeries*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0108)));
102  /*dicom.series.LargestPixelValueInSeries*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0109)));
103 
104  // VOI LUT module
105  /*dicom.voilut.WindowCenter*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1050)));
106  /*dicom.voilut.WindowWidth*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1051)));
107  /*dicom.voilut.WindowCenterAndWidthExplanation*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1055)));
108 
109  // Image Pixel module
110  /*dicom.pixel.PhotometricInterpretation*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0004)));
111  /*dicom.pixel.Rows*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0010)));
112  /*dicom.pixel.Columns*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0011)));
113 
114  // Image Plane module
115  /*dicom.PixelSpacing*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0030)));
116  /*dicom.ImagerPixelSpacing*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x1164)));
117 
118  //additional for RT
119  /*dicom.RescaleIntercept*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1052)));
120  /*dicom.RescaleSlope*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1053)));
121  /*dicom.ManufacturerModelName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1090)));
122  /*dicom.ManufacturerName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0070)));
123  /*dicom.InstitutionName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0080)));
124  /*dicom.StationName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1010)));
125  /*dicom.DoseGridScaling*/ result.insert(MakeEntry(DICOMTag(0x3004, 0x000e)));
126 
127  //Additions for RTPLAN
128  DICOMTagPath doseReferenceSequence;
129  doseReferenceSequence.AddAnySelection(0x300A, 0x0010);
130  DICOMTagPath fractionGroupSequence;
131  fractionGroupSequence.AddAnySelection(0x300A, 0x0070);
132  DICOMTagPath beamSequence;
133  beamSequence.AddAnySelection(0x300A, 0x00B0);
134  DICOMTagPath referencedStructureSetSequence;
135  referencedStructureSetSequence.AddAnySelection(0x300C, 0x0060);
136  result.insert(MakeEntry(DICOMTagPath(doseReferenceSequence).AddElement(0x300A, 0x0013))); //dicom.DoseReferenceSequence.DoseReferenceUID
137  result.insert(MakeEntry(DICOMTagPath(doseReferenceSequence).AddElement(0x300A, 0x0016))); //dicom.DoseReferenceSequence.DoseReferenceDescription
138  result.insert(MakeEntry(DICOMTagPath(doseReferenceSequence).AddElement(0x300A, 0x0026))); //dicom.DoseReferenceSequence.TargetPrescriptionDose
139  result.insert(MakeEntry(DICOMTagPath(fractionGroupSequence).AddElement(0x300A, 0x0078))); //dicom.FractionGroupSequence.NumberOfFractionsPlanned
140  result.insert(MakeEntry(DICOMTagPath(fractionGroupSequence).AddElement(0x300A, 0x0080))); //dicom.FractionGroupSequence.NumberOfBeams
141  result.insert(MakeEntry(DICOMTagPath(beamSequence).AddElement(0x300A, 0x00C6))); //dicom.BeamSequence.RadiationType
142  result.insert(MakeEntry(DICOMTagPath(referencedStructureSetSequence).AddElement(0x0008, 0x1155))); //dicom.ReferencedStructureSetSequence.ReferencedSOPInstanceUID
143 
144  //Additions for RTSTRUCT
145  DICOMTagPath structureSetROISequence;
146  structureSetROISequence.AddAnySelection(0x3006, 0x0020);
147  result.insert(MakeEntry(DICOMTagPath(structureSetROISequence).AddElement(0x3006, 0x0022))); //dicom.StructureSetROISequence.ROINumber
148  result.insert(MakeEntry(DICOMTagPath(structureSetROISequence).AddElement(0x3006, 0x0026))); //dicom.StructureSetROISequence.ROIName
149  result.insert(MakeEntry(DICOMTagPath(structureSetROISequence).AddElement(0x3006, 0x0024))); //dicom.StructureSetROISequence.ReferencedFrameOfReferenceUID
150 
151  //Additions for RTDOSE
152  DICOMTagPath planReferenceSequence;
153  planReferenceSequence.AddAnySelection(0x300C, 0x0002);
154  result.insert(MakeEntry(DICOMTagPath(planReferenceSequence).AddElement(0x0008, 0x1155))); //dicom.PlanReferenceSequence.ReferencedSOPInstanceUID
155 
156  //Additions for PET
157  DICOMTagPath radioPharmaRootTag;
158  radioPharmaRootTag.AddAnySelection(0x0054, 0x0016);
159  DICOMTagPath radioNuclideRootTag(radioPharmaRootTag);
160  radioNuclideRootTag.AddAnySelection(0x0054, 0x0300);
161 
162  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x0031))); //dicom.pet.Radiopharmaceutical
163  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1072))); //dicom.pet.RadiopharmaceuticalStartTime
164  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1074))); //dicom.pet.RadionuclideTotalDose
165  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1075))); //dicom.pet.RadionuclideHalfLife
166  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1076))); //dicom.pet.RadionuclidePositronFraction
167 
168  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0100))); //dicom.pet.Radionuclide.CodeValue
169  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0102))); //dicom.pet.Radionuclide.CodingSchemeDesignator
170  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0104))); //dicom.pet.Radionuclide.CodemManing
171 
172  result.insert(MakeEntry(DICOMTag(0x0054, 0x1001))); //dicom.pet.RadioactivityUnits
173  result.insert(MakeEntry(DICOMTag(0x0054, 0x1102))); //dicom.pet.DecayCorrection
174  result.insert(MakeEntry(DICOMTag(0x0054, 0x1321))); //dicom.pet.DecayFactor
175  result.insert(MakeEntry(DICOMTag(0x0054, 0x1300))); //dicom.pet.FrameReferenceTime
176 
177  result.insert(MakeEntry(DICOMTag(0x0010, 0x1030))); //dicom.patient.PatientWeight
178  result.insert(MakeEntry(DICOMTag(0x0010, 0x1020))); //dicom.patient.PatientSize
179 
180  //Other interesting acquisition correlated information
181  result.insert(MakeEntry(DICOMTag(0x0008, 0x0022))); //dicom.acquisition date
182  result.insert(MakeEntry(DICOMTag(0x0008, 0x0032))); //dicom.acquisition time
183  result.insert(MakeEntry(DICOMTag(0x0008, 0x002a))); //dicom.acquisition datetime
184  result.insert(MakeEntry(DICOMTag(0x0008, 0x0080))); //dicom.Modality
185  result.insert(MakeEntry(DICOMTag(0x0018, 0x002a))); //dicom.Sequence Name
186  result.insert(MakeEntry(DICOMTag(0x0018, 0x0020))); //dicom.Scanning Sequence
187  result.insert(MakeEntry(DICOMTag(0x0018, 0x0021))); //dicom.Sequence Variant
188  result.insert(MakeEntry(DICOMTag(0x0018, 0x0080))); //dicom.TR
189  result.insert(MakeEntry(DICOMTag(0x0018, 0x0081))); //dicom.TE
190  result.insert(MakeEntry(DICOMTag(0x0018, 0x1310))); //dicom.Acquisition Matrix
191  result.insert(MakeEntry(DICOMTag(0x0018, 0x0087))); //dicom.Magnetic Field Strength
192 
193  //SOP
194  result.insert(MakeEntry(DICOMTag(0x0008, 0x0018))); //SOP Instance UID
195  result.insert(MakeEntry(DICOMTag(0x0020, 0x0013))); //Instance number
196  result.insert(MakeEntry(DICOMTag(0x0020, 0x1041))); //Slice location
197 
198  return result;
199 };
mitk::DICOMTagPathMapType::value_type MakeLegacyEntry(const std::string &propName, const mitk::DICOMTag &tag)
DICOMTagPath & AddAnySelection(unsigned int group, unsigned int element)
Class is used to identify (nested) attributes in a DICOM dataset. In contrast to the class DICOMTag...
DICOMTagPathMapType MITKDICOMREADER_EXPORT GetCurrentDICOMTagsOfInterest()
#define MITK_ERROR
Definition: mitkLogMacros.h:20
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:32
Interface of DICOM tags of interest service.
void * GetService(const ServiceReferenceBase &reference)
#define MITK_WARN
Definition: mitkLogMacros.h:19
DICOMTagPathMapType MITKDICOMREADER_EXPORT GetDefaultDICOMTagsOfInterest()
std::vector< ServiceReferenceU > GetServiceReferences(const std::string &clazz, const std::string &filter=std::string())
mitk::DICOMTagPathMapType::value_type MakeEntry(const mitk::DICOMTagPath &tagPath)
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
std::map< DICOMTagPath, std::string > DICOMTagPathMapType