#include #include #include namespace creaImageIO { //=================================================================== bool DicomNodeIntFieldComparator::compare(DicomNode* const & x, DicomNode* const & y) { int ix = atoi(x->GetFieldValue(mKey).c_str()); int iy = atoi(y->GetFieldValue(mKey).c_str()); // std::cout << ix << " < " << iy << " ? "<GetFieldValue(mKey) == y->GetFieldValue(mKey) ) return false; float ix = (float)atof(x->GetFieldValue(mKey).c_str()); float iy = (float)atof(y->GetFieldValue(mKey).c_str()); return (ix < iy); } //=================================================================== //=================================================================== bool DicomNodeStringFieldComparator::compare(DicomNode* const & x, DicomNode* const & y) { return ( x->GetFieldValue(mKey) < y->GetFieldValue(mKey) ); } //=================================================================== //=================================================================== bool LexicographicalDicomNodeComparator::operator() (DicomNode* const & x, DicomNode * const & y) { std::vector::iterator i; for (i =mDicomNodeComparator.begin(); i!=mDicomNodeComparator.end(); ++i) { if ( (*i)->operator()(x,y) ) { return true; } if ( (*i)->operator()(y,x) ) { return false; } } return false; } //=================================================================== }