From: srit Date: Thu, 3 Mar 2011 13:26:49 +0000 (+0000) Subject: Account for ITK image direction X-Git-Tag: v1.2.0~207 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4e48b2bd88a018e6e9d383d07d9775f44b336e53;p=clitk.git Account for ITK image direction --- diff --git a/common/vvImage.txx b/common/vvImage.txx index c0eda20..06f44af 100755 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -4,6 +4,7 @@ template void vvImage::AddItkImage(TItkImageType *input) { + // Convert from ITK object to VTK object mImageDimension = TItkImageType::ImageDimension; typedef itk::ImageToVTKImageFilter ConverterType; typename ConverterType::Pointer converter = ConverterType::New(); @@ -11,7 +12,14 @@ void vvImage::AddItkImage(TItkImageType *input) converter->SetInput(input); converter->Update(); mVtkImages.push_back( converter->GetOutput() ); - + + // Account for direction in transform. The offset is already accounted for + // in the VTK image coordinates, no need to put it in the transform. + for(unsigned int j=0; jGetImageDimension(); j++) + for(unsigned int i=0; iGetImageDimension(); i++) + mTransform->GetMatrix()->SetElement(i,j, input->GetDirection()[i][j]); + + // Create the corresponding transformed image mVtkImageReslice.push_back(vtkSmartPointer::New()); mVtkImageReslice.back()->SetInterpolationModeToLinear(); mVtkImageReslice.back()->AutoCropOutputOn();