Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY
10 {
11 }
12  without
13 even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 A PARTICULAR PURPOSE.
15 
16 See LICENSE.txt or http://www.mitk.org for details.
17 
18 ===================================================================*/
19 
21 
23 
24 #include "usModuleContext.h"
25 #include "usGetModuleContext.h"
26 
27 mitk::DICOMTagPathMapType::value_type MakeLegacyEntry(const std::string& propName, const mitk::DICOMTag& tag)
28 {
29  return std::make_pair(tag, propName);
30 }
31 
32 mitk::DICOMTagPathMapType::value_type MakeEntry(const mitk::DICOMTagPath& tagPath)
33 {
34  return std::make_pair(tagPath, "");
35 }
36 
39 {
41 
42  std::vector<us::ServiceReference<mitk::IDICOMTagsOfInterest> > toiRegisters = us::GetModuleContext()->GetServiceReferences<mitk::IDICOMTagsOfInterest>();
43  if (toiRegisters.empty())
44  {
45  // bad, no service found, cannot get tags of interest
46  MITK_ERROR << "DICOM tag error: no service for DICOM tags of interest";
47  return result;
48  }
49  else if (toiRegisters.size() > 1)
50  {
51  MITK_WARN << "DICOM tag error: multiple service for DICOM tags of interest found. Using just one.";
52  }
53 
54  IDICOMTagsOfInterest* toiRegister = us::GetModuleContext()->GetService<mitk::IDICOMTagsOfInterest>(toiRegisters.front());
55  if (!toiRegister)
56  {
57  MITK_ERROR << "Service lookup error, cannot get DICOM tag of interest service ";
58  }
59 
60  return toiRegister->GetTagsOfInterest();
61 }
62 
65 {
66  DICOMTagPathMapType result;
67  //These tags are copied from DICOMSeriesReader. The old naming style (deprecated)
68  //is keept for backwards compatibility until it is removed.
69  //Below we have also already added the properties with the new naming style
70 
71  // Patient module
72  /*dicom.patient.PatientsName*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0010)));
73  /*dicom.patient.PatientID*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0020)));
74  /*dicom.patient.PatientsBirthDate*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0030)));
75  /*dicom.patient.PatientsSex*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0040)));
76  /*dicom.patient.PatientsBirthTime*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x0032)));
77  /*dicom.patient.OtherPatientIDs*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x1000)));
78  /*dicom.patient.OtherPatientNames*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x1001)));
79  /*dicom.patient.EthnicGroup*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x2160)));
80  /*dicom.patient.PatientComments*/ result.insert(MakeEntry(DICOMTag(0x0010, 0x4000)));
81  /*dicom.patient.PatientIdentityRemoved*/ result.insert(MakeEntry(DICOMTag(0x0012, 0x0062)));
82  /*dicom.patient.DeIdentificationMethod*/ result.insert(MakeEntry(DICOMTag(0x0012, 0x0063)));
83 
84  // General Study module
85  /*dicom.study.StudyInstanceUID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x000d)));
86  /*dicom.study.StudyDate*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0020)));
87  /*dicom.study.StudyTime*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0030)));
88  /*dicom.study.ReferringPhysiciansName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0090)));
89  /*dicom.study.StudyID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0010)));
90  /*dicom.study.AccessionNumber*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0050)));
91  /*dicom.study.StudyDescription*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1030)));
92  /*dicom.study.PhysiciansOfRecord*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1048)));
93  /*dicom.study.NameOfPhysicianReadingStudy*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1060)));
94 
95  // General Series module
96  /*dicom.series.Modality*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0060)));
97  /*dicom.series.SeriesInstanceUID*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x000e)));
98  /*dicom.series.SeriesNumber*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0011)));
99  /*dicom.series.Laterality*/ result.insert(MakeEntry(DICOMTag(0x0020, 0x0060)));
100  /*dicom.series.SeriesDate*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0021)));
101  /*dicom.series.SeriesTime*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0031)));
102  /*dicom.series.PerformingPhysiciansName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1050)));
103  /*dicom.series.ProtocolName*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x1030)));
104  /*dicom.series.SeriesDescription*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x103e)));
105  /*dicom.series.OperatorsName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1070)));
106  /*dicom.series.BodyPartExamined*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x0015)));
107  /*dicom.series.PatientPosition*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x5100)));
108  /*dicom.series.SmallestPixelValueInSeries*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0108)));
109  /*dicom.series.LargestPixelValueInSeries*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0109)));
110 
111  // VOI LUT module
112  /*dicom.voilut.WindowCenter*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1050)));
113  /*dicom.voilut.WindowWidth*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1051)));
114  /*dicom.voilut.WindowCenterAndWidthExplanation*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1055)));
115 
116  // Image Pixel module
117  /*dicom.pixel.PhotometricInterpretation*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0004)));
118  /*dicom.pixel.Rows*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0010)));
119  /*dicom.pixel.Columns*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0011)));
120 
121  // Image Plane module
122  /*dicom.PixelSpacing*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x0030)));
123  /*dicom.ImagerPixelSpacing*/ result.insert(MakeEntry(DICOMTag(0x0018, 0x1164)));
124 
125  //additional for RT
126  /*dicom.RescaleIntercept*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1052)));
127  /*dicom.RescaleSlope*/ result.insert(MakeEntry(DICOMTag(0x0028, 0x1053)));
128  /*dicom.ManufacturerModelName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1090)));
129  /*dicom.ManufacturerName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0070)));
130  /*dicom.InstitutionName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x0080)));
131  /*dicom.StationName*/ result.insert(MakeEntry(DICOMTag(0x0008, 0x1010)));
132  /*dicom.DoseGridScaling*/ result.insert(MakeEntry(DICOMTag(0x3004, 0x000e)));
133 
134  //Additions for PET
135  DICOMTagPath radioPharmaRootTag;
136  radioPharmaRootTag.AddAnySelection(0x0054, 0x0016);
137  DICOMTagPath radioNuclideRootTag(radioPharmaRootTag);
138  radioNuclideRootTag.AddAnySelection(0x0054, 0x0300);
139 
140  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x0031))); //dicom.pet.Radiopharmaceutical
141  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1072))); //dicom.pet.RadiopharmaceuticalStartTime
142  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1074))); //dicom.pet.RadionuclideTotalDose
143  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1075))); //dicom.pet.RadionuclideHalfLife
144  result.insert(MakeEntry(DICOMTagPath(radioPharmaRootTag).AddElement(0x0018, 0x1076))); //dicom.pet.RadionuclidePositronFraction
145 
146  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0100))); //dicom.pet.Radionuclide.CodeValue
147  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0102))); //dicom.pet.Radionuclide.CodingSchemeDesignator
148  result.insert(MakeEntry(DICOMTagPath(radioNuclideRootTag).AddElement(0x0008, 0x0104))); //dicom.pet.Radionuclide.CodemManing
149 
150  result.insert(MakeEntry(DICOMTag(0x0054, 0x1001))); //dicom.pet.RadioactivityUnits
151  result.insert(MakeEntry(DICOMTag(0x0054, 0x1102))); //dicom.pet.DecayCorrection
152  result.insert(MakeEntry(DICOMTag(0x0054, 0x1321))); //dicom.pet.DecayFactor
153  result.insert(MakeEntry(DICOMTag(0x0054, 0x1300))); //dicom.pet.FrameReferenceTime
154 
155  result.insert(MakeEntry(DICOMTag(0x0010, 0x1030))); //dicom.patient.PatientWeight
156  result.insert(MakeEntry(DICOMTag(0x0010, 0x1020))); //dicom.patient.PatientSize
157 
158  //Other interesting acquisition correlated information
159  result.insert(MakeEntry(DICOMTag(0x0008, 0x0022))); //dicom.acquisition date
160  result.insert(MakeEntry(DICOMTag(0x0008, 0x0032))); //dicom.acquisition time
161  result.insert(MakeEntry(DICOMTag(0x0008, 0x002a))); //dicom.acquisition datetime
162  result.insert(MakeEntry(DICOMTag(0x0008, 0x0080))); //dicom.Modality
163  result.insert(MakeEntry(DICOMTag(0x0018, 0x002a))); //dicom.Sequence Name
164  result.insert(MakeEntry(DICOMTag(0x0018, 0x0020))); //dicom.Scanning Sequence
165  result.insert(MakeEntry(DICOMTag(0x0018, 0x0021))); //dicom.Sequence Variant
166  result.insert(MakeEntry(DICOMTag(0x0018, 0x0080))); //dicom.TR
167  result.insert(MakeEntry(DICOMTag(0x0018, 0x0081))); //dicom.TE
168  result.insert(MakeEntry(DICOMTag(0x0018, 0x1310))); //dicom.Acquisition Matrix
169  result.insert(MakeEntry(DICOMTag(0x0018, 0x0087))); //dicom.Magnetic Field Strength
170 
171  //SOP
172  result.insert(MakeEntry(DICOMTag(0x0008, 0x0018))); //SOP Instance UID
173  result.insert(MakeEntry(DICOMTag(0x0020, 0x0013))); //Instance number
174  result.insert(MakeEntry(DICOMTag(0x0020, 0x1041))); //Slice location
175 
176  return result;
177 };
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:24
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:37
Interface of DICOM tags of interest service.
void * GetService(const ServiceReferenceBase &reference)
#define MITK_WARN
Definition: mitkLogMacros.h:23
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)
virtual DICOMTagPathMapType GetTagsOfInterest() const =0
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
std::map< DICOMTagPath, std::string > DICOMTagPathMapType