X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FvvImageReader.txx;h=2eba11c81bc628f107d7f738c0a6d750fba7ef8f;hb=08f7de414957e92b25ca5b299007e941b610d3a8;hp=d1fddfb58639143a45b4b616be5d034880e93265;hpb=e8f25551d206fb09b49e479dbffd95df14bc88d7;p=clitk.git diff --git a/common/vvImageReader.txx b/common/vvImageReader.txx index d1fddfb..2eba11c 100644 --- a/common/vvImageReader.txx +++ b/common/vvImageReader.txx @@ -157,11 +157,17 @@ void vvImageReader::UpdateWithDimAndInputPixelType() spacing.Fill(1); typename OutputImageType::PointType origin; origin.Fill(0); + typename OutputImageType::DirectionType direction; + direction.SetIdentity(); for (unsigned int pixelDim=0; pixelDimGetLargestPossibleRegion().GetSize(pixelDim); spacing[pixelDim]=input->GetSpacing()[pixelDim]; origin[pixelDim]=input->GetOrigin()[pixelDim]; + for (unsigned int pixelDim2=0; pixelDim2GetDirection()[pixelDim][pixelDim2]; + } } typename OutputImageType::RegionType region; region.SetSize(size); @@ -169,6 +175,7 @@ void vvImageReader::UpdateWithDimAndInputPixelType() output->SetRegions(region); output->SetOrigin(origin); output->SetSpacing(spacing); + output->SetDirection(direction); output->Allocate(); //Copy each channel @@ -193,10 +200,10 @@ void vvImageReader::UpdateWithDimAndInputPixelType() } } - if (VImageDimension == 4) +/* if (VImageDimension == 4) mType == VECTORPIXELIMAGEWITHTIME; else - mType == VECTORPIXELIMAGE; + mType == VECTORPIXELIMAGE;*/ try { mImage = vvImageFromITK(output, mType == VECTORPIXELIMAGEWITHTIME); @@ -250,6 +257,9 @@ void vvImageReader::UpdateWithDimAndInputPixelType() } } } + + if (mType == DICOM && !mPatientCoordinateSystem) + mImage->InitializeTransform(); } //----------------------------------------------------------------------------