]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbvtkCreateImage.cxx
#3107 BBTK Bug New Normal - branch vtk7itk4 compilation with vtk7
[bbtk.git] / packages / vtk / src / bbvtkCreateImage.cxx
index 074e9de8a37d013d7a1f10b8ae6963035ab529ff..cb9d77bf0d920e156f4de703db005274e643e7f3 100644 (file)
@@ -53,13 +53,10 @@ void CreateImage::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
-       
-
        double  spc[6];
        int             dim[3]; 
        int             outputformat = VTK_UNSIGNED_SHORT;
        
-
        if (bbGetInputOutputFormat()=="VTK_BIT")                                        outputformat = VTK_BIT;                 // 1
        else if (bbGetInputOutputFormat()=="VTK_CHAR")                          outputformat = VTK_CHAR;                                // 2
        else if (bbGetInputOutputFormat()=="MET_CHAR")                          outputformat = VTK_CHAR;                                // 2
@@ -84,7 +81,6 @@ void CreateImage::Process()
        else if (bbGetInputOutputFormat()=="MET_DOUBLE")                        outputformat = VTK_DOUBLE;              // 11  
 
 
-
        spc[0] = bbGetInputSpacing()[0];
        spc[1] = bbGetInputSpacing()[1];
        spc[2] = bbGetInputSpacing()[2];
@@ -94,37 +90,50 @@ void CreateImage::Process()
        dim[2] =  bbGetInputDimensions()[2];
        
        imageoutput->Initialize();
-       imageoutput->SetScalarType( outputformat );     
        imageoutput->SetSpacing( spc );
        imageoutput->SetDimensions(  dim[0], dim[1], dim[2] );
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
+       imageoutput->SetScalarType( outputformat );     
        imageoutput->AllocateScalars();
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+       imageoutput->AllocateScalars( outputformat,1 );
+#endif
        
 
-               int i,j,k;
-               long sizeBlock; 
-
-               for (i=0; i<dim[0]; i++)
-               {
-                       imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
-               }
-               
-               sizeBlock= dim[0] * imageoutput->GetScalarSize();
-                for (j=1; j<dim[1]; j++)
-               {
-                       memcpy(  imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer()  , sizeBlock );
-               }               
-
-               sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
-               for (k=0; k<dim[2]; k++)
-               {
-                       memcpy(  imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer()  , sizeBlock );
-               } // for k
-
-               imageoutput->Update();
-               imageoutput->Modified();
-               bbSetOutputOut(imageoutput);
-
+       int i,j,k;
+       long sizeBlock; 
 
+       for (i=0; i<dim[0]; i++)
+       {
+               imageoutput->SetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() );
+       } // for i
+       
+       sizeBlock= dim[0] * imageoutput->GetScalarSize();
+    for (j=1; j<dim[1]; j++)
+       {
+               memcpy(  imageoutput->GetScalarPointer(0,j,0), imageoutput->GetScalarPointer()  , sizeBlock );
+       } // for j              
+
+       sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize();
+       for (k=0; k<dim[2]; k++)
+       {
+               memcpy(  imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer()  , sizeBlock );
+       } // for k
+
+
+//EED 2017-01-01 Migration VTK7
+#if (VTK_MAJOR_VERSION <= 5) 
+       imageoutput->Update();
+#endif
+#if (VTK_MAJOR_VERSION >= 6) 
+       // ..
+#endif
+
+       imageoutput->Modified();
+       bbSetOutputOut(imageoutput);
 }      
        
 //=====