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) + "\"";
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
{
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
{
}
#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;
}
#include <vtkTypeTraits.h>
#include <creaMessageManager.h>
namespace crea
-{
-
+{
template <class T>
/*CREA_EXPORT*/ vtkImageData* NewVtkImageDataFromRaw( T* data,
int nx,
{
// 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)
<<" 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( );