X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkCreateImage.cxx;fp=packages%2Fvtk%2Fsrc%2FbbvtkCreateImage.cxx;h=cb9d77bf0d920e156f4de703db005274e643e7f3;hb=088ed2b7bdbe14eb85a7245afaa693ddb7a53a97;hp=074e9de8a37d013d7a1f10b8ae6963035ab529ff;hpb=79d06fa7c6441e99291ad3a1949d241f336573d5;p=bbtk.git diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index 074e9de..cb9d77b 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -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; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); - } - - sizeBlock= dim[0] * imageoutput->GetScalarSize(); - for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); - } - - sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); - for (k=0; kGetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock ); - } // for k - - imageoutput->Update(); - imageoutput->Modified(); - bbSetOutputOut(imageoutput); - + int i,j,k; + long sizeBlock; + for (i=0; iSetScalarComponentFromDouble(i,0,0, 0, bbGetInputInitialValue() ); + } // for i + + sizeBlock= dim[0] * imageoutput->GetScalarSize(); + for (j=1; jGetScalarPointer(0,j,0), imageoutput->GetScalarPointer() , sizeBlock ); + } // for j + + sizeBlock= dim[0] * dim[1] * imageoutput->GetScalarSize(); + for (k=0; kGetScalarPointer(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); } //=====