X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreaVtk.txx;h=f0ea5be8a63e56d69591120f3cbb6f4088581cb3;hb=125ebd33086d760e061a2a56656b7f6fb7be27fc;hp=bbebc1dad8e79fe1702f3559ff6d3b4847e21e37;hpb=7c20ef5b6b9bcfe07f7b8e887360b70fc399962c;p=crea.git diff --git a/src/creaVtk.txx b/src/creaVtk.txx index bbebc1d..f0ea5be 100644 --- a/src/creaVtk.txx +++ b/src/creaVtk.txx @@ -22,7 +22,8 @@ namespace crea vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data, int nx, int ny, - int nz) + int nz, + bool do_not_desalloc) { // std::cout << "NV "<::SizedName() << std::endl; @@ -67,8 +68,11 @@ namespace crea = dynamic_cast*>(array); array->SetNumberOfComponents( 1 ); size_t size = (long)nx*(long)ny*(long)nz; - // The last param of SetArray is set to 1 to keep the class from deleting the array when it cleans up or reallocates memory. - tarray->SetArray( data, size, 1 ); + // The last param of SetArray is set to 1 to keep the class from deleting the array + // when it cleans up or reallocates memory. + int dndesa = 0; + if (do_not_desalloc) dndesa = 1; + tarray->SetArray( data, size, dndesa ); image->GetPointData( )->SetScalars( tarray ); array->Delete( ); return image;