Medical Imaging Interaction Toolkit  2026.06.00
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 
105  DICOMFileReader::Pointer CreateFromConfigFile(const std::string& filename) const;
106 
112  DICOMFileReader::Pointer CreateFromUTF8ConfigString(const std::string& xmlContents) const;
113 
119  static std::string GetConfigStringFromModuleResource(const std::string& resourcePath);
120 
126  std::string CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const;
127 
128  protected:
129 
132 
133  private:
134 
135  DICOMFileReader::Pointer CreateFromXMLDocument(tinyxml2::XMLDocument& doc) const;
136  DICOMTag tagFromXMLElement(const tinyxml2::XMLElement*) const;
137  std::string requiredStringAttribute(const tinyxml2::XMLElement* xmlElement, const std::string& key) const;
138  unsigned int hexStringToUInt(const std::string& s) const;
139 
140  ThreeDnTDICOMSeriesReader::Pointer ConfigureThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, const tinyxml2::XMLElement*) const;
141  DICOMITKSeriesGDCMReader::Pointer ConfigureDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, const tinyxml2::XMLElement*) const;
142  void ConfigureCommonPropertiesOfDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, const tinyxml2::XMLElement* element) const;
143  void ConfigureCommonPropertiesOfThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, const tinyxml2::XMLElement* element) const;
144 
145  DICOMSortCriterion::Pointer CreateDICOMSortByTag(const tinyxml2::XMLElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
146  DICOMSortCriterion::Pointer CreateSortByImagePositionPatient(const tinyxml2::XMLElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
147 
148  mitk::DICOMTagBasedSorter::Pointer CreateDICOMTagBasedSorter(const tinyxml2::XMLElement* element) const;
149 
150  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const DICOMITKSeriesGDCMReader* reader) const;
151  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const ThreeDnTDICOMSeriesReader* reader) const;
152  tinyxml2::XMLElement* CreateConfigStringFromReader(tinyxml2::XMLDocument& doc, const ClassicDICOMSeriesReader* reader) const;
153 
154  tinyxml2::XMLElement* CreateConfigStringFromDICOMDatasetSorter(tinyxml2::XMLDocument& doc, const DICOMTagBasedSorter* sorter) const;
155 
156  tinyxml2::XMLElement* CreateConfigStringFromDICOMTag(tinyxml2::XMLDocument& doc, const DICOMTag& tag) const;
157 
158  tinyxml2::XMLElement* CreateDICOMFileReaderTag(tinyxml2::XMLDocument& doc, const DICOMFileReader* reader) const;
159 
160  std::string toHexString(unsigned int i) const;
161 
163  bool QueryBooleanAttribute(const tinyxml2::XMLElement* element, const char* attributeName, bool defaultValue) const;
164  };
165 
166 } // namespace
167 
168 #endif
#define MITKDICOM_EXPORT
Sorting and grouping like mitk::DicomSeriesReader until 2013.
Interface for DICOM readers that produce mitk::Images.
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT,...
Too-simple factory to create DICOMFileReaders.
DICOMFileReader::Pointer CreateFromConfigFile(const std::string &filename) const
Create a DICOMFileReader from an XML configuration file.
DICOMFileReader::Pointer CreateFromUTF8ConfigString(const std::string &xmlContents) const
Create a DICOMFileReader from an XML configuration string (UTF-8 encoded).
static std::string GetConfigStringFromModuleResource(const std::string &resourcePath)
Retrieve a configuration string from a compiled-in module resource.
std::string CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const
Serialize a DICOMFileReader's configuration to an XML string.
mitkClassMacroItkParent(DICOMReaderConfigurator, itk::LightObject)
Sort DICOM datasets based on configurable tags.
Representation of a DICOM tag.
Definition: mitkDICOMTag.h:33
Extends DICOMITKSeriesGDCMReader by sorting/grouping into 3D+t image blocks.
Find image slices visible on a given plane.