Fix slice orientation bug,with resort image file and negative thickness.
This commit is contained in:
@@ -302,7 +302,7 @@ void DICOMHeaderHelper::ArrangeSeriesProperty() {
|
||||
//sort every image set with world coordinate position
|
||||
std::sort(item.second.begin() + beginOffset, item.second.begin() + splitIndex[j],
|
||||
[](auto v1, auto v2) {
|
||||
return v1.image_position < v2.image_position;
|
||||
return v1.image_position > v2.image_position;
|
||||
});
|
||||
auto p = createProperty(item.second, splitIndex[j], beginOffset);
|
||||
p->SetImageSetNumber(imageSetNumber);
|
||||
@@ -314,7 +314,7 @@ void DICOMHeaderHelper::ArrangeSeriesProperty() {
|
||||
//sort the last image set
|
||||
std::sort(item.second.begin() + beginOffset, item.second.end(),
|
||||
[](auto v1, auto v2) {
|
||||
return v1.image_position < v2.image_position;
|
||||
return v1.image_position > v2.image_position;
|
||||
});
|
||||
auto p = createProperty(item.second, item.second.size(), beginOffset);
|
||||
p->SetImageSetNumber(imageSetNumber);
|
||||
@@ -429,7 +429,7 @@ ExtendMedicalImageProperties* DICOMHeaderHelper::createProperty(const std::vecto
|
||||
}
|
||||
}
|
||||
}
|
||||
property->SetSpacing(header.Spacing[0],header.Spacing[1],thickness);
|
||||
property->SetSpacing(header.Spacing[0],header.Spacing[1],-thickness);
|
||||
|
||||
// read data allocate reference param
|
||||
unsigned short bitsAllocated= 1;
|
||||
@@ -479,7 +479,7 @@ ExtendMedicalImageProperties* DICOMHeaderHelper::createProperty(const std::vecto
|
||||
const DICOMFileHeader& header2 = headerList[beginOffset+1];
|
||||
double spacing2 = sqrt(vtkMath::Distance2BetweenPoints(header.Position,header2.Position));
|
||||
if((int)spacing2 != 0){
|
||||
property->SetSpacing(property->GetSpacing()[0],property->GetSpacing()[1],spacing2);
|
||||
property->SetSpacing(property->GetSpacing()[0],property->GetSpacing()[1],-spacing2);
|
||||
}
|
||||
}
|
||||
return property;
|
||||
|
||||
Reference in New Issue
Block a user