]> Creatis software - crea.git/commitdiff
*** empty log message ***
authormachado <machado>
Wed, 13 May 2009 09:31:31 +0000 (09:31 +0000)
committermachado <machado>
Wed, 13 May 2009 09:31:31 +0000 (09:31 +0000)
src/creaVtk.txx

index bbebc1dad8e79fe1702f3559ff6d3b4847e21e37..f0ea5be8a63e56d69591120f3cbb6f4088581cb3 100644 (file)
@@ -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 "<<nx<<" " <<ny<<" " << nz<<std::endl;
     //    std::cout <<  vtkTypeTraits<T>::SizedName() << std::endl;
@@ -67,8 +68,11 @@ namespace crea
       = dynamic_cast<vtkDataArrayTemplate<T>*>(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;