X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=common%2FvvImage.txx;h=6e8907633987e48e4fc17c0f7b97cd3eecc57eae;hb=5d07c6f09eee2f55347c6722c16c1f81de28e747;hp=a84fa76669d7a317655d725e9e2e8371fd8f133c;hpb=647a6322e7d8f4c456bfe56414d8d9a879fb7f3a;p=clitk.git diff --git a/common/vvImage.txx b/common/vvImage.txx old mode 100755 new mode 100644 index a84fa76..6e89076 --- a/common/vvImage.txx +++ b/common/vvImage.txx @@ -1,9 +1,30 @@ +/*========================================================================= + Program: vv http://www.creatis.insa-lyon.fr/rio/vv + + Authors belong to: + - University of LYON http://www.universite-lyon.fr/ + - Léon Bérard cancer center http://www.centreleonberard.fr + - CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the copyright notices for more information. + + It is distributed under dual licence + + - BSD See included LICENSE.txt file + - CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html +===========================================================================*/ #include //-------------------------------------------------------------------- template void vvImage::AddItkImage(TItkImageType *input) { + // Update input before conversion to enable exceptions thrown by the ITK pipeline. + // Otherwise, vtkImageImport catches the exception for us. + input->Update(); + // Convert from ITK object to VTK object mImageDimension = TItkImageType::ImageDimension; typedef itk::ImageToVTKImageFilter ConverterType; @@ -13,7 +34,7 @@ void vvImage::AddItkImage(TItkImageType *input) converter->Update(); mVtkImages.push_back( converter->GetOutput() ); - // Account for direction in transform. The offset is already accounted for + // Account for direction in transform. The offset is already accounted for // in the VTK image coordinates, no need to put it in the transform. vtkSmartPointer matrix = vtkSmartPointer::New(); matrix->Identity(); @@ -21,16 +42,6 @@ void vvImage::AddItkImage(TItkImageType *input) for(unsigned int i=0; iGetImageDimension(); i++) (*matrix)[i][j] = input->GetDirection()[i][j]; mTransform->SetMatrix(matrix); - - // Create the corresponding transformed image - mVtkImageReslice.push_back(vtkSmartPointer::New()); - mVtkImageReslice.back()->SetInterpolationModeToLinear(); - mVtkImageReslice.back()->AutoCropOutputOn(); - mVtkImageReslice.back()->SetBackgroundColor(-1000,-1000,-1000,1); - mVtkImageReslice.back()->SetResliceTransform(mTransform); - mVtkImageReslice.back()->SetInput(0, converter->GetOutput()); - mVtkImageReslice.back()->UpdateInformation(); - mTransformedVtkImages.push_back( mVtkImageReslice.back()->GetOutput(0) ); } //--------------------------------------------------------------------