Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
|
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT, MR, PET, CR, etc. More...
#include <mitkDICOMITKSeriesGDCMReader.h>
Public Types | |
typedef const std::list< DICOMDatasetSorter::ConstPointer > | ConstSorterList |
Public Types inherited from mitk::DICOMFileReader | |
typedef DICOMImageBlockDescriptor::AdditionalTagsMapType | AdditionalTagsMapType |
Public Member Functions | |
mitkClassMacro (DICOMITKSeriesGDCMReader, DICOMFileReader) | |
mitkCloneMacro (DICOMITKSeriesGDCMReader) | |
mitkNewMacro1Param (DICOMITKSeriesGDCMReader, unsigned int) | |
virtual void | AnalyzeInputFiles () override |
Runs the sorting / splitting process described in Loading strategy. Method required by DICOMFileReader. More... | |
virtual bool | LoadImages () override |
Loads images using itk::ImageSeriesReader, potentially applies shearing to correct gantry tilt. More... | |
virtual bool | CanHandleFile (const std::string &filename) override |
Indicate whether this reader can handle given file. More... | |
virtual void | AddSortingElement (DICOMDatasetSorter *sorter, bool atFront=false) |
Add an element to the sorting procedure described in Loading strategy. More... | |
ConstSorterList | GetFreelyConfiguredSortingElements () const |
void | SetFixTiltByShearing (bool on) |
Controls whether to "fix" tilted acquisitions by shearing the output (see Gantry tilt handling). More... | |
bool | GetFixTiltByShearing () const |
void | SetAcceptTwoSlicesGroups (bool accept) const |
Controls whether groups of only two images are accepted when ensuring consecutive slices via EquiDistantBlocksSorter. More... | |
bool | GetAcceptTwoSlicesGroups () const |
void | SetToleratedOriginOffsetToAdaptive (double fractionOfInterSliceDistanct=0.3) const |
See Forced Configuration. More... | |
void | SetToleratedOriginOffset (double millimeters=0.005) const |
See Forced Configuration. More... | |
double | GetToleratedOriginError () const |
bool | IsToleratedOriginOffsetAbsolute () const |
double | GetDecimalPlacesForOrientation () const |
virtual bool | operator== (const DICOMFileReader &other) const override |
virtual DICOMTagPathList | GetTagsOfInterest () const override |
Public Member Functions inherited from mitk::DICOMFileReader | |
mitkClassMacroItkParent (DICOMFileReader, itk::Object) | |
void | SetInputFiles (const StringList &filenames) |
This input files. More... | |
const StringList & | GetInputFiles () const |
This input files. More... | |
unsigned int | GetNumberOfOutputs () const |
Number of outputs, only meaningful after calling AnalyzeInputFiles() More... | |
const DICOMImageBlockDescriptor & | GetOutput (unsigned int index) const |
Individual outputs, only meaningful after calling AnalyzeInputFiles(). More... | |
void | SetConfigurationLabel (const std::string &) |
Short label/name to describe this reader. More... | |
std::string | GetConfigurationLabel () const |
Short label/name to describe this reader. More... | |
void | SetConfigurationDescription (const std::string &) |
One-sentence description of the reader's loading "strategy". More... | |
std::string | GetConfigurationDescription () const |
One-sentence description of the reader's loading "strategy". More... | |
void | PrintConfiguration (std::ostream &os) const |
Print configuration description to given stream, for human reader. More... | |
void | PrintOutputs (std::ostream &os, bool filenameDetails=false) const |
Print output description to given stream, for human reader. More... | |
virtual void | SetAdditionalTagsOfInterest (const AdditionalTagsMapType &tagList) |
Set a list of DICOMTagPaths that specifiy all DICOM-Tags that will be copied into the property of the mitk::Image. More... | |
virtual void | SetTagLookupTableToPropertyFunctor (mitk::DICOMImageBlockDescriptor::TagLookupTableToPropertyFunctor functor) |
Set a functor that defines how the slice-specific tag-values are stored in a Property. More... | |
Static Public Member Functions | |
static Pointer | New () |
Static Public Member Functions inherited from mitk::DICOMFileReader | |
static bool | IsDICOM (const std::string &filename) |
Test whether a file is DICOM at all. More... | |
Protected Types | |
typedef std::vector< DICOMDatasetAccessingImageFrameList > | SortingBlockList |
Protected Member Functions | |
virtual void | InternalPrintConfiguration (std::ostream &os) const override |
Configuration description for human reader, to be implemented by sub-classes. More... | |
void | PushLocale () const |
Remember current locale on stack, activate "C" locale. "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader. More... | |
void | PopLocale () const |
Activate last remembered locale from locale stack "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader. More... | |
DICOMITKSeriesGDCMReader (unsigned int decimalPlacesForOrientation=5) | |
virtual | ~DICOMITKSeriesGDCMReader () |
DICOMITKSeriesGDCMReader (const DICOMITKSeriesGDCMReader &other) | |
DICOMITKSeriesGDCMReader & | operator= (const DICOMITKSeriesGDCMReader &other) |
virtual SortingBlockList | Condense3DBlocks (SortingBlockList &resultOf3DGrouping) |
"Hook" for sub-classes, see Sub-classes can condense multiple blocks into a single larger block More... | |
virtual DICOMTagCache::Pointer | GetTagCache () const |
void | SetTagCache (const DICOMTagCache::Pointer &) override |
A way to provide external knowledge about files and tag values is appreciated. More... | |
virtual bool | LoadMitkImageForOutput (unsigned int o) |
Loads the mitk::Image by means of an itk::ImageSeriesReader. More... | |
virtual bool | LoadMitkImageForImageBlockDescriptor (DICOMImageBlockDescriptor &block) const |
Protected Member Functions inherited from mitk::DICOMFileReader | |
DICOMFileReader () | |
virtual | ~DICOMFileReader () |
DICOMFileReader (const DICOMFileReader &other) | |
DICOMFileReader & | operator= (const DICOMFileReader &other) |
void | ClearOutputs () |
void | SetNumberOfOutputs (unsigned int numberOfOutputs) |
void | SetOutput (unsigned int index, const DICOMImageBlockDescriptor &output) |
DICOMImageBlockDescriptor & | InternalGetOutput (unsigned int index) |
non-const access to the DICOMImageBlockDescriptor More... | |
virtual AdditionalTagsMapType | GetAdditionalTagsOfInterest () const |
mitk::DICOMImageBlockDescriptor::TagLookupTableToPropertyFunctor | GetTagLookupTableToPropertyFunctor () const |
Static Protected Member Functions | |
static std::string | GetActiveLocale () |
Return active C locale. More... | |
static SortingBlockList | InternalExecuteSortingStep (unsigned int sortingStepIndex, const DICOMDatasetSorter::Pointer &sorter, const SortingBlockList &input) |
Sorting step as described in Loading strategy. More... | |
static ReaderImplementationLevel | GetReaderImplementationLevel (const std::string sopClassUID) |
Describe this reader's confidence for given SOP class UID. More... | |
Protected Attributes | |
bool | m_FixTiltByShearing |
mitk::EquiDistantBlocksSorter::Pointer | m_EquiDistantBlocksSorter |
mitk::NormalDirectionConsistencySorter::Pointer | m_NormalDirectionConsistencySorter |
Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT, MR, PET, CR, etc.
Implements the loading processed as structured by DICOMFileReader offers configuration of its loading strategy.
Documentation sections:
The set of input files is processed by a number of DICOMDatasetSorter objects which may do two sort of things:
When the DICOMITKSeriesGDCMReader is configured with DICOMDatasetSorters, the list of input files is processed as follows:
In all cases, the reader will add two DICOMDatasetSorter objects that are required to load mitk::Images properly via itk::ImageSeriesReader:
As are two forced last steps:
The user of this class can add more sorting steps (similar to the one described in above section) by calling AddSortingElement().
Usually, an application will add sorting by "Image Position Patient", by "Instance Number", and by other relevant tags here.
When CT gantry tilt is used, the gantry plane (= X-Ray source and detector ring) and the vertical plane do not align anymore. This scanner feature is used for example to reduce metal artifacs (e.g. Lee C , Evaluation of Using CT Gantry Tilt Scan on Head and Neck Cancer Patients with Dental Structure: Scans Show Less Metal Artifacts. Presented at: Radiological Society of North America 2011 Scientific Assembly and Annual Meeting; November 27- December 2, 2011 Chicago IL.).
The acquired planes of such CT series do not match the expectations of a orthogonal geometry in mitk::Image: if you stack the slices, they show a small shift along the Y axis:
without tilt with tilt |||||| ////// |||||| ////// -- |||||| --------- ////// -------- table orientation |||||| ////// |||||| ////// Stacked slices: without tilt with tilt -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- --------------
As such gemetries do not "work" in conjunction with mitk::Image, DICOMITKSeriesGDCMReader is able to perform a correction for such series. Whether or not such correction should be attempted is controlled by SetFixTiltByShearing(), the default being correction. For details, see "Internals" below.
A number of tests is implemented in module DICOMTesting, which is documented at MITK DICOM testing.
Internally, the class is based on GDCM and it depends heavily on the gdcm::Scanner class.
Since the sorting elements (see DICOMDatasetSorter and DICOMSortCriterion) can access tags only via the DICOMDatasetAccess interface, BUT DICOMITKSeriesGDCMReader holds a list of more specific classes DICOMGDCMImageFrameInfo, we must convert between the two types sometimes. This explains the methods ToDICOMDatasetList(), FromDICOMDatasetList().
The intermediate result of all the sorting efforts is held in m_SortingResultInProgress, which is modified through InternalExecuteSortingStep().
The following diagram gives an overview of the related classes:
The gantry tilt "correction" algorithm fixes two errors introduced by ITK's ImageSeriesReader:
Both errors are introduced in itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
For the correction, we examine two consecutive slices of a series, both described as a pair (origin/orientation):
The geometry of image stacks with tilted geometries is illustrated below:
The sorting/splitting process described above is helpful for at least two more DICOM readers, which either try to load 3D+t images or which load diffusion data.
In both cases, a single pixel of the mitk::Image is made up of multiple values, in one case values over time, in the other case multiple measurements of a single point.
The specialized readers for these cases (e.g. ThreeDnTDICOMSeriesReader) can reuse most of the methods in DICOMITKSeriesGDCMReader, except that they need an extra step after the usual sorting, in which they can merge already grouped 3D blocks. What blocks are merged depends on the specialized reader's understanding of these images. To allow for such merging, a method Condense3DBlocks() is called as an absolute last step of AnalyzeInputFiles(). Given this, a sub-class could implement only LoadImages() and Condense3DBlocks() instead repeating most of AnalyzeInputFiles().
Definition at line 194 of file mitkDICOMITKSeriesGDCMReader.h.
typedef const std::list<DICOMDatasetSorter::ConstPointer> mitk::DICOMITKSeriesGDCMReader::ConstSorterList |
Definition at line 223 of file mitkDICOMITKSeriesGDCMReader.h.
|
protected |
Definition at line 281 of file mitkDICOMITKSeriesGDCMReader.h.
|
protected |
Definition at line 31 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
protectedvirtual |
Definition at line 56 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
protected |
Definition at line 41 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
virtual |
Add an element to the sorting procedure described in Loading strategy.
Definition at line 480 of file mitkDICOMITKSeriesGDCMReader.cpp.
Referenced by mitk::ClassicDICOMSeriesReader::ClassicDICOMSeriesReader().
|
overridevirtual |
Runs the sorting / splitting process described in Loading strategy. Method required by DICOMFileReader.
Implements mitk::DICOMFileReader.
Reimplemented in mitk::DiffusionDICOMFileReader.
Definition at line 212 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::ConvertToDICOMDatasetAccessingImageFrameList(), mitk::ConvertToDICOMDatasetList(), mitk::ConvertToDICOMImageFrameList(), MITK_DEBUG, mitk::DICOMGDCMTagScanner::New(), mitk::DICOMImageBlockDescriptor::SetTagCache(), timeStart, and timeStop.
|
overridevirtual |
Indicate whether this reader can handle given file.
Implements mitk::DICOMFileReader.
Reimplemented in mitk::DiffusionDICOMFileReader.
Definition at line 475 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::ITKDICOMSeriesReaderHelper::CanHandleFile().
|
protectedvirtual |
"Hook" for sub-classes, see Sub-classes can condense multiple blocks into a single larger block
Reimplemented in mitk::ThreeDnTDICOMSeriesReader.
Definition at line 199 of file mitkDICOMITKSeriesGDCMReader.cpp.
bool mitk::DICOMITKSeriesGDCMReader::GetAcceptTwoSlicesGroups | ( | ) | const |
Definition at line 131 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
staticprotected |
Return active C locale.
Definition at line 150 of file mitkDICOMITKSeriesGDCMReader.cpp.
double mitk::DICOMITKSeriesGDCMReader::GetDecimalPlacesForOrientation | ( | ) | const |
Definition at line 563 of file mitkDICOMITKSeriesGDCMReader.cpp.
bool mitk::DICOMITKSeriesGDCMReader::GetFixTiltByShearing | ( | ) | const |
Definition at line 120 of file mitkDICOMITKSeriesGDCMReader.cpp.
mitk::DICOMITKSeriesGDCMReader::ConstSorterList mitk::DICOMITKSeriesGDCMReader::GetFreelyConfiguredSortingElements | ( | ) | const |
Definition at line 496 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
staticprotected |
Describe this reader's confidence for given SOP class UID.
Definition at line 386 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::SOPClassImplemented, mitk::SOPClassPartlySupported, mitk::SOPClassSupported, mitk::SOPClassUnknown, and mitk::SOPClassUnsupported.
|
protectedvirtual |
Definition at line 568 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
overridevirtual |
Implements mitk::DICOMFileReader.
Definition at line 579 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::DICOMImageBlockDescriptor::GetTagsOfInterest().
double mitk::DICOMITKSeriesGDCMReader::GetToleratedOriginError | ( | ) | const |
Definition at line 551 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
staticprotected |
Sorting step as described in Loading strategy.
Definition at line 333 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::ConvertToDICOMDatasetAccessingImageFrameList(), mitk::ConvertToDICOMDatasetList(), and MITK_DEBUG.
|
overrideprotectedvirtual |
Configuration description for human reader, to be implemented by sub-classes.
Implements mitk::DICOMFileReader.
Definition at line 136 of file mitkDICOMITKSeriesGDCMReader.cpp.
bool mitk::DICOMITKSeriesGDCMReader::IsToleratedOriginOffsetAbsolute | ( | ) | const |
Definition at line 557 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
overridevirtual |
Loads images using itk::ImageSeriesReader, potentially applies shearing to correct gantry tilt.
Implements mitk::DICOMFileReader.
Reimplemented in mitk::ThreeDnTDICOMSeriesReader, and mitk::DiffusionDICOMFileReader.
Definition at line 421 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
protectedvirtual |
Reimplemented in mitk::ThreeDnTDICOMSeriesReader.
Definition at line 434 of file mitkDICOMITKSeriesGDCMReader.cpp.
References frames, mitk::DICOMImageBlockDescriptor::GetImageFrameList(), mitk::DICOMImageBlockDescriptor::GetTiltInformation(), mitk::GantryTiltInformation::IsRegularGantryTilt(), mitk::ITKDICOMSeriesReaderHelper::Load(), MITK_ERROR, and mitk::DICOMImageBlockDescriptor::SetMitkImage().
Referenced by mitk::ThreeDnTDICOMSeriesReader::LoadMitkImageForImageBlockDescriptor().
|
protectedvirtual |
Loads the mitk::Image by means of an itk::ImageSeriesReader.
Definition at line 468 of file mitkDICOMITKSeriesGDCMReader.cpp.
Referenced by mitk::ThreeDnTDICOMSeriesReader::LoadImages().
mitk::DICOMITKSeriesGDCMReader::mitkClassMacro | ( | DICOMITKSeriesGDCMReader | , |
DICOMFileReader | |||
) |
mitk::DICOMITKSeriesGDCMReader::mitkCloneMacro | ( | DICOMITKSeriesGDCMReader | ) |
mitk::DICOMITKSeriesGDCMReader::mitkNewMacro1Param | ( | DICOMITKSeriesGDCMReader | , |
unsigned | int | ||
) |
|
static |
Referenced by mitkDICOMITKSeriesGDCMReaderBasicsTest().
|
protected |
Definition at line 61 of file mitkDICOMITKSeriesGDCMReader.cpp.
References m_EquiDistantBlocksSorter, m_FixTiltByShearing, m_NormalDirectionConsistencySorter, and mitk::DICOMFileReader::operator=().
Referenced by mitk::ThreeDnTDICOMSeriesReader::operator=().
|
overridevirtual |
Implements mitk::DICOMFileReader.
Reimplemented in mitk::ClassicDICOMSeriesReader, and mitk::ThreeDnTDICOMSeriesReader.
Definition at line 79 of file mitkDICOMITKSeriesGDCMReader.cpp.
References mitk::eps.
Referenced by mitk::ThreeDnTDICOMSeriesReader::operator==().
|
protected |
Activate last remembered locale from locale stack "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader.
Definition at line 171 of file mitkDICOMITKSeriesGDCMReader.cpp.
References MITK_WARN.
|
protected |
Remember current locale on stack, activate "C" locale. "C" locale is required for correct parsing of numbers by itk::ImageSeriesReader.
Definition at line 155 of file mitkDICOMITKSeriesGDCMReader.cpp.
void mitk::DICOMITKSeriesGDCMReader::SetAcceptTwoSlicesGroups | ( | bool | accept | ) | const |
Controls whether groups of only two images are accepted when ensuring consecutive slices via EquiDistantBlocksSorter.
Definition at line 125 of file mitkDICOMITKSeriesGDCMReader.cpp.
void mitk::DICOMITKSeriesGDCMReader::SetFixTiltByShearing | ( | bool | on | ) |
Controls whether to "fix" tilted acquisitions by shearing the output (see Gantry tilt handling).
Definition at line 114 of file mitkDICOMITKSeriesGDCMReader.cpp.
Referenced by mitk::ClassicDICOMSeriesReader::ClassicDICOMSeriesReader().
|
overrideprotectedvirtual |
A way to provide external knowledge about files and tag values is appreciated.
Implements mitk::DICOMFileReader.
Definition at line 573 of file mitkDICOMITKSeriesGDCMReader.cpp.
void mitk::DICOMITKSeriesGDCMReader::SetToleratedOriginOffset | ( | double | millimeters = 0.005 | ) | const |
See Forced Configuration.
Definition at line 544 of file mitkDICOMITKSeriesGDCMReader.cpp.
Referenced by mitk::ClassicDICOMSeriesReader::ClassicDICOMSeriesReader().
void mitk::DICOMITKSeriesGDCMReader::SetToleratedOriginOffsetToAdaptive | ( | double | fractionOfInterSliceDistanct = 0.3 | ) | const |
See Forced Configuration.
Definition at line 537 of file mitkDICOMITKSeriesGDCMReader.cpp.
|
protected |
Definition at line 324 of file mitkDICOMITKSeriesGDCMReader.h.
Referenced by mitk::ClassicDICOMSeriesReader::ClassicDICOMSeriesReader(), and operator=().
|
protected |
Definition at line 312 of file mitkDICOMITKSeriesGDCMReader.h.
Referenced by operator=().
|
protected |
Definition at line 326 of file mitkDICOMITKSeriesGDCMReader.h.
Referenced by operator=().