Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::DicomSeriesReader Class Reference

#include <mitkDicomSeriesReader.h>

Classes

class  CallbackCommand
 ITK command adapter for progress callbacks. More...
 
class  GantryTiltInformation
 Gantry tilt analysis result. More...
 
class  ImageBlockDescriptor
 Return type of GetSeries, describes a logical group of DICOM files. More...
 
class  SliceGroupingAnalysisResult
 Return type of DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption. More...
 

Public Types

enum  ReaderImplementationLevel { ReaderImplementationLevel_Supported , ReaderImplementationLevel_PartlySupported , ReaderImplementationLevel_Implemented , ReaderImplementationLevel_Unsupported }
 Describes how well the reader is tested for a certain file type (SOP Class). More...
 
enum  PixelSpacingInterpretation { PixelSpacingInterpretation_SpacingInPatient , PixelSpacingInterpretation_SpacingAtDetector , PixelSpacingInterpretation_SpacingUnknown }
 How the mitk::Image pixel spacing should be interpreted. More...
 
typedef std::vector< std::string > StringContainer
 Container type for lists of DICOM filenames. More...
 
typedef void(* UpdateCallBackMethod) (float)
 Function pointer type for progress callbacks. More...
 
typedef std::map< std::string, ImageBlockDescriptor > FileNamesGrouping
 Map type from enhanced UID strings to ImageBlockDescriptor instances. More...
 

Static Public Member Functions

static std::string GetConfigurationString ()
 Provide the combination of preprocessor defines that was active during compilation. More...
 
static bool IsDicom (const std::string &filename)
 Check if a specific file contains DICOM data. More...
 
static FileNamesGrouping GetSeries (const std::string &dir, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer())
 Find all series (and sub-series) in a particular directory. More...
 
static StringContainer GetSeries (const std::string &dir, const std::string &series_uid, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer())
 Find files belonging to a specific DICOM series in a directory. More...
 
static FileNamesGrouping GetSeries (const StringContainer &files, bool sortTo3DPlust, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer())
 PREFERRED version – scan and sort a list of DICOM files into loadable blocks. More...
 
static FileNamesGrouping GetSeries (const StringContainer &files, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer())
 Scan and sort DICOM files (without explicit 3D+t control). More...
 
static DataNode::Pointer LoadDicomSeries (const StringContainer &filenames, bool sort=true, bool load4D=true, bool correctGantryTilt=true, UpdateCallBackMethod callback=nullptr, itk::SmartPointer< Image > preLoadedImageBlock=nullptr)
 Load a DICOM series into a new DataNode. More...
 
static bool LoadDicomSeries (const StringContainer &filenames, DataNode &node, bool sort=true, bool load4D=true, bool correctGantryTilt=true, UpdateCallBackMethod callback=nullptr, itk::SmartPointer< Image > preLoadedImageBlock=nullptr)
 Load a DICOM series into an existing DataNode. More...
 
static bool IsPhilips3DDicom (const std::string &filename)
 Check if a specific file is a Philips 3D ultrasound DICOM file. More...
 
static std::string ReaderImplementationLevelToString (const ReaderImplementationLevel &enumValue)
 Convert a ReaderImplementationLevel enum value to a human-readable string. More...
 
static std::string PixelSpacingInterpretationToString (const PixelSpacingInterpretation &enumValue)
 Convert a PixelSpacingInterpretation enum value to a human-readable string. More...
 

Protected Types

typedef std::pair< StringContainer, StringContainer > TwoStringContainers
 Pair of string containers used for internal sorting operations. More...
 
typedef std::map< std::string, std::string > TagToPropertyMapType
 Map type from DICOM tag strings to MITK property name strings. More...
 
typedef itk::GDCMImageIO DcmIoType
 Typedef for the GDCM image IO class used internally. More...
 

Static Protected Member Functions

static SliceGroupingAnalysisResult AnalyzeFileForITKImageSeriesReaderSpacingAssumption (const StringContainer &files, bool groupsOfSimilarImages, const gdcm::Scanner::MappingType &tagValueMappings_)
 Ensure equal z-spacing for a group of files. More...
 
static std::string ConstCharStarToString (const char *s)
 Safely convert a const char pointer to std::string. More...
 
static bool DICOMStringToSpacing (const std::string &s, ScalarType &spacingX, ScalarType &spacingY)
 Parse a DICOM spacing string into pixel spacing X and Y values. More...
 
static Point3D DICOMStringToPoint3D (const std::string &s, bool &successful)
 Convert a DICOM string describing a 3D point to Point3D. More...
 
static void DICOMStringToOrientationVectors (const std::string &s, Vector3D &right, Vector3D &up, bool &successful)
 Convert a DICOM orientation string to two direction vectors. More...
 
template<typename ImageType >
static ImageType::Pointer InPlaceFixUpTiltedGeometry (ImageType *input, const GantryTiltInformation &tiltInfo)
 Correct a tilted image geometry by resampling with a shear transformation. More...
 
static StringContainer SortSeriesSlices (const StringContainer &unsortedFilenames)
 
static bool ReadPhilips3DDicom (const std::string &filename, itk::SmartPointer< Image > output_image)
 Read a Philips 3D ultrasound DICOM file and load it into an mitk::Image. More...
 
static std::string CreateMoreUniqueSeriesIdentifier (gdcm::Scanner::TagToValue &tagValueMap)
 Construct a UID that incorporates sorting criteria from GetSeries(). More...
 
static std::string CreateSeriesIdentifierPart (gdcm::Scanner::TagToValue &tagValueMap, const gdcm::Tag &tag)
 Extract a single tag value as a string for use in CreateMoreUniqueSeriesIdentifier(). More...
 
static std::string IDifyTagValue (const std::string &value)
 Sanitize a tag value string for use as part of a UID. More...
 
static void FixSpacingInformation (Image *image, const ImageBlockDescriptor &imageBlockDescriptor)
 Correct the pixel spacing of a loaded image based on the image block descriptor. More...
 
static void ScanForSliceInformation (const StringContainer &filenames, gdcm::Scanner &scanner)
 Scan DICOM files for slice-relevant tag information. More...
 
static void LoadDicom (const StringContainer &filenames, DataNode &node, bool sort, bool check_4d, bool correctTilt, UpdateCallBackMethod callback, itk::SmartPointer< Image > preLoadedImageBlock)
 Perform the actual loading of a DICOM series. More...
 
template<typename PixelType >
static itk::SmartPointer< Image > LoadDICOMByITK (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITK (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Pixel-type multiplexer for LoadDICOMByITK – dispatches to scalar or RGB variants. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITKScalar (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Scalar pixel type multiplexer for LoadDICOMByITK. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITKRGBPixel (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 RGB pixel type multiplexer for LoadDICOMByITK. More...
 
template<typename PixelType >
static itk::SmartPointer< Image > LoadDICOMByITK4D (std::list< StringContainer > &imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Feed files into itk::ImageSeriesReader for 3D+t loading. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITK4D (std::list< StringContainer > &imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Pixel-type multiplexer for LoadDICOMByITK4D – dispatches to scalar or RGB variants. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITK4DScalar (std::list< StringContainer > &imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 Scalar pixel type multiplexer for LoadDICOMByITK4D. More...
 
static itk::SmartPointer< Image > MultiplexLoadDICOMByITK4DRGBPixel (std::list< StringContainer > &imageBlocks, ImageBlockDescriptor imageBlockDescriptor, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock)
 RGB pixel type multiplexer for LoadDICOMByITK4D. More...
 
static std::list< StringContainer > SortIntoBlocksFor3DplusT (const StringContainer &presortedFilenames, const gdcm::Scanner::MappingType &tagValueMappings_, bool sort, bool &canLoadAs4D)
 Sort files into time step blocks for 3D+t image loading. More...
 
static bool GdcmSortFunction (const gdcm::DataSet &ds1, const gdcm::DataSet &ds2)
 Spatial sorting comparator for GDCM 2 datasets. More...
 
static void CopyMetaDataToImageProperties (StringContainer filenames, const gdcm::Scanner::MappingType &tagValueMappings_, DcmIoType *io, const ImageBlockDescriptor &blockInfo, Image *image)
 Copy DICOM tag information to the PropertyList of an mitk::Image (single block). More...
 
static void CopyMetaDataToImageProperties (std::list< StringContainer > imageBlock, const gdcm::Scanner::MappingType &tagValueMappings_, DcmIoType *io, const ImageBlockDescriptor &blockInfo, Image *image)
 Copy DICOM tag information to the PropertyList of an mitk::Image (4D blocks). More...
 
static const TagToPropertyMapType & GetDICOMTagsToMITKPropertyMap ()
 Get the mapping from DICOM tags to MITK property names. More...
 

Detailed Description

Definition at line 346 of file mitkDicomSeriesReader.h.

Member Typedef Documentation

◆ DcmIoType

typedef itk::GDCMImageIO mitk::DicomSeriesReader::DcmIoType
protected

Typedef for the GDCM image IO class used internally.

Definition at line 977 of file mitkDicomSeriesReader.h.

◆ FileNamesGrouping

Map type from enhanced UID strings to ImageBlockDescriptor instances.

Definition at line 481 of file mitkDicomSeriesReader.h.

◆ StringContainer

typedef std::vector<std::string> mitk::DicomSeriesReader::StringContainer

Container type for lists of DICOM filenames.

Definition at line 352 of file mitkDicomSeriesReader.h.

◆ TagToPropertyMapType

typedef std::map<std::string, std::string> mitk::DicomSeriesReader::TagToPropertyMapType
protected

Map type from DICOM tag strings to MITK property name strings.

Definition at line 809 of file mitkDicomSeriesReader.h.

◆ TwoStringContainers

Pair of string containers used for internal sorting operations.

Definition at line 806 of file mitkDicomSeriesReader.h.

◆ UpdateCallBackMethod

typedef void(* mitk::DicomSeriesReader::UpdateCallBackMethod) (float)

Function pointer type for progress callbacks.

The callback receives a float value in [0,1] representing the loading progress.

Definition at line 359 of file mitkDicomSeriesReader.h.

Member Enumeration Documentation

◆ PixelSpacingInterpretation

How the mitk::Image pixel spacing should be interpreted.

Compare DICOM PS 3.3 10.7 (Basic Pixel Spacing Calibration Macro).

Enumerator
PixelSpacingInterpretation_SpacingInPatient 

Distances are mm within a patient.

PixelSpacingInterpretation_SpacingAtDetector 

Distances are mm at detector surface.

PixelSpacingInterpretation_SpacingUnknown 

No spacing information is present; (1,1) is used as default.

Definition at line 383 of file mitkDicomSeriesReader.h.

◆ ReaderImplementationLevel

Describes how well the reader is tested for a certain file type (SOP Class).

Applications should not rely on the outcome for images which are reported as ReaderImplementationLevel_Implemented or ReaderImplementationLevel_Unsupported.

Errors loading images reported as ReaderImplementationLevel_Supported are considered bugs. For ReaderImplementationLevel_PartlySupported, check the appropriate paragraph in Limitations for specific modalities.

Enumerator
ReaderImplementationLevel_Supported 

Loader code and tests are established.

ReaderImplementationLevel_PartlySupported 

Loader code and tests are established for specific parts of a SOP Class.

ReaderImplementationLevel_Implemented 

Loader code is implemented but not accompanied by tests.

ReaderImplementationLevel_Unsupported 

Loader code is not working with this SOP Class.

Definition at line 371 of file mitkDicomSeriesReader.h.

Member Function Documentation

◆ AnalyzeFileForITKImageSeriesReaderSpacingAssumption()

static SliceGroupingAnalysisResult mitk::DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption ( const StringContainer &  files,
bool  groupsOfSimilarImages,
const gdcm::Scanner::MappingType &  tagValueMappings_ 
)
staticprotected

Ensure equal z-spacing for a group of files.

Takes as input a number of images which are all equally oriented and spatially sorted along their normal direction. Internally used by GetSeries().

Returns a SliceGroupingAnalysisResult where the first list contains slices with equal inter-slice spacing and the second list contains remaining files that need to be run through this method again.

Parameters
filesSpatially sorted list of DICOM filenames to analyze.
groupsOfSimilarImagesWhether to group images with similar but not identical spacing.
tagValueMappings_GDCM scanner tag-value mappings for the files.
Returns
The grouping analysis result.

◆ ConstCharStarToString()

static std::string mitk::DicomSeriesReader::ConstCharStarToString ( const char *  s)
staticprotected

Safely convert a const char pointer to std::string.

Parameters
sThe C-string to convert (may be nullptr).
Returns
The string value, or an empty string if s is nullptr.

◆ CopyMetaDataToImageProperties() [1/2]

static void mitk::DicomSeriesReader::CopyMetaDataToImageProperties ( std::list< StringContainer >  imageBlock,
const gdcm::Scanner::MappingType &  tagValueMappings_,
DcmIoType *  io,
const ImageBlockDescriptor &  blockInfo,
Image *  image 
)
staticprotected

Copy DICOM tag information to the PropertyList of an mitk::Image (4D blocks).

Overload for 3D+t images with multiple time-step blocks.

Parameters
imageBlockList of filename containers, one per time step.
tagValueMappings_GDCM scanner tag-value mappings.
ioThe GDCM image IO instance with loaded metadata.
blockInfoThe image block descriptor with additional metadata.
imageThe MITK image to receive the properties.

◆ CopyMetaDataToImageProperties() [2/2]

static void mitk::DicomSeriesReader::CopyMetaDataToImageProperties ( StringContainer  filenames,
const gdcm::Scanner::MappingType &  tagValueMappings_,
DcmIoType *  io,
const ImageBlockDescriptor &  blockInfo,
Image *  image 
)
staticprotected

Copy DICOM tag information to the PropertyList of an mitk::Image (single block).

Extracts metadata from ITK's MetaDataDictionary and from the GDCM scanner tag mappings, then stores them as MITK properties on the image.

Parameters
filenamesThe DICOM file paths for metadata extraction.
tagValueMappings_GDCM scanner tag-value mappings.
ioThe GDCM image IO instance with loaded metadata.
blockInfoThe image block descriptor with additional metadata.
imageThe MITK image to receive the properties.

◆ CreateMoreUniqueSeriesIdentifier()

static std::string mitk::DicomSeriesReader::CreateMoreUniqueSeriesIdentifier ( gdcm::Scanner::TagToValue &  tagValueMap)
staticprotected

Construct a UID that incorporates sorting criteria from GetSeries().

Enhances the Series Instance UID with additional tag values to create a unique identifier for each loadable image block.

Parameters
tagValueMapThe GDCM tag-to-value mapping for the series.
Returns
An enhanced unique identifier string.

◆ CreateSeriesIdentifierPart()

static std::string mitk::DicomSeriesReader::CreateSeriesIdentifierPart ( gdcm::Scanner::TagToValue &  tagValueMap,
const gdcm::Tag &  tag 
)
staticprotected

Extract a single tag value as a string for use in CreateMoreUniqueSeriesIdentifier().

Parameters
tagValueMapThe GDCM tag-to-value mapping.
tagThe DICOM tag to extract.
Returns
The tag value as a string, or an empty string if not found.

◆ DICOMStringToOrientationVectors()

static void mitk::DicomSeriesReader::DICOMStringToOrientationVectors ( const std::string &  s,
Vector3D &  right,
Vector3D &  up,
bool &  successful 
)
staticprotected

Convert a DICOM orientation string to two direction vectors.

DICOM tags like ImageOrientationPatient contain two vectors as float numbers separated by backslashes (e.g., "1\\0\\0\\0\\1\\0").

Parameters
sThe DICOM orientation string.
rightOutput parameter for the row direction vector.
upOutput parameter for the column direction vector.
successfulOutput flag indicating whether parsing succeeded.

◆ DICOMStringToPoint3D()

static Point3D mitk::DicomSeriesReader::DICOMStringToPoint3D ( const std::string &  s,
bool &  successful 
)
staticprotected

Convert a DICOM string describing a 3D point to Point3D.

DICOM tags like ImagePositionPatient contain a position as float numbers separated by backslashes (e.g., "42.7131\\13.77\\0.7").

Parameters
sThe DICOM position string.
successfulOutput flag indicating whether parsing succeeded.
Returns
The parsed 3D point.

◆ DICOMStringToSpacing()

static bool mitk::DicomSeriesReader::DICOMStringToSpacing ( const std::string &  s,
ScalarType &  spacingX,
ScalarType &  spacingY 
)
staticprotected

Parse a DICOM spacing string into pixel spacing X and Y values.

Parameters
sThe DICOM spacing string (backslash-separated).
spacingXOutput parameter for the X spacing.
spacingYOutput parameter for the Y spacing.
Returns
True if parsing succeeded, false otherwise.

◆ FixSpacingInformation()

static void mitk::DicomSeriesReader::FixSpacingInformation ( Image *  image,
const ImageBlockDescriptor &  imageBlockDescriptor 
)
staticprotected

Correct the pixel spacing of a loaded image based on the image block descriptor.

Parameters
imageThe loaded image whose spacing may need correction.
imageBlockDescriptorThe descriptor containing pixel spacing information.

◆ GdcmSortFunction()

static bool mitk::DicomSeriesReader::GdcmSortFunction ( const gdcm::DataSet &  ds1,
const gdcm::DataSet &  ds2 
)
staticprotected

Spatial sorting comparator for GDCM 2 datasets.

Sorts by image position along image normal (distance from world origin). In cases of conflict, acquisition time is used as a secondary criterion.

Parameters
ds1First GDCM dataset to compare.
ds2Second GDCM dataset to compare.
Returns
True if ds1 should precede ds2 in the sort order.

◆ GetConfigurationString()

static std::string mitk::DicomSeriesReader::GetConfigurationString ( )
static

Provide the combination of preprocessor defines that was active during compilation.

Since this class is a combination of several possible implementations separated only by ifdefs, calling instances might want to know which flags were active at compile time.

Returns
A human-readable configuration string.

◆ GetDICOMTagsToMITKPropertyMap()

static const TagToPropertyMapType& mitk::DicomSeriesReader::GetDICOMTagsToMITKPropertyMap ( )
staticprotected

Get the mapping from DICOM tags to MITK property names.

Returns a positive list for copying specified DICOM tags (from ITK's ImageIO) to MITK properties. ITK provides MetaDataDictionary entries of form "gggg|eeee" (g = group, e = element), e.g. "0028,0109" (Largest Pixel in Series), which are mapped to names like "dicom.series.largest_pixel_in_series".

Returns
A const reference to the tag-to-property map.

◆ GetSeries() [1/4]

static FileNamesGrouping mitk::DicomSeriesReader::GetSeries ( const std::string &  dir,
bool  groupImagesWithGantryTilt,
const StringContainer &  restrictions = StringContainer() 
)
static

Find all series (and sub-series) in a particular directory.

Scans the given directory for DICOM files, groups them, and returns the result. See the preferred overload taking a StringContainer for details.

Parameters
dirThe directory to scan for DICOM files.
groupImagesWithGantryTiltWhether to apply gantry tilt correction grouping.
restrictionsAdditional DICOM tag restrictions for grouping.
Returns
A map from enhanced UID strings to ImageBlockDescriptor instances.
See also
GetSeries(const StringContainer&, bool, bool, const StringContainer&)

◆ GetSeries() [2/4]

static StringContainer mitk::DicomSeriesReader::GetSeries ( const std::string &  dir,
const std::string &  series_uid,
bool  groupImagesWithGantryTilt,
const StringContainer &  restrictions = StringContainer() 
)
static

Find files belonging to a specific DICOM series in a directory.

This differs from the other GetSeries() overloads by restricting results to a single known DICOM series, identified by its Series Instance UID. Internally delegates to the directory-based GetSeries() method.

Warning
Untested; may or may not work correctly.
Parameters
dirThe directory to scan for DICOM files.
series_uidThe Series Instance UID to filter for.
groupImagesWithGantryTiltWhether to apply gantry tilt correction grouping.
restrictionsAdditional DICOM tag restrictions for grouping.
Returns
A sorted list of filenames belonging to the specified series.

◆ GetSeries() [3/4]

static FileNamesGrouping mitk::DicomSeriesReader::GetSeries ( const StringContainer &  files,
bool  groupImagesWithGantryTilt,
const StringContainer &  restrictions = StringContainer() 
)
static

Scan and sort DICOM files (without explicit 3D+t control).

Convenience overload that defaults 3D+t sorting to true. Prefer the overload with explicit sortTo3DPlust parameter.

Parameters
filesList of DICOM file paths to analyze.
groupImagesWithGantryTiltWhether to apply gantry tilt correction grouping.
restrictionsAdditional DICOM tag restrictions for grouping.
Returns
A map from UID-like keys to ImageBlockDescriptor instances.
See also
GetSeries(const StringContainer&, bool, bool, const StringContainer&)

◆ GetSeries() [4/4]

static FileNamesGrouping mitk::DicomSeriesReader::GetSeries ( const StringContainer &  files,
bool  sortTo3DPlust,
bool  groupImagesWithGantryTilt,
const StringContainer &  restrictions = StringContainer() 
)
static

PREFERRED version – scan and sort a list of DICOM files into loadable blocks.

Parse a list of files for images of DICOM series. For each series, an enumeration of the files contained in it is created.

SeriesInstanceUID will be enhanced to be unique for each set of file names that is later loadable as a single mitk::Image. This implies that image orientation, slice thickness, pixel spacing, rows, and columns must be the same for each file (i.e. the image slice contained in the file).

If this separation logic requires that a SeriesInstanceUID must be made more specialized, it will follow the same logic as itk::GDCMSeriesFileNames to enhance the UID with more digits and dots.

Parameters
filesList of DICOM file paths to analyze.
sortTo3DPlustWhether to attempt grouping into 3D+t blocks.
groupImagesWithGantryTiltWhether to apply gantry tilt correction grouping.
restrictionsAdditional DICOM tag restrictions for grouping.
Returns
A map from UID-like keys to ImageBlockDescriptor instances with sorted file lists.
Warning
Adding restrictions is not yet implemented.

◆ IDifyTagValue()

static std::string mitk::DicomSeriesReader::IDifyTagValue ( const std::string &  value)
staticprotected

Sanitize a tag value string for use as part of a UID.

Removes or replaces characters that would not be suitable in an identifier string.

Parameters
valueThe raw tag value string.
Returns
A sanitized string suitable for use in a UID.

◆ InPlaceFixUpTiltedGeometry()

template<typename ImageType >
static ImageType::Pointer mitk::DicomSeriesReader::InPlaceFixUpTiltedGeometry ( ImageType *  input,
const GantryTiltInformation &  tiltInfo 
)
staticprotected

Correct a tilted image geometry by resampling with a shear transformation.

Applies a correction for gantry tilt by resampling the image using itk::ResampleFilter.

Template Parameters
ImageTypeThe ITK image type.
Parameters
inputThe input image with tilted geometry.
tiltInfoThe gantry tilt information describing the correction needed.
Returns
The corrected image.
Note
Despite the name, this is NOT an in-place operation.

◆ IsDicom()

static bool mitk::DicomSeriesReader::IsDicom ( const std::string &  filename)
static

Check if a specific file contains DICOM data.

Parameters
filenamePath to the file to check.
Returns
True if the file contains DICOM data, false otherwise.

◆ IsPhilips3DDicom()

static bool mitk::DicomSeriesReader::IsPhilips3DDicom ( const std::string &  filename)
static

Check if a specific file is a Philips 3D ultrasound DICOM file.

Checks for the presence of tag (3001,0010) set to "Philips3D".

Parameters
filenamePath to the DICOM file to check.
Returns
True if the file is a Philips 3D ultrasound DICOM, false otherwise.

◆ LoadDicom()

static void mitk::DicomSeriesReader::LoadDicom ( const StringContainer &  filenames,
DataNode &  node,
bool  sort,
bool  check_4d,
bool  correctTilt,
UpdateCallBackMethod  callback,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Perform the actual loading of a DICOM series.

Determines the pixel type, invokes the appropriate templated loader, and populates the DataNode with the resulting image and properties.

Parameters
filenamesThe DICOM file paths to load.
nodeThe DataNode to populate.
sortWhether to sort files spatially before loading.
check_4dWhether to attempt 3D+t loading.
correctTiltWhether to correct for gantry tilt.
callbackOptional progress callback.
preLoadedImageBlockOptional pre-loaded image block.

◆ LoadDICOMByITK()

template<typename PixelType >
static itk::SmartPointer<Image> mitk::DicomSeriesReader::LoadDICOMByITK ( const StringContainer &  ,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image.

Template Parameters
PixelTypeThe pixel type for the ITK image reader.
Parameters
correctTiltWhether to apply gantry tilt correction after loading.
tiltInfoThe gantry tilt information for correction.
ioThe GDCM image IO instance to use.
commandOptional ITK command for progress reporting.
preLoadedImageBlockOptional pre-loaded image to use instead of reading.
Returns
The loaded MITK image, or nullptr on failure.

◆ LoadDICOMByITK4D()

template<typename PixelType >
static itk::SmartPointer<Image> mitk::DicomSeriesReader::LoadDICOMByITK4D ( std::list< StringContainer > &  imageBlocks,
ImageBlockDescriptor  imageBlockDescriptor,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Feed files into itk::ImageSeriesReader for 3D+t loading.

Loads multiple time-step blocks into a single 4D MITK image.

Template Parameters
PixelTypeThe pixel type for the ITK image reader.
Parameters
imageBlocksList of filename containers, one per time step.
imageBlockDescriptorDescriptor for the image block.
correctTiltWhether to apply gantry tilt correction.
tiltInfoThe gantry tilt information for correction.
ioThe GDCM image IO instance to use.
commandOptional ITK command for progress reporting.
preLoadedImageBlockOptional pre-loaded image block.
Returns
The loaded 3D+t MITK image, or nullptr on failure.

◆ LoadDicomSeries() [1/2]

static DataNode::Pointer mitk::DicomSeriesReader::LoadDicomSeries ( const StringContainer &  filenames,
bool  sort = true,
bool  load4D = true,
bool  correctGantryTilt = true,
UpdateCallBackMethod  callback = nullptr,
itk::SmartPointer< Image >  preLoadedImageBlock = nullptr 
)
static

Load a DICOM series into a new DataNode.

Loads the DICOM series composed of the given filenames and wraps the result in a DataNode. If a callback method is supplied, it will be called after every progress update with a progress value in [0,1].

Parameters
filenamesThe DICOM file paths to load.
sortWhether files should be sorted spatially (true) or not (false, useful if presorted).
load4DWhether to attempt loading the files as 3D+t (if possible).
correctGantryTiltWhether to correct for gantry tilt during loading.
callbackOptional progress callback function.
preLoadedImageBlockOptional pre-loaded image to use instead of reading from disk.
Returns
A DataNode containing the loaded mitk::Image, or nullptr on failure.

◆ LoadDicomSeries() [2/2]

static bool mitk::DicomSeriesReader::LoadDicomSeries ( const StringContainer &  filenames,
DataNode &  node,
bool  sort = true,
bool  load4D = true,
bool  correctGantryTilt = true,
UpdateCallBackMethod  callback = nullptr,
itk::SmartPointer< Image >  preLoadedImageBlock = nullptr 
)
static

Load a DICOM series into an existing DataNode.

Same as the other LoadDicomSeries() overload but stores the result into the provided DataNode reference. If preLoadedImageBlock is provided, the reader will only create appropriate mitk::Properties without actually reading pixel data.

Parameters
filenamesThe DICOM file paths to load.
nodeThe DataNode to populate with the loaded image and properties.
sortWhether files should be sorted spatially.
load4DWhether to attempt loading the files as 3D+t.
correctGantryTiltWhether to correct for gantry tilt during loading.
callbackOptional progress callback function.
preLoadedImageBlockOptional pre-loaded image to use instead of reading from disk.
Returns
True if loading succeeded, false otherwise.

◆ MultiplexLoadDICOMByITK()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITK ( const StringContainer &  ,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Pixel-type multiplexer for LoadDICOMByITK – dispatches to scalar or RGB variants.

◆ MultiplexLoadDICOMByITK4D()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITK4D ( std::list< StringContainer > &  imageBlocks,
ImageBlockDescriptor  imageBlockDescriptor,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Pixel-type multiplexer for LoadDICOMByITK4D – dispatches to scalar or RGB variants.

◆ MultiplexLoadDICOMByITK4DRGBPixel()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITK4DRGBPixel ( std::list< StringContainer > &  imageBlocks,
ImageBlockDescriptor  imageBlockDescriptor,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

RGB pixel type multiplexer for LoadDICOMByITK4D.

◆ MultiplexLoadDICOMByITK4DScalar()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITK4DScalar ( std::list< StringContainer > &  imageBlocks,
ImageBlockDescriptor  imageBlockDescriptor,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Scalar pixel type multiplexer for LoadDICOMByITK4D.

◆ MultiplexLoadDICOMByITKRGBPixel()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITKRGBPixel ( const StringContainer &  ,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

RGB pixel type multiplexer for LoadDICOMByITK.

◆ MultiplexLoadDICOMByITKScalar()

static itk::SmartPointer<Image> mitk::DicomSeriesReader::MultiplexLoadDICOMByITKScalar ( const StringContainer &  ,
bool  correctTilt,
const GantryTiltInformation &  tiltInfo,
DcmIoType::Pointer &  io,
CallbackCommand *  command,
itk::SmartPointer< Image >  preLoadedImageBlock 
)
staticprotected

Scalar pixel type multiplexer for LoadDICOMByITK.

◆ PixelSpacingInterpretationToString()

static std::string mitk::DicomSeriesReader::PixelSpacingInterpretationToString ( const PixelSpacingInterpretation &  enumValue)
static

Convert a PixelSpacingInterpretation enum value to a human-readable string.

Parameters
enumValueThe enum value to convert.
Returns
A readable string representation.

◆ ReaderImplementationLevelToString()

static std::string mitk::DicomSeriesReader::ReaderImplementationLevelToString ( const ReaderImplementationLevel &  enumValue)
static

Convert a ReaderImplementationLevel enum value to a human-readable string.

Parameters
enumValueThe enum value to convert.
Returns
A readable string representation.

◆ ReadPhilips3DDicom()

static bool mitk::DicomSeriesReader::ReadPhilips3DDicom ( const std::string &  filename,
itk::SmartPointer< Image >  output_image 
)
staticprotected

Read a Philips 3D ultrasound DICOM file and load it into an mitk::Image.

Parameters
filenamePath to the Philips 3D DICOM file.
output_imageThe image to populate with the loaded data.
Returns
True if reading succeeded, false otherwise.

◆ ScanForSliceInformation()

static void mitk::DicomSeriesReader::ScanForSliceInformation ( const StringContainer &  filenames,
gdcm::Scanner &  scanner 
)
staticprotected

Scan DICOM files for slice-relevant tag information.

Configures and runs the GDCM scanner to extract tags needed for spatial sorting and grouping (position, orientation, spacing, etc.).

Parameters
filenamesThe DICOM files to scan.
scannerThe GDCM scanner to configure and execute.

◆ SortIntoBlocksFor3DplusT()

static std::list<StringContainer> mitk::DicomSeriesReader::SortIntoBlocksFor3DplusT ( const StringContainer &  presortedFilenames,
const gdcm::Scanner::MappingType &  tagValueMappings_,
bool  sort,
bool &  canLoadAs4D 
)
staticprotected

Sort files into time step blocks for 3D+t image loading.

Called by LoadDicom(). Expects a single list of filenames previously sorted by GetSeries(). Determines how many time steps can be filled with the given files.

The number of time steps is determined by how often the first spatial position repeats in the sorted input. For example, if the first three files describe the same location in space, three time-step blocks are constructed and the remaining files are distributed among them.

Parameters
presortedFilenamesThe spatially sorted list of DICOM filenames.
tagValueMappings_GDCM scanner tag-value mappings for the files.
sortWhether to sort within each time step block.
canLoadAs4DOutput flag indicating whether 4D loading is possible.
Returns
A list of StringContainers, one per time step.

◆ SortSeriesSlices()

static StringContainer mitk::DicomSeriesReader::SortSeriesSlices ( const StringContainer &  unsortedFilenames)
staticprotected
\brief Sort a set of file names in an order that is meaningful for loading them into an mitk::Image.

\warning This method assumes that input files are similar in basic properties such as
         slice thickness, image orientation, pixel spacing, rows, columns.
         It should always be ok to put the result of a call to GetSeries(..) into this method.

Sorting order is determined by

 1. image position along its normal (distance from world origin)
 2. acquisition time

If P<n> denotes a position and T<n> denotes a time step, this method will order slices from three timesteps like

this:

  P1T1 P1T2 P1T3 P2T1 P2T2 P2T3 P3T1 P3T2 P3T3

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