]> Creatis software - crea.git/commitdiff
*** empty log message ***
authorguigues <guigues>
Tue, 24 Feb 2009 20:34:01 +0000 (20:34 +0000)
committerguigues <guigues>
Tue, 24 Feb 2009 20:34:01 +0000 (20:34 +0000)
cmake/CREAMacro_FindAndUseLibraries.cmake
src/creaVtk.h
src/creaVtk.txx

index a5954de39d8101e836ee302a8e43558f31bcd912..77273c2dab86fbf55bd88fcde58e47392e2982d9 100644 (file)
@@ -18,6 +18,20 @@ ENDIF(USE_CREA)
 #-----------------------------------------------------------------------------
 
 
+#-----------------------------------------------------------------------------
+IF(USE_QT4)
+  IF(NOT Qt4_FOUND)
+    FIND_PACKAGE(Qt4 REQUIRED)
+    INCLUDE(${QT_USE_FILE})
+    CREA_DEFINE( USE_QT )
+    #    SET(QT_LIBRARIES
+    #      ${QT_LIBRARIES}
+    #      ) 
+    #  MARK_AS_ADVANCED(Qt4_DIR)
+  ENDIF(NOT Qt4_FOUND)
+ENDIF(USE_QT4)
+#-----------------------------------------------------------------------------
+
 #-----------------------------------------------------------------------------
 IF(USE_VTK)
   INCLUDE(${CREA_CMAKE_DIR}/CREAMacro_FindAndUseVTK.cmake)
index 175769e57b8f0cfc122866e2a75dba4583d15b9a..3b205d1f54d935dc890b6dd5b5f181c05f843cfd 100644 (file)
@@ -11,7 +11,9 @@ namespace crea
 
   template <class T>
   vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data,
-                                                   size_t size);
+                                                   int nx, 
+                                                   int ny,
+                                                   int nz);
 
   template <class T>
   vtkIdType GetVtkIdType(T&) { return VTK_VOID; }
index a7d6a04733b9805a2180f6232302054d85a9be92..4d39387958debb94ce4b6316ccdff53b8986af9d 100644 (file)
@@ -1,25 +1,39 @@
 #include <vtkDataArrayTemplate.h>
 #include <vtkPointData.h>
-
+#include <typeinfo> 
 namespace crea
 {
   
   template <class T>
   vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data,
-                                                   size_t size)
+                                                   int nx, 
+                                                   int ny,
+                                                   int nz)
   {
+    std::cout << "NV "<<nx<<" " <<ny<<" " << nz<<std::endl;
+    std::cout << typeid(T).name() << std::endl;
     vtkImageData *image = vtkImageData::New();    
     image->SetNumberOfScalarComponents(1);
     image->SetScalarType(GetVtkIdType<T>(*data));
+    image->SetDimensions(nx,ny,nz);
+    image->SetSpacing(1,1,1);
+    std::cout << "alloc"<<std::endl;
     image->AllocateScalars();
+    std::cout << "alloc ok"<<std::endl;
     vtkDataArrayTemplate<T>* array 
       = (vtkDataArrayTemplate<T>*)vtkDataArrayTemplate<T>::New();
-    array->SetNumberOfComponents( 1 );
+    std::cout << "data array alloc ok"<<std::endl;
+    //    array->SetNumberOfComponents( 1 );
+    std::cout << "nb compo ok"<<std::endl;
     // The last param of SetArray is set to 1 to keep the class from deleting the array when it cleans up or reallocates memory.
+    size_t size = (long)nx*(long)ny*(long)nz;
+    std::cout << "SetArray"<<std::endl;
     array->SetArray( data, size, 1 );
     //Pay attention in particular to the last param of SetArray:
     //http://www.vtk.org/doc/nightly/html/classvtkUnsignedShortArray.html#z798_0
-    image->GetPointData( )->SetScalars( array );
+   std::cout << "SetScalars"<<std::endl;
+     image->GetPointData( )->SetScalars( array );
+   std::cout << "Delete"<<std::endl;
     array->Delete( );
     return image;
   }