Fix DICOM Spacing 2 sign bug.
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,12 +314,14 @@ 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);
|
||||
if (p){
|
||||
p->SetImageSetNumber(imageSetNumber);
|
||||
p->GenerateUniqueID();
|
||||
if (p)seriesProperties.push_back(p);
|
||||
seriesProperties.push_back(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +431,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;
|
||||
@@ -470,7 +472,6 @@ ExtendMedicalImageProperties* DICOMHeaderHelper::createProperty(const std::vecto
|
||||
property->SetRescaleOffset(RescaleOffset);
|
||||
}
|
||||
else{
|
||||
printf( " file:%s load error!\r\b", header.FilePath.c_str() );
|
||||
property->Delete();
|
||||
return nullptr;
|
||||
}
|
||||
@@ -478,8 +479,8 @@ ExtendMedicalImageProperties* DICOMHeaderHelper::createProperty(const std::vecto
|
||||
// try to use real world slice origin point distance to instead thickness
|
||||
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);
|
||||
if(spacing2 > .0){
|
||||
property->SetSpacing(property->GetSpacing()[0],property->GetSpacing()[1],spacing2);
|
||||
}
|
||||
}
|
||||
return property;
|
||||
|
||||
@@ -235,8 +235,6 @@ void DICOMImageViewer::SetInputData(vtkImageData *in) {
|
||||
this->RemoveFusionData();
|
||||
this->ActiveRuler();
|
||||
this-> ActiveReferenceLine();
|
||||
double zVec = in->GetSpacing()[2];
|
||||
defaultProjection[2][2] = zVec>0.0?1.0:-1.0;
|
||||
}
|
||||
|
||||
void DICOMImageViewer::SetInputConnection(vtkAlgorithmOutput *input) {
|
||||
|
||||
@@ -297,14 +297,6 @@ void ResliceImageViewer::SetCoordsTransformMatrix(vtkMatrix4x4 *matrix4X4) {
|
||||
OrientationMatrix->DeepCopy(matrix4X4);
|
||||
|
||||
OrientationMatrix->Invert();
|
||||
|
||||
//TODO:暂时使用特殊处理解决负向堆叠问题,考虑如何去除特殊处理
|
||||
//默认的横断面Slice 需要考虑奇葩的负向堆叠
|
||||
if (OrientationMatrix->IsIdentity()){
|
||||
double zVec = Mapper->GetInput()->GetSpacing()[2];
|
||||
OrientationMatrix->SetElement(2,2, zVec>0.0?1.0:-1.0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ResliceImageViewer::updateHandle(vtkObject* sender, unsigned long eventID, void* callData) {
|
||||
|
||||
Reference in New Issue
Block a user