Skip to content

Commit 3fff8bb

Browse files
committed
Sort by SliceLocation if IPPSorter fails
1 parent fd10cef commit 3fff8bb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

Common/MultiFrameDicomSeriesSorter.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ ::Apply(DicomFilesList &dflist)
149149
return EXIT_SUCCESS;
150150
}
151151
else
152-
return EXIT_FAILURE;
152+
{
153+
// Fallback to sorting by SliceLocation
154+
std::sort(dflist.begin(), dflist.end(), DicomFile::CompareBySliceLocation);
155+
return EXIT_SUCCESS;
156+
}
153157
}
154158

155159
//===================================================

Common/MultiFrameDicomSeriesSorter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ struct DicomFile
2424
// sorting functions
2525
static bool CompareByInstanceNumber(const DicomFile &left, const DicomFile &right)
2626
{ return left.m_InstanceNumber < right.m_InstanceNumber; }
27+
static bool CompareBySliceLocation(const DicomFile &left, const DicomFile &right)
28+
{ return left.m_SliceLocation > right.m_SliceLocation; }
2729

2830
// members
2931
std::string m_Filename;

0 commit comments

Comments
 (0)