X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=common%2FvvImage.txx;h=06f44af400ef2d75dc0bb12936ed80289672d84f;hb=4cf66df882d7cd5cc0d9a240ffea8827e00c9969;hp=c0eda2082e75f756e44a7fa33caa828e8848e22b;hpb=c13d024475699d94ed1018a1e3be7cce91f1de97;p=clitk.git 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();