X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=packages%2Fvtk%2Fsrc%2FbbvtkCreateImage.cxx;h=c534252a5b3452d7c440b579464a69e342790b80;hb=af00d6db1dc36f21081781f4c15e4762c2eb25b3;hp=cb9d77bf0d920e156f4de703db005274e643e7f3;hpb=088ed2b7bdbe14eb85a7245afaa693ddb7a53a97;p=bbtk.git diff --git a/packages/vtk/src/bbvtkCreateImage.cxx b/packages/vtk/src/bbvtkCreateImage.cxx index cb9d77b..c534252 100644 --- a/packages/vtk/src/bbvtkCreateImage.cxx +++ b/packages/vtk/src/bbvtkCreateImage.cxx @@ -53,7 +53,7 @@ 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]; + double spc[3]; int dim[3]; int outputformat = VTK_UNSIGNED_SHORT; @@ -80,15 +80,27 @@ void CreateImage::Process() else if (bbGetInputOutputFormat()=="VTK_DOUBLE") outputformat = VTK_DOUBLE; // 11 else if (bbGetInputOutputFormat()=="MET_DOUBLE") outputformat = VTK_DOUBLE; // 11 - spc[0] = bbGetInputSpacing()[0]; spc[1] = bbGetInputSpacing()[1]; spc[2] = bbGetInputSpacing()[2]; - dim[0] = bbGetInputDimensions()[0]; dim[1] = bbGetInputDimensions()[1]; dim[2] = bbGetInputDimensions()[2]; - + if ((dim[0]<=0)||(dim[1]<=0)||(dim[2]<=0)) + { + dim[0]=1; + dim[1]=1; + dim[2]=1; + } + if ((spc[0]<=0)||(spc[1]<=0)||(spc[2]<=0)) + { + spc[0]=1; + spc[1]=1; + spc[2]=1; + } +//EED 2017-12-7 + if (imageoutput!=NULL) {imageoutput->Delete();} + imageoutput = vtkImageData::New(); imageoutput->Initialize(); imageoutput->SetSpacing( spc ); imageoutput->SetDimensions( dim[0], dim[1], dim[2] ); @@ -102,7 +114,6 @@ void CreateImage::Process() imageoutput->AllocateScalars( outputformat,1 ); #endif - int i,j,k; long sizeBlock; @@ -122,7 +133,7 @@ void CreateImage::Process() { memcpy( imageoutput->GetScalarPointer(0,0,k) ,imageoutput->GetScalarPointer() , sizeBlock ); } // for k - + //EED 2017-01-01 Migration VTK7 #if (VTK_MAJOR_VERSION <= 5) @@ -170,7 +181,7 @@ void CreateImage::bbUserInitializeProcessing() // but this is where you should allocate the internal/output pointers // if any - imageoutput = vtkImageData::New(); +//EED 2017-12-7 imageoutput = vtkImageData::New(); }