Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
mitkDICOMReaderConfigurator.h
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 
13 #ifndef mitkDICOMReaderConfigurator_h
14 #define mitkDICOMReaderConfigurator_h
15 
18 
19 namespace tinyxml2
20 {
21  class XMLDocument;
22  class XMLElement;
23 }
24 
25 namespace mitk
26 {
27 
93 class MITKDICOM_EXPORT DICOMReaderConfigurator : public itk::LightObject
94 {
95  public:
96 
98  itkNewMacro( DICOMReaderConfigurator );
99 
100  DICOMFileReader::Pointer CreateFromConfigFile(const std::string& filename) const;
101  DICOMFileReader::Pointer CreateFromUTF8ConfigString(const std::string& xmlContents) const;
102 
108  static std::string GetConfigStringFromModuleResource(const std::string& resourcePath);
109 
110  std::string CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const;
111 
112  protected:
113 
115  ~DICOMReaderConfigurator() override;
116 
117  private:
118 
119  DICOMFileReader::Pointer CreateFromXMLDocument(tinyxml2::XMLDocument& doc) const;
120  DICOMTag tagFromXMLElement(const tinyxml2::XMLElement*) const;
121  std::string requiredStringAttribute(const tinyxml2::XMLElement* xmlElement, const std::string& key) const;
122  unsigned int hexStringToUInt(const std::string& s) const;
123 
124  ThreeDnTDICOMSeriesReader::Pointer ConfigureThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, const tinyxml2::XMLElement*) const;
125  DICOMITKSeriesGDCMReader::Pointer ConfigureDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, const tinyxml2::XMLElement*) const;
126  void ConfigureCommonPropertiesOfDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, const tinyxml2::XMLElement* element) const;
127  void ConfigureCommonPropertiesOfThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, const tinyxml2::XMLElement* element) const;
128 
129  DICOMSortCriterion::Pointer CreateDICOMSortByTag(const tinyxml2::XMLElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
130  DICOMSortCriterion::Pointer CreateSortByImagePositionPatient(const tinyxml2::XMLElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
131 
132  mitk::DICOMTagBasedSorter::Pointer CreateDICOMTagBasedSorter(const tinyxml2::XMLElement* element) const;
133 
134  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const DICOMITKSeriesGDCMReader* reader) const;
135  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const ThreeDnTDICOMSeriesReader* reader) const;
136  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const ClassicDICOMSeriesReader* reader) const;
137 
138  tinyxml2::XMLElement* CreateConfigStringFromDICOMDatasetSorter(tinyxml2::XMLDocument& doc, const DICOMTagBasedSorter* sorter) const;
139 
140  tinyxml2::XMLElement* CreateConfigStringFromDICOMTag(tinyxml2::XMLDocument& doc, const DICOMTag& tag) const;
141 
142  tinyxml2::XMLElement* CreateDICOMFileReaderTag(tinyxml2::XMLDocument& doc, const DICOMFileReader* reader) const;
143 
144  std::string toHexString(unsigned int i) const;
145 
147  bool QueryBooleanAttribute(const tinyxml2::XMLElement* element, const char* attributeName, bool defaultValue) const;
148  };
149 
150 } // namespace
151 
152 #endif
mitk::DICOMTag
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:32
mitkDICOMTagBasedSorter.h
mitk::DICOMTagBasedSorter
Sort DICOM datasets based on configurable tags.
Definition: mitkDICOMTagBasedSorter.h:40
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::DICOMFileReader
Interface for DICOM readers that produce mitk::Images.
Definition: mitkDICOMFileReader.h:55
mitkClassicDICOMSeriesReader.h
mitk::ClassicDICOMSeriesReader
Sorting and grouping like mitk::DicomSeriesReader until 2013.
Definition: mitkClassicDICOMSeriesReader.h:57
mitk::DICOMITKSeriesGDCMReader
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT,...
Definition: mitkDICOMITKSeriesGDCMReader.h:190
mitk::ThreeDnTDICOMSeriesReader
Extends DICOMITKSeriesGDCMReader by sorting/grouping into 3D+t image blocks.
Definition: mitkThreeDnTDICOMSeriesReader.h:41
tinyxml2
Definition: mitkContourModelReader.h:25
MITKDICOM_EXPORT
#define MITKDICOM_EXPORT
Definition: MitkDICOMExports.h:15
mitk::DICOMReaderConfigurator
Too-simple factory to create DICOMFileReaders.
Definition: mitkDICOMReaderConfigurator.h:93