Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Sort DICOM datasets based on configurable tags. More...
#include <mitkDICOMTagBasedSorter.h>
Classes | |
class | CutDecimalPlaces |
Cuts a number after configured number of decimal places. An instance of this class can be used to avoid errors when comparing minimally different image orientations. More... | |
struct | ParameterizedDatasetSort |
Helper struct to feed into std::sort, configured via DICOMSortCriterion. More... | |
class | TagValueProcessor |
Processes tag values before they are compared. These classes could do some kind of normalization such as rounding, lower case formatting, etc. More... | |
Public Member Functions | |
mitkClassMacro (DICOMTagBasedSorter, DICOMDatasetSorter) | |
void | AddDistinguishingTag (const DICOMTag &, TagValueProcessor *tagValueProcessor=nullptr) |
Datasets that differ in given tag's value will be sorted into separate outputs. More... | |
DICOMTagList | GetDistinguishingTags () const |
const TagValueProcessor * | GetTagValueProcessorForDistinguishingTag (const DICOMTag &) const |
void | SetSortCriterion (DICOMSortCriterion::ConstPointer criterion) |
Define the sorting criterion (which holds seconardy criteria) More... | |
DICOMSortCriterion::ConstPointer | GetSortCriterion () const |
DICOMTagList | GetTagsOfInterest () override |
A list of all the tags needed for processing (facilitates scanning). More... | |
void | SetStrictSorting (bool strict) |
Whether or not groups should be checked for consecutive tag values. More... | |
bool | GetStrictSorting () const |
void | SetExpectDistanceOne (bool strict) |
Flag for a special case in "strict sorting". Please see documentation of SetStrictSorting(). More... | |
bool | GetExpectDistanceOne () const |
void | Sort () override |
Actually sort as described in the Detailed Description. More... | |
void | PrintConfiguration (std::ostream &os, const std::string &indent="") const override |
Print configuration details into given stream. More... | |
bool | operator== (const DICOMDatasetSorter &other) const override |
![]() | |
mitkClassMacroItkParent (DICOMDatasetSorter, itk::LightObject) | |
void | SetInput (DICOMDatasetList filenames) |
Input for sorting. More... | |
const DICOMDatasetList & | GetInput () const |
Input for sorting. More... | |
unsigned int | GetNumberOfOutputs () const |
Output of the sorting process. More... | |
const DICOMDatasetList & | GetOutput (unsigned int index) const |
Output of the sorting process. More... | |
DICOMDatasetList & | GetOutput (unsigned int index) |
Output of the sorting process. More... | |
Static Public Member Functions | |
static Pointer | New () |
static bool | GetDefaultStrictSorting () |
static bool | GetDefaultExpectDistanceOne () |
Protected Types | |
typedef std::map< std::string, DICOMDatasetList > | GroupIDToListType |
typedef std::map< const DICOMTag, TagValueProcessor * > | TagValueProcessorMap |
Protected Member Functions | |
DICOMTagBasedSorter () | |
~DICOMTagBasedSorter () override | |
DICOMTagBasedSorter (const DICOMTagBasedSorter &other) | |
DICOMTagBasedSorter & | operator= (const DICOMTagBasedSorter &other) |
std::string | BuildGroupID (DICOMDatasetAccess *dataset) |
Helper for SplitInputGroups(). More... | |
GroupIDToListType | SplitInputGroups () |
Implements the "distiguishing tags". To sort datasets into different groups, a long string will be built for each dataset. The string concatenates all tags and their respective values. Datasets that match in all values will end up with the same string. More... | |
GroupIDToListType & | SortGroups (GroupIDToListType &groups) |
Implements the sorting step. Relatively simple implementation thanks to std::sort and a parameterization via DICOMSortCriterion. More... | |
![]() | |
DICOMDatasetSorter () | |
~DICOMDatasetSorter () override | |
DICOMDatasetSorter (const DICOMDatasetSorter &other) | |
DICOMDatasetSorter & | operator= (const DICOMDatasetSorter &other) |
void | ClearOutputs () |
void | SetNumberOfOutputs (unsigned int numberOfOutputs) |
void | SetOutput (unsigned int index, const DICOMDatasetList &output) |
Protected Attributes | |
DICOMTagList | m_DistinguishingTags |
TagValueProcessorMap | m_TagValueProcessor |
DICOMSortCriterion::ConstPointer | m_SortCriterion |
bool | m_StrictSorting |
bool | m_ExpectDistanceOne |
Static Protected Attributes | |
static const bool | m_DefaultStrictSorting |
static const bool | m_DefaultExpectDistanceOne |
Sort DICOM datasets based on configurable tags.
This class implements sorting of input DICOM datasets into multiple outputs as described in Loading strategy.
The logic of sorting and splitting is most simple and most generic:
Definition at line 40 of file mitkDICOMTagBasedSorter.h.
|
protected |
Definition at line 172 of file mitkDICOMTagBasedSorter.h.
|
protected |
Definition at line 188 of file mitkDICOMTagBasedSorter.h.
|
protected |
Definition at line 88 of file mitkDICOMTagBasedSorter.cpp.
References ~DICOMTagBasedSorter().
Referenced by mitk::DICOMTagBasedSorter::CutDecimalPlaces::GetPrecision(), and ~DICOMTagBasedSorter().
|
overrideprotected |
Definition at line 96 of file mitkDICOMTagBasedSorter.cpp.
References DICOMTagBasedSorter(), and m_TagValueProcessor.
Referenced by DICOMTagBasedSorter().
|
protected |
Definition at line 107 of file mitkDICOMTagBasedSorter.cpp.
References m_TagValueProcessor, and operator=().
void mitk::DICOMTagBasedSorter::AddDistinguishingTag | ( | const DICOMTag & | tag, |
TagValueProcessor * | tagValueProcessor = nullptr |
||
) |
Datasets that differ in given tag's value will be sorted into separate outputs.
Definition at line 279 of file mitkDICOMTagBasedSorter.cpp.
References m_DistinguishingTags, m_TagValueProcessor, and SetSortCriterion().
Referenced by GetTagValueProcessorForDistinguishingTag().
|
protected |
Helper for SplitInputGroups().
Definition at line 321 of file mitkDICOMTagBasedSorter.cpp.
References mitk::DICOMDatasetAccess::GetTagValueAsString(), mitk::DICOMDatasetFinding::isValid, m_DistinguishingTags, m_TagValueProcessor, SplitInputGroups(), and mitk::DICOMDatasetFinding::value.
Referenced by Sort(), and SplitInputGroups().
|
inlinestatic |
Definition at line 143 of file mitkDICOMTagBasedSorter.h.
|
inlinestatic |
Definition at line 138 of file mitkDICOMTagBasedSorter.h.
mitk::DICOMTagList mitk::DICOMTagBasedSorter::GetDistinguishingTags | ( | ) | const |
Definition at line 257 of file mitkDICOMTagBasedSorter.cpp.
References GetTagValueProcessorForDistinguishingTag(), and m_DistinguishingTags.
Referenced by mitk::DICOMReaderConfigurator::CreateConfigStringFromReader(), and GetTagsOfInterest().
bool mitk::DICOMTagBasedSorter::GetExpectDistanceOne | ( | ) | const |
Definition at line 234 of file mitkDICOMTagBasedSorter.cpp.
References GetTagsOfInterest(), and m_ExpectDistanceOne.
Referenced by mitk::DICOMReaderConfigurator::CreateConfigStringFromReader(), and SetExpectDistanceOne().
mitk::DICOMSortCriterion::ConstPointer mitk::DICOMTagBasedSorter::GetSortCriterion | ( | ) | const |
Definition at line 294 of file mitkDICOMTagBasedSorter.cpp.
References m_SortCriterion, and Sort().
Referenced by mitk::DICOMReaderConfigurator::CreateConfigStringFromReader(), and SetSortCriterion().
bool mitk::DICOMTagBasedSorter::GetStrictSorting | ( | ) | const |
Definition at line 220 of file mitkDICOMTagBasedSorter.cpp.
References m_StrictSorting, and SetExpectDistanceOne().
Referenced by mitk::DICOMReaderConfigurator::CreateConfigStringFromReader(), and SetStrictSorting().
|
overridevirtual |
A list of all the tags needed for processing (facilitates scanning).
Implements mitk::DICOMDatasetSorter.
Definition at line 242 of file mitkDICOMTagBasedSorter.cpp.
References GetDistinguishingTags(), m_DistinguishingTags, and m_SortCriterion.
Referenced by GetExpectDistanceOne().
const mitk::DICOMTagBasedSorter::TagValueProcessor * mitk::DICOMTagBasedSorter::GetTagValueProcessorForDistinguishingTag | ( | const DICOMTag & | tag | ) | const |
Definition at line 264 of file mitkDICOMTagBasedSorter.cpp.
References AddDistinguishingTag(), and m_TagValueProcessor.
Referenced by mitk::DICOMReaderConfigurator::CreateConfigStringFromReader(), and GetDistinguishingTags().
mitk::DICOMTagBasedSorter::mitkClassMacro | ( | DICOMTagBasedSorter | , |
DICOMDatasetSorter | |||
) |
|
static |
|
protected |
Definition at line 124 of file mitkDICOMTagBasedSorter.cpp.
References m_DistinguishingTags, m_ExpectDistanceOne, m_SortCriterion, m_StrictSorting, m_TagValueProcessor, mitk::DICOMDatasetSorter::operator=(), and operator==().
Referenced by DICOMTagBasedSorter().
|
overridevirtual |
Implements mitk::DICOMDatasetSorter.
Definition at line 146 of file mitkDICOMTagBasedSorter.cpp.
References m_DistinguishingTags, m_ExpectDistanceOne, m_SortCriterion, m_StrictSorting, and PrintConfiguration().
Referenced by operator=().
|
overridevirtual |
Print configuration details into given stream.
Implements mitk::DICOMDatasetSorter.
Definition at line 185 of file mitkDICOMTagBasedSorter.cpp.
References m_DistinguishingTags, m_ExpectDistanceOne, m_SortCriterion, m_StrictSorting, and SetStrictSorting().
Referenced by operator==().
void mitk::DICOMTagBasedSorter::SetExpectDistanceOne | ( | bool | strict | ) |
Flag for a special case in "strict sorting". Please see documentation of SetStrictSorting().
Definition at line 227 of file mitkDICOMTagBasedSorter.cpp.
References GetExpectDistanceOne(), and m_ExpectDistanceOne.
Referenced by GetStrictSorting().
void mitk::DICOMTagBasedSorter::SetSortCriterion | ( | DICOMSortCriterion::ConstPointer | criterion | ) |
Define the sorting criterion (which holds seconardy criteria)
Definition at line 287 of file mitkDICOMTagBasedSorter.cpp.
References GetSortCriterion(), and m_SortCriterion.
Referenced by AddDistinguishingTag().
void mitk::DICOMTagBasedSorter::SetStrictSorting | ( | bool | strict | ) |
Whether or not groups should be checked for consecutive tag values.
When this flag is set (default in constructor=off), the sorter will not only sort in a way that the values of a configured tag are ascending BUT in addition the sorter will enforce a constant numerical distance between values.
Having this flag is useful for handling of series with missing slices, e.g. Instance Numbers 1 2 3 5 6 7 8. With the flag set to true, the sorter would split this group into two, because the initial distance of 1 is not kept between Instance Numbers 3 and 5.
A special case of this behavior can be configured by SetExpectDistanceOne(). When this additional flag is set to true, the sorter will expect distance 1 exactly. This can help if the second slice is missing already. Without this additional flag, we would "learn" about a wrong distance of 2 (or similar) and then sort completely wrong.
Definition at line 213 of file mitkDICOMTagBasedSorter.cpp.
References GetStrictSorting(), and m_StrictSorting.
Referenced by PrintConfiguration().
|
overridevirtual |
Actually sort as described in the Detailed Description.
Implements mitk::DICOMDatasetSorter.
Definition at line 301 of file mitkDICOMTagBasedSorter.cpp.
References BuildGroupID(), mitk::DICOMDatasetSorter::SetNumberOfOutputs(), mitk::DICOMDatasetSorter::SetOutput(), SortGroups(), and SplitInputGroups().
Referenced by GetSortCriterion().
|
protected |
Implements the sorting step. Relatively simple implementation thanks to std::sort and a parameterization via DICOMSortCriterion.
Definition at line 375 of file mitkDICOMTagBasedSorter.cpp.
References m_ExpectDistanceOne, m_SortCriterion, m_StrictSorting, MITK_DEBUG, and mitk::DICOMTagBasedSorter::ParameterizedDatasetSort::ParameterizedDatasetSort().
Referenced by Sort(), and SplitInputGroups().
|
protected |
Implements the "distiguishing tags". To sort datasets into different groups, a long string will be built for each dataset. The string concatenates all tags and their respective values. Datasets that match in all values will end up with the same string.
Definition at line 350 of file mitkDICOMTagBasedSorter.cpp.
References BuildGroupID(), mitk::DICOMDatasetAccess::GetFilenameIfAvailable(), mitk::DICOMDatasetSorter::GetInput(), MITK_DEBUG, and SortGroups().
Referenced by BuildGroupID(), and Sort().
|
staticprotected |
Definition at line 197 of file mitkDICOMTagBasedSorter.h.
|
staticprotected |
Definition at line 196 of file mitkDICOMTagBasedSorter.h.
|
protected |
Definition at line 187 of file mitkDICOMTagBasedSorter.h.
Referenced by AddDistinguishingTag(), BuildGroupID(), GetDistinguishingTags(), GetTagsOfInterest(), operator=(), operator==(), and PrintConfiguration().
|
protected |
Definition at line 194 of file mitkDICOMTagBasedSorter.h.
Referenced by GetExpectDistanceOne(), operator=(), operator==(), PrintConfiguration(), SetExpectDistanceOne(), and SortGroups().
|
protected |
Definition at line 191 of file mitkDICOMTagBasedSorter.h.
Referenced by GetSortCriterion(), GetTagsOfInterest(), operator=(), operator==(), PrintConfiguration(), SetSortCriterion(), and SortGroups().
|
protected |
Definition at line 193 of file mitkDICOMTagBasedSorter.h.
Referenced by GetStrictSorting(), operator=(), operator==(), PrintConfiguration(), SetStrictSorting(), and SortGroups().
|
protected |
Definition at line 189 of file mitkDICOMTagBasedSorter.h.
Referenced by AddDistinguishingTag(), BuildGroupID(), DICOMTagBasedSorter(), GetTagValueProcessorForDistinguishingTag(), operator=(), and ~DICOMTagBasedSorter().