Fix single file load bug.
This commit is contained in:
@@ -223,7 +223,6 @@ void DICOMDirectoryHelper::readImageProperty(ExtendMedicalImageProperties* prope
|
|||||||
const std::vector<std::string>& files = property->GetFileNames();
|
const std::vector<std::string>& files = property->GetFileNames();
|
||||||
DcmFileFormat file1;
|
DcmFileFormat file1;
|
||||||
// read success!
|
// read success!
|
||||||
std::cout<<files.at(0)<<std::endl;
|
|
||||||
if (file1.loadFile(files.at(0)).good()) {
|
if (file1.loadFile(files.at(0)).good()) {
|
||||||
DcmDataset *dataset = file1.getDataset();
|
DcmDataset *dataset = file1.getDataset();
|
||||||
|
|
||||||
@@ -276,9 +275,9 @@ void DICOMDirectoryHelper::readImageProperty(ExtendMedicalImageProperties* prope
|
|||||||
|
|
||||||
vtkMatrix4x4::Invert(matrix, property->GetWorldToModelMatrix() );
|
vtkMatrix4x4::Invert(matrix, property->GetWorldToModelMatrix() );
|
||||||
matrix = property->GetWorldToModelMatrix();
|
matrix = property->GetWorldToModelMatrix();
|
||||||
DcmFileFormat file2;
|
|
||||||
std::cout<<files.at(1)<<std::endl;
|
|
||||||
|
|
||||||
|
if (files.size()>1){
|
||||||
|
DcmFileFormat file2;
|
||||||
// read success!
|
// read success!
|
||||||
if (file2.loadFile(files.at(1)).good()) {
|
if (file2.loadFile(files.at(1)).good()) {
|
||||||
DcmDataset *dataset = file2.getDataset();
|
DcmDataset *dataset = file2.getDataset();
|
||||||
@@ -309,6 +308,15 @@ void DICOMDirectoryHelper::readImageProperty(ExtendMedicalImageProperties* prope
|
|||||||
Spacing[2] = zNormal2[2]<0?(-1.0*space2):space2;
|
Spacing[2] = zNormal2[2]<0?(-1.0*space2):space2;
|
||||||
property->SetSpacing(Spacing);
|
property->SetSpacing(Spacing);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
double Spacing[3] = {.0, .0, .0};
|
||||||
|
property->GetSpacing(Spacing);
|
||||||
|
Spacing[2] = 1.0;
|
||||||
|
property->SetSpacing(Spacing);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user