X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vv%2FvvMesh.cxx;h=5a5be2fae825c43daefd5464baf1f7f739346de9;hb=10ec7dc09aeea303fdc6a30449ec69de2f2ccd88;hp=8f6e78cf02740f2e854272ffa56b46b8ed200796;hpb=95c9ed39f813cd2a90d5dfbee394b50425627e8e;p=clitk.git diff --git a/vv/vvMesh.cxx b/vv/vvMesh.cxx index 8f6e78c..5a5be2f 100644 --- a/vv/vvMesh.cxx +++ b/vv/vvMesh.cxx @@ -30,6 +30,7 @@ along with this program. If not, see . #include #include #include +#include #include #include "clitkCommon.h" #include "vvMesh.h" @@ -37,6 +38,7 @@ along with this program. If not, see . #include #include #include +#include #include @@ -54,11 +56,30 @@ void vvMesh::AddMesh(vtkPolyData* p) void vvMesh::ReadFromVTK(const char * filename) { - assert(GetNumberOfMeshes() == 0); ///We assume the object is empty - vtkSmartPointer r=vtkSmartPointer::New(); - r->SetFileName(filename); - r->Update(); - AddMesh(r->GetOutput()); + DD("hello!"); + std::string extension=itksys::SystemTools::GetFilenameLastExtension(std::string(filename)); + if (extension == ".vtk" || extension== ".VTK") + { + assert(GetNumberOfMeshes() == 0); ///We assume the object is empty + vtkSmartPointer r=vtkSmartPointer::New(); + r->SetFileName(filename); + r->Update(); + assert(r->GetOutput()); + AddMesh(r->GetOutput()); + } + else if (extension == ".obj" || extension== ".OBJ") + { + assert(GetNumberOfMeshes() == 0); ///We assume the object is empty + vtkSmartPointer r=vtkSmartPointer::New(); + r->SetFileName(filename); + r->Update(); + assert(r->GetOutput()); + AddMesh(r->GetOutput()); + } + else + assert (false) ; //shouldn't happen + + assert(GetNumberOfMeshes() != 0); ///We assume the object is empty structure_name=filename; }