]> Creatis software - crea.git/commitdiff
Linux vs Windoze
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 15 Oct 2009 15:32:58 +0000 (15:32 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Thu, 15 Oct 2009 15:32:58 +0000 (15:32 +0000)
appli/creaNewProject/creaNewProject.cpp
src/creaVtk.h
src/creaVtk.txx

index 9fb5c39c5ab53dc1b441598a59fb811ff6680233..f5295879d22a3ecaa519625927c89bc23ec2584b 100644 (file)
@@ -29,8 +29,8 @@ bool myApp::OnInit( )
    if (name.IsEmpty()) return false;
    
 #if(_WIN32)
-   std::string command("creaNewProject.bat ");
-    std::string command1("creaSed.exe ");
+       std::string command("creaNewProject.bat ");
+       std::string command1("creaSed.exe ");
        std::string command2("del ");
        
        command += "\"" + crea::wx2std(dir) + "\" \"" + crea::wx2std(name) + "\"";
@@ -38,11 +38,10 @@ bool myApp::OnInit( )
        command2 += "\"" + crea::wx2std(dir)+"\\"+crea::wx2std(name)+"\\CMakeLists.txt.in\"";
        if ( ! system ( command.c_str() ) )
        {
-               
                system ( command1.c_str() );
                system ( command2.c_str() );
                wxMessageBox(_T("Done !"),_T("creaNewProject"),
-                                        wxOK | wxICON_INFORMATION);
+                               wxOK | wxICON_INFORMATION);
        }
        else 
        {
@@ -51,12 +50,12 @@ bool myApp::OnInit( )
                wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);      
        }       
 #else
-   std::string command("creaNewProject.sh ");
+       std::string command("creaNewProject.sh ");
        command += "\"" + crea::wx2std(dir) + "\"" +" " + crea::wx2std(name);
        if ( ! system ( command.c_str() ) )
        {
                wxMessageBox(_T("Done !"),_T("creaNewProject"),
-                                        wxOK | wxICON_INFORMATION);
+                                       wxOK | wxICON_INFORMATION);
        }
        else 
        {
@@ -66,23 +65,6 @@ bool myApp::OnInit( )
        }
        
 #endif
-   command += "\"" + crea::wx2std(dir) + "\" \"" + crea::wx2std(name) + "\"";
-   command1 += "\"" + crea::wx2std(dir)+"\\"+crea::wx2std(name)+"\\CMakeLists.txt.in\" " + "PROJECT_NAME " + crea::wx2std(name) + "> \"" + crea::wx2std(dir)+"\\"+crea::wx2std(name)+"\\CMakeLists.txt\"";
-   command2 += "\"" + crea::wx2std(dir)+"\\"+crea::wx2std(name)+"\\CMakeLists.txt.in\"";
-   if ( ! system ( command.c_str() ) )
-     {
-                
-                system ( command1.c_str() );
-                system ( command2.c_str() );
-       wxMessageBox(_T("Done !"),_T("creaNewProject"),
-                   wxOK | wxICON_INFORMATION);
-     }
-   else 
-     {
-       wxString err(_T("An error occured while running '"));
-       err +=  crea::std2wx(command) + _T("'");
-       wxMessageBox(err,_T("creaNewProject"),wxOK | wxICON_ERROR);      
-     }
 
    return false;
 }
index 84510c73c4a67cd481c8ac0292eba4fc6e320193..b3403825c9baf012a76be1396f89a90a151dc3c7 100644 (file)
@@ -8,15 +8,13 @@
 
 namespace crea
 {
-
   template <class T>
 
-  CREA_EXPORT vtkImageData* NewVtkImageDataFromRaw( T* data,
-                                                   int nx, 
-                                                   int ny,
-                                                   int nz,
-                                                       bool do_not_desalloc = true);
-
+  vtkImageData* CREA_EXPORT NewVtkImageDataFromRaw( T* data,
+                                                    int nx, 
+                                                    int ny,
+                                                    int nz,
+                                                    bool do_not_desalloc = true);
   /*
     // Already provided by vtkTypeTraits<T>::VTKTypeID()
   template <class T>
index b0fe8b09375237b7e77b1c7fd43f7a35cf24e46b..c4e7167747d135f05c2d48269e4b445efb39bc82 100644 (file)
@@ -16,8 +16,7 @@
 #include <vtkTypeTraits.h>
 #include <creaMessageManager.h>
 namespace crea
-{
-  
+{  
   template <class T>
   /*CREA_EXPORT*/ vtkImageData* NewVtkImageDataFromRaw( T* data, 
                                                    int nx, 
@@ -27,12 +26,16 @@ namespace crea
   {
     //    std::cout << "NV "<<nx<<" " <<ny<<" " << nz<<std::endl;
     //    std::cout <<  vtkTypeTraits<T>::SizedName() << std::endl;
-    vtkImageData *image = vtkImageData::New();    
+    vtkImageData *image = vtkImageData::New();
+
+    // Shouldn't we pass NumberOfScalarComponents to deal with RGB, RGBA images as well? // JPR
+
     image->SetNumberOfScalarComponents(1);
+
     int vtktype = vtkTypeTraits<T>::VTKTypeID();
     image->SetScalarType(vtktype);
-    image->SetDimensions(nx,ny,nz);
-    image->SetSpacing(1,1,1);
+    image->SetDimensions(nx, ny ,nz);
+    image->SetSpacing(1, 1, 1);
     image->AllocateScalars();
     vtkDataArray* array = 0;
     switch (vtktype)
@@ -65,13 +68,14 @@ namespace crea
                  <<" non implemented");
       }
     vtkDataArrayTemplate<T>* tarray 
-      = dynamic_cast<vtkDataArrayTemplate<T>*>(array);
+               = 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.
-       int dndesa = 0;
-       if (do_not_desalloc) dndesa = 1;
+    int dndesa = 0;
+    if (do_not_desalloc)
+       dndesa = 1;
     tarray->SetArray( data, size, dndesa );
     image->GetPointData( )->SetScalars( tarray );
     array->Delete( );