Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitk::DICOMReaderConfigurator Class Reference

Too-simple factory to create DICOMFileReaders. More...

#include <mitkDICOMReaderConfigurator.h>

Inheritance diagram for mitk::DICOMReaderConfigurator:
Collaboration diagram for mitk::DICOMReaderConfigurator:

Public Member Functions

 mitkClassMacroItkParent (DICOMReaderConfigurator, itk::LightObject)
 
DICOMFileReader::Pointer CreateFromConfigFile (const std::string &filename) const
 
DICOMFileReader::Pointer CreateFromUTF8ConfigString (const std::string &xmlContents) const
 
std::string CreateConfigStringFromReader (DICOMFileReader::ConstPointer reader) const
 

Static Public Member Functions

static Pointer New ()
 
static std::string GetConfigStringFromModuleResource (const std::string &resourcePath)
 

Protected Member Functions

 DICOMReaderConfigurator ()
 
 ~DICOMReaderConfigurator () override
 

Detailed Description

Too-simple factory to create DICOMFileReaders.

This class is able to instantiate and configure (where possible) DICOMFileReaders from XML descriptions.

Note
This is a bad factory example, because the factory is not extensible and needs to know all the specific readers. A flexible implementation should be provided in a future version.

In its current version, the XML input is meant to be structured like

<?xml version="1.0" standalone=no>
<DICOMFileReader
  label="Example Reader"
  description="Sort images by example tags"
  class="DICOMITKSeriesGDCMReader"
  fixTiltByShearing="true">
<Distinguishing>
 <Tag name="SeriesInstanceUID" group="0020" element="000e"/>
 <Tag name="SeriesNumber" group="0020" element="0011"/>
</Distinguishing>
<Sorting>
 <ImagePositionPatient/>
 <Tag name="SOPInstanceUID" group="0x0008" element="0x0018"/>
</Sorting>
</DICOMFileReader>

The root-tag <DICOMFileReader> names the class to be instantiated, currently this can be one of

Both classes bring simple configuration flags with them and a description of how images are sorted prior to loading.

Flag for DICOMITKSeriesGDCMReader:

fixTiltByShearing="true|false"

Determines whether a potential gantry tilt should be "fixed" by shearing the output image.

Flag for ThreeDnTDICOMSeriesReader:

group3DnT="true|false"

Determines whether images at the same spatial position should be interpreted as 3D+t images.

The tags <Distinguishing> and <Sorting> describe the basic loading strategy of both reader mentioned above: first images are divided into incompatible groups (<Distinguishing>), and afterwards the images within each group are sorted by means of DICOMSortCriterion, which most commonly mentions a tag.

Tag element and group are interpreted as the exadecimal numbers found all around the DICOM standard. The numbers can be prepended by a "0x" if this is preferred by the programmer (but they are taken as hexadecimal in all cases).

About the future evolution of this class

This first version is hard coded for the current state of the implementation.

If things should evolve in a way that needs us to split off readers for "old" versions, time should be taken to refactor this class.

Basically, a serializer class should accompany each of the configurable classes. Such serializer classes should be registered and discovered via micro-services (to support extensions). A serializer should offer both methods to serialize a class and to desirialize it again.

A "version" attribute at the top-level tag should be used to distinguish versions.

Usually it should be enough to keep DE-serializers for all versions. Writers for the most recent version should be enough.

Definition at line 93 of file mitkDICOMReaderConfigurator.h.

Constructor & Destructor Documentation

◆ DICOMReaderConfigurator()

mitk::DICOMReaderConfigurator::DICOMReaderConfigurator ( )
protected

◆ ~DICOMReaderConfigurator()

mitk::DICOMReaderConfigurator::~DICOMReaderConfigurator ( )
overrideprotected

Member Function Documentation

◆ CreateConfigStringFromReader()

std::string mitk::DICOMReaderConfigurator::CreateConfigStringFromReader ( DICOMFileReader::ConstPointer  reader) const

◆ CreateFromConfigFile()

DICOMFileReader::Pointer mitk::DICOMReaderConfigurator::CreateFromConfigFile ( const std::string &  filename) const

◆ CreateFromUTF8ConfigString()

DICOMFileReader::Pointer mitk::DICOMReaderConfigurator::CreateFromUTF8ConfigString ( const std::string &  xmlContents) const

◆ GetConfigStringFromModuleResource()

static std::string mitk::DICOMReaderConfigurator::GetConfigStringFromModuleResource ( const std::string &  resourcePath)
static

Helper function that returns a config string for a DICOMReader that is compiled into a module resource of the MitkDICOM module.

Parameters
resourcePathPath of the resource in the module MitkDICOM.
Returns
Returns the config as string. If the passed resourcePath cannot be resolved, an empty string will be returned.

◆ mitkClassMacroItkParent()

mitk::DICOMReaderConfigurator::mitkClassMacroItkParent ( DICOMReaderConfigurator  ,
itk::LightObject   
)

◆ New()

static Pointer mitk::DICOMReaderConfigurator::New ( )
static

The documentation for this class was generated from the following file: