]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkImagePlanes.cxx
#3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7
[bbtk.git] / packages / vtk / src / bbvtkImagePlanes.cxx
index 426189b031cf5d428edce3cc1b4cb5235d4d22d3..6f2808219c3faf75f60d7a828e03adbe58aedaca 100644 (file)
@@ -1,33 +1,38 @@
-/*=========================================================================                                                                               
+/*
+ # ---------------------------------------------------------------------
+ #
+ # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+ #                        pour la SantÈ)
+ # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+ # Previous Authors : Laurent Guigues, Jean-Pierre Roux
+ # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+ #
+ #  This software is governed by the CeCILL-B license under French law and
+ #  abiding by the rules of distribution of free software. You can  use,
+ #  modify and/ or redistribute the software under the terms of the CeCILL-B
+ #  license as circulated by CEA, CNRS and INRIA at the following URL
+ #  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+ #  or in the file LICENSE.txt.
+ #
+ #  As a counterpart to the access to the source code and  rights to copy,
+ #  modify and redistribute granted by the license, users are provided only
+ #  with a limited warranty  and the software's author,  the holder of the
+ #  economic rights,  and the successive licensors  have only  limited
+ #  liability.
+ #
+ #  The fact that you are presently reading this means that you have had
+ #  knowledge of the CeCILL-B license and that you accept its terms.
+ # ------------------------------------------------------------------------ */
+
+
+/*=========================================================================
   Program:   bbtk
   Module:    $RCSfile: bbvtkImagePlanes.cxx,v $
   Language:  C++
-  Date:      $Date: 2012/07/09 13:02:42 $
-  Version:   $Revision: 1.37 $
+  Date:      $Date: 2012/11/16 08:51:58 $
+  Version:   $Revision: 1.38 $
 =========================================================================*/
 
-/* ---------------------------------------------------------------------
-
-* Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
-* Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
-*
-*  This software is governed by the CeCILL-B license under French law and 
-*  abiding by the rules of distribution of free software. You can  use, 
-*  modify and/ or redistribute the software under the terms of the CeCILL-B 
-*  license as circulated by CEA, CNRS and INRIA at the following URL 
-*  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
-*  or in the file LICENSE.txt.
-*
-*  As a counterpart to the access to the source code and  rights to copy,
-*  modify and redistribute granted by the license, users are provided only
-*  with a limited warranty  and the software's author,  the holder of the
-*  economic rights,  and the successive licensors  have only  limited
-*  liability. 
-*
-*  The fact that you are presently reading this means that you have had
-*  knowledge of the CeCILL-B license and that you accept its terms.
-* ------------------------------------------------------------------------ */                                                                         
-
 /**
  *  \file 
  *  \brief 
@@ -139,7 +144,7 @@ namespace bbvtk
  };
   //================================================================
 
-  //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.37 $");
+  //vtkCxxRevisionMacro(ImagePlanes::VtkCallbackType, "$Revision: 1.38 $");
 
   //================================================================
 
@@ -202,24 +207,56 @@ namespace bbvtk
           // EED MPR view orientation correction..
      vtkImageFlip  *flipYFilter = vtkImageFlip::New();
      flipYFilter->SetFilteredAxis(1); // flip y axis
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
      flipYFilter->SetInput( planeWidgetX->GetResliceOutput() );
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+     flipYFilter->SetInputData( planeWidgetX->GetResliceOutput() );
+#endif
+
      flipYFilter->Update();
 
           vtkImageChangeInformation *image = vtkImageChangeInformation::New();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
           image->SetInput(  planeWidgetY->GetResliceOutput()  );
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+          image->SetInputData(  planeWidgetY->GetResliceOutput()  );
+#endif
+
           image->SetOutputSpacing( 1,1,1 );       
           image->CenterImageOn();
           image->Update();
           _imageTransform = vtkTransform::New();
           vtkImageReslice *slicer =vtkImageReslice::New();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
           slicer->SetInput( image->GetOutput() );
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+          slicer->SetInputData( image->GetOutput() );
+#endif
+
           slicer->SetInformationInput( image->GetOutput() );
           slicer->SetResliceTransform( _imageTransform );
           slicer->SetOutputOrigin(0 , 0 , 0 );
           slicer->SetInterpolationModeToNearestNeighbor();
           slicer->Update();       
           vtkImageChangeInformation *imageResult = vtkImageChangeInformation::New();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
           imageResult->SetInput( slicer->GetOutput() );
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+          imageResult->SetInputData( slicer->GetOutput() );
+#endif
+
           double spc[3];
            planeWidgetY->GetResliceOutput()->GetSpacing(spc);
           imageResult->SetOutputSpacing( spc[1], spc[0], spc[2] ); 
@@ -279,7 +316,14 @@ namespace bbvtk
        {
                int dim[3];
                int ext[6];
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                bbGetOutputPlaneX()->GetResliceOutput()->GetWholeExtent(ext);
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+               bbGetOutputPlaneX()->GetResliceOutput()->GetExtent(ext);
+#endif
+
                dim[0] = ext[1]-ext[0]+1;
                dim[1] = ext[3]-ext[2]+1;
                dim[2] = ext[5]-ext[4]+1;
@@ -299,7 +343,14 @@ namespace bbvtk
                        double xSpacing, ySpacing, zSpacing;
                        bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
 
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        bbGetOutputPlaneX()->SetInput(bbGetInputIn());
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       bbGetOutputPlaneX()->SetInputData(bbGetInputIn());
+#endif
+
                        bbGetOutputPlaneX()->SetPlaneOrientationToXAxes();       
                        bbGetOutputPlaneX()->SetSlicePosition((xMax+xMin)/2.*xSpacing);
 
@@ -307,11 +358,25 @@ namespace bbvtk
                        //                 bbGetOutputPlaneX()->SetPoint1( 0*xSpacing, 146*ySpacing, 186*zSpacing);
                        //                 bbGetOutputPlaneX()->SetPoint2( 126*xSpacing, 146*ySpacing, 0*zSpacing);
 
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        bbGetOutputPlaneY()->SetInput(bbGetInputIn());
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       bbGetOutputPlaneY()->SetInputData(bbGetInputIn());
+#endif
+
                        bbGetOutputPlaneY()->SetPlaneOrientationToYAxes();
                        bbGetOutputPlaneY()->SetSlicePosition((yMax+yMin)/2.*ySpacing);
 
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        bbGetOutputPlaneZ()->SetInput(bbGetInputIn());
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       bbGetOutputPlaneZ()->SetInputData(bbGetInputIn());
+#endif
+
                        bbGetOutputPlaneZ()->SetPlaneOrientationToZAxes();
                        bbGetOutputPlaneZ()->SetSlicePosition((zMax+zMin)/2.*zSpacing);
 
@@ -342,9 +407,15 @@ namespace bbvtk
                bbGetOutputPlaneZ()->SetResliceInterpolate( bbGetInputInterpolation() );
 
                
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                bbGetOutputPlaneX()->GetResliceOutput()->Update();
                bbGetOutputPlaneY()->GetResliceOutput()->Update(); 
                bbGetOutputPlaneZ()->GetResliceOutput()->Update();               
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+               // ...
+#endif
                
                std::vector<int> pointsx = bbGetInputPointsX();
                std::vector<int> pointsy = bbGetInputPointsY();
@@ -385,7 +456,15 @@ namespace bbvtk
 
        //for the plane widgets
                        vtkImagePlaneWidget* plane3pts = (vtkImagePlaneWidget*)bbGetOutputPlane3Pts();
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        plane3pts->SetInput(bbGetInputIn());                    
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       plane3pts->SetInputData(bbGetInputIn());                        
+#endif
+
                        double xSpacing, ySpacing, zSpacing;
                        bbGetInputIn()->GetSpacing(xSpacing, ySpacing, zSpacing);
                        plane3pts->SetOrigin(pointsx[0]*xSpacing,pointsy[0]*ySpacing,pointsz[0]*zSpacing);      
@@ -395,7 +474,15 @@ namespace bbvtk
                        plane3pts->SetPoint2((origin[0]+vect2[0]*factor)*xSpacing,
                                                                        (origin[1]+vect2[1]*factor)*ySpacing,
                                                                        (origin[2]+vect2[2]*factor)*zSpacing);
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        plane3pts->GetResliceOutput()->Update();
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       // ..
+#endif
+
 //To get the slice of image out of the selected volume
                        if (_imageReslicer==NULL){
                                _imageReslicer = vtkImageReslice::New();                                        
@@ -404,15 +491,34 @@ namespace bbvtk
                                _matrix = vtkMatrix4x4::New();  
                        }
                        _imageReslicer->SetInterpolationMode( bbGetInputInterpolation() );
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        _imageReslicer->SetInput( bbGetInputIn() );
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       _imageReslicer->SetInputData( bbGetInputIn() );
+#endif
+
+
                        _imageReslicer->SetInformationInput(bbGetInputIn());    
                        //fill out the information with the created vectors and using the spacing of the image
                        _imageReslicer->SetResliceAxesDirectionCosines(newx[0]*xSpacing,newx[1]*xSpacing,newx[2]*xSpacing,
                                                                        vect2[0]*ySpacing,vect2[1]*ySpacing,vect2[2]*ySpacing,
                                                                        crossp[0]*zSpacing,crossp[1]*zSpacing,crossp[2]*zSpacing);                      
                        _imageReslicer->SetResliceAxesOrigin(origin[0]*xSpacing,origin[1]*ySpacing,origin[2]*zSpacing);
+
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
                        _imageReslicer->GetOutput()->Update();
                        _imageReslicer->GetOutput()->UpdateInformation();
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+                       _imageReslicer->Update();
+#endif
+
+
 
                        bbSetOutputImage3Pts(_imageReslicer->GetOutput());