Medical Imaging Interaction Toolkit
2023.12.00
Medical Imaging Interaction Toolkit
|
#include <mitkDicomSeriesReader.h>
Classes | |
class | CallbackCommand |
Progress callback for DicomSeriesReader. More... | |
class | GantryTiltInformation |
Gantry tilt analysis result. More... | |
class | ImageBlockDescriptor |
Return type of GetSeries, describes a logical group of 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. More... | |
enum | PixelSpacingInterpretation { PixelSpacingInterpretation_SpacingInPatient, PixelSpacingInterpretation_SpacingAtDetector, PixelSpacingInterpretation_SpacingUnknown } |
How the mitk::Image spacing should be interpreted. More... | |
typedef std::vector< std::string > | StringContainer |
Lists of filenames. More... | |
typedef void(* | UpdateCallBackMethod) (float) |
Interface for the progress callback. More... | |
typedef std::map< std::string, ImageBlockDescriptor > | FileNamesGrouping |
Static Public Member Functions | |
static std::string | GetConfigurationString () |
Provide combination of preprocessor defines that was active during compilation. More... | |
static bool | IsDicom (const std::string &filename) |
Checks if a specific file contains DICOM data. More... | |
static FileNamesGrouping | GetSeries (const std::string &dir, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer()) |
see other GetSeries(). More... | |
static StringContainer | GetSeries (const std::string &dir, const std::string &series_uid, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer()) |
see other GetSeries(). More... | |
static FileNamesGrouping | GetSeries (const StringContainer &files, bool sortTo3DPlust, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer()) |
PREFERRED version of this method - scan and sort DICOM files. More... | |
static FileNamesGrouping | GetSeries (const StringContainer &files, bool groupImagesWithGantryTilt, const StringContainer &restrictions=StringContainer()) |
See other GetSeries(). 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) |
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) |
See LoadDicomSeries! Just a slightly different interface. More... | |
static bool | IsPhilips3DDicom (const std::string &filename) |
Checks if a specific file is a Philips3D ultrasound DICOM file. More... | |
static std::string | ReaderImplementationLevelToString (const ReaderImplementationLevel &enumValue) |
static std::string | PixelSpacingInterpretationToString (const PixelSpacingInterpretation &enumValue) |
Protected Types | |
typedef std::pair< StringContainer, StringContainer > | TwoStringContainers |
for internal sorting. More... | |
typedef std::map< std::string, std::string > | TagToPropertyMapType |
Maps DICOM tags to MITK properties. More... | |
typedef itk::GDCMImageIO | DcmIoType |
Static Protected Member Functions | |
static SliceGroupingAnalysisResult | AnalyzeFileForITKImageSeriesReaderSpacingAssumption (const StringContainer &files, bool groupsOfSimilarImages, const gdcm::Scanner::MappingType &tagValueMappings_) |
Ensure an equal z-spacing for a group of files. More... | |
static std::string | ConstCharStarToString (const char *s) |
Safely convert const char* to std::string. More... | |
static bool | DICOMStringToSpacing (const std::string &s, ScalarType &spacingX, ScalarType &spacingY) |
Safely convert a string into pixel spacing x and y. More... | |
static Point3D | DICOMStringToPoint3D (const std::string &s, bool &successful) |
Convert DICOM string describing a point to Point3D. More... | |
static void | DICOMStringToOrientationVectors (const std::string &s, Vector3D &right, Vector3D &up, bool &successful) |
Convert DICOM string describing a point two Vector3D. More... | |
template<typename ImageType > | |
static ImageType::Pointer | InPlaceFixUpTiltedGeometry (ImageType *input, const GantryTiltInformation &tiltInfo) |
static StringContainer | SortSeriesSlices (const StringContainer &unsortedFilenames) |
static bool | ReadPhilips3DDicom (const std::string &filename, itk::SmartPointer< Image > output_image) |
Read a Philips3D ultrasound DICOM file and put into an mitk::Image. More... | |
static std::string | CreateMoreUniqueSeriesIdentifier (gdcm::Scanner::TagToValue &tagValueMap) |
Construct a UID that takes into account sorting criteria from GetSeries(). More... | |
static std::string | CreateSeriesIdentifierPart (gdcm::Scanner::TagToValue &tagValueMap, const gdcm::Tag &tag) |
Helper for CreateMoreUniqueSeriesIdentifier. More... | |
static std::string | IDifyTagValue (const std::string &value) |
Helper for CreateMoreUniqueSeriesIdentifier. More... | |
static void | FixSpacingInformation (Image *image, const ImageBlockDescriptor &imageBlockDescriptor) |
static void | ScanForSliceInformation (const StringContainer &filenames, gdcm::Scanner &scanner) |
Scan for slice image information. More... | |
static void | LoadDicom (const StringContainer &filenames, DataNode &node, bool sort, bool check_4d, bool correctTilt, UpdateCallBackMethod callback, itk::SmartPointer< Image > preLoadedImageBlock) |
Performs actual loading of a series and creates an image having the specified pixel type. 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) |
static itk::SmartPointer< Image > | MultiplexLoadDICOMByITKScalar (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock) |
static itk::SmartPointer< Image > | MultiplexLoadDICOMByITKRGBPixel (const StringContainer &, bool correctTilt, const GantryTiltInformation &tiltInfo, DcmIoType::Pointer &io, CallbackCommand *command, itk::SmartPointer< Image > preLoadedImageBlock) |
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) |
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) |
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) |
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) |
static std::list< StringContainer > | SortIntoBlocksFor3DplusT (const StringContainer &presortedFilenames, const gdcm::Scanner::MappingType &tagValueMappings_, bool sort, bool &canLoadAs4D) |
Sort files into time step blocks of a 3D+t image. More... | |
static bool | GdcmSortFunction (const gdcm::DataSet &ds1, const gdcm::DataSet &ds2) |
Defines spatial sorting for sorting by GDCM 2. More... | |
static void | CopyMetaDataToImageProperties (StringContainer filenames, const gdcm::Scanner::MappingType &tagValueMappings_, DcmIoType *io, const ImageBlockDescriptor &blockInfo, Image *image) |
Copy information about files and DICOM tags from ITK's MetaDataDictionary and from the list of input files to the PropertyList of mitk::Image. More... | |
static void | CopyMetaDataToImageProperties (std::list< StringContainer > imageBlock, const gdcm::Scanner::MappingType &tagValueMappings_, DcmIoType *io, const ImageBlockDescriptor &blockInfo, Image *image) |
static const TagToPropertyMapType & | GetDICOMTagsToMITKPropertyMap () |
Map between DICOM tags and MITK properties. More... | |
Definition at line 346 of file mitkDicomSeriesReader.h.
|
protected |
Definition at line 866 of file mitkDicomSeriesReader.h.
typedef std::map<std::string, ImageBlockDescriptor> mitk::DicomSeriesReader::FileNamesGrouping |
Definition at line 479 of file mitkDicomSeriesReader.h.
typedef std::vector<std::string> mitk::DicomSeriesReader::StringContainer |
Lists of filenames.
Definition at line 352 of file mitkDicomSeriesReader.h.
|
protected |
Maps DICOM tags to MITK properties.
Definition at line 760 of file mitkDicomSeriesReader.h.
|
protected |
for internal sorting.
Definition at line 755 of file mitkDicomSeriesReader.h.
typedef void(* mitk::DicomSeriesReader::UpdateCallBackMethod) (float) |
Interface for the progress callback.
Definition at line 357 of file mitkDicomSeriesReader.h.
How the mitk::Image spacing should be interpreted.
Compare DICOM PS 3.3 10.7 (Basic Pixel Spacing Calibration Macro).
Definition at line 382 of file mitkDicomSeriesReader.h.
Describes how well the reader is tested for a certain file type.
Applications should not rely on the outcome for images which are reported ReaderImplementationLevel_Implemented or ReaderImplementationLevel_Unsupported.
Errors to load images which are reported as ReaderImplementationLevel_Supported are considered bugs. For ReaderImplementationLevel_PartlySupported please check the appropriate paragraph in Limitations for specific modalities
Definition at line 369 of file mitkDicomSeriesReader.h.
|
staticprotected |
Ensure an 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 two lists: the first one contins slices of equal inter-slice spacing. The second list contains remaining files, which need to be run through AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
|
staticprotected |
Safely convert const char* to std::string.
|
staticprotected |
|
staticprotected |
Copy information about files and DICOM tags from ITK's MetaDataDictionary and from the list of input files to the PropertyList of mitk::Image.
|
staticprotected |
Construct a UID that takes into account sorting criteria from GetSeries().
|
staticprotected |
Helper for CreateMoreUniqueSeriesIdentifier.
|
staticprotected |
Convert DICOM string describing a point two Vector3D.
DICOM tags like ImageOrientationPatient contain two vectors as float numbers separated by backslashes:
42.7131\13.77\0.7\137.76\0.3
|
staticprotected |
Convert DICOM string describing a point to Point3D.
DICOM tags like ImagePositionPatient contain a position as float numbers separated by backslashes:
42.7131\13.77\0.7
|
staticprotected |
Safely convert a string into pixel spacing x and y.
|
staticprotected |
|
staticprotected |
Defines spatial sorting for sorting by GDCM 2.
Sorts by image position along image normal (distance from world origin). In cases of conflict, acquisition time is used as a secondary sort criterium.
|
static |
Provide combination of preprocessor defines that was active during compilation.
Since this class is a combination of several possible implementations, separated only by ifdef's, calling instances might want to know which flags were active at compile time.
|
staticprotected |
Map between DICOM tags and MITK properties.
Uses as 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 we want to sort as dicom.series.largest_pixel_in_series".
|
static |
see other GetSeries().
Find all series (and sub-series – see details) in a particular directory.
|
static |
see other GetSeries().
This differs only by having an additional restriction to a single known DICOM series. Internally, it uses the other GetSeries() method.
|
static |
|
static |
PREFERRED version of this method - scan and sort DICOM files.
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.
Optionally, more tags can be used to separate files into different logical series by setting the restrictions parameter.
|
staticprotected |
Helper for CreateMoreUniqueSeriesIdentifier.
|
staticprotected |
|
static |
Checks if a specific file contains DICOM data.
|
static |
Checks if a specific file is a Philips3D ultrasound DICOM file.
|
staticprotected |
Performs actual loading of a series and creates an image having the specified pixel type.
|
staticprotected |
Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image.
correctTilt | |
tiltInfo | |
io | |
command | can be used for progress reporting |
preLoadedImageBlock |
|
staticprotected |
|
static |
Loads a DICOM series composed by the file names enumerated in the file names container. If a callback method is supplied, it will be called after every progress update with a progress value in [0,1].
filenames | The filenames to load. |
sort | Whether files should be sorted spatially (true) or not (false - maybe useful if presorted) |
load4D | Whether to load the files as 3D+t (if possible) |
correctGantryTilt | |
callback | |
preLoadedImageBlock |
|
static |
See LoadDicomSeries! Just a slightly different interface.
If preLoadedImageBlock
is provided, the reader will only "fake" loading and create appropriate mitk::Properties.
filenames | |
node | |
sort | |
load4D | |
correctGantryTilt | |
callback | |
preLoadedImageBlock |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
static |
|
static |
|
staticprotected |
Read a Philips3D ultrasound DICOM file and put into an mitk::Image.
|
staticprotected |
Scan for slice image information.
|
staticprotected |
Sort files into time step blocks of a 3D+t image.
Called by LoadDicom. Expects to be fed a single list of filenames that have been sorted by GetSeries previously (one map entry). This method will check how many timestep can be filled with given files.
Assumption is that the number of time steps is determined by how often the first position in space repeats. I.e. if the first three files in the input parameter all describe the same location in space, we'll construct three lists of files. and sort the remaining files into them.
|
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