56 if (
const DICOMSortByTag* otherSelf = dynamic_cast<const DICOMSortByTag*>(&other))
58 if (!(this->m_Tag == otherSelf->m_Tag))
return false;
60 if (this->m_SecondaryCriterion.IsNull() && otherSelf->m_SecondaryCriterion.IsNull())
return true;
62 if (this->m_SecondaryCriterion.IsNull() || otherSelf->m_SecondaryCriterion.IsNull())
return false;
64 return *(this->m_SecondaryCriterion) == *(otherSelf->m_SecondaryCriterion);
85 list.push_back(m_Tag);
93 return this->NumericCompare(left, right, m_Tag);
109 return leftFinding.
value.compare(rightFinding.
value) < 0;
113 return this->NextLevelIsLeftBeforeRight(left, right);
129 double leftDouble( 0 );
130 double rightDouble( 0 );
134 leftDouble = OFStandard::atof( leftFinding.
value.c_str() );
135 rightDouble = OFStandard::atof(rightFinding.
value.c_str());
137 catch (
const std::exception& )
139 return this->StringCompare(left,right, tag);
143 if ( leftDouble != rightDouble )
145 return leftDouble < rightDouble;
149 return this->NextLevelIsLeftBeforeRight( left, right );
165 double fromDouble(0);
170 fromDouble = OFStandard::atof(fromFinding.
value.c_str());
171 toDouble = OFStandard::atof(toFinding.
value.c_str());
173 catch (
const std::exception& )
175 MITK_WARN <<
"NO NUMERIC DISTANCE between '" << fromFinding.
value <<
"' and '" << toFinding.
value <<
"'";
179 return toDouble - fromDouble;
virtual ~DICOMSortByTag()
itk::SmartPointer< Self > Pointer
std::vector< DICOMTag > DICOMTagList
bool NumericCompare(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right, const DICOMTag &tag) const
Representation of a DICOM tag.
virtual void Print(std::ostream &os) const override
brief describe this class in given stream.
DICOMSortCriterion & operator=(const DICOMSortCriterion &other)
Interface to datasets that is presented to sorting classes such as DICOMDatasetSorter.
virtual double NumericDistance(const mitk::DICOMDatasetAccess *from, const mitk::DICOMDatasetAccess *to) const override
Calculate a distance between two datasets. This ansers the question of consecutive datasets...
virtual DICOMDatasetFinding GetTagValueAsString(const DICOMTag &tag) const =0
Return a DICOMDatasetFinding instance of the tag. The return containes (if valid) the raw value of th...
DICOMSortByTag & operator=(const DICOMSortByTag &other)
virtual bool operator==(const DICOMSortCriterion &other) const override
Compare two datasets by the value of a single tag (for use in DICOMTagBasedSorter).
bool StringCompare(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right, const DICOMTag &tag) const
A tag based sorting criterion for use in DICOMTagBasedSorter.
DICOMSortByTag(const DICOMTag &tag, DICOMSortCriterion::Pointer secondaryCriterion=nullptr)
virtual bool IsLeftBeforeRight(const mitk::DICOMDatasetAccess *left, const mitk::DICOMDatasetAccess *right) const override
Answer the sorting question.
virtual DICOMTagList GetTagsOfInterest() const override
Tags used for comparison.