]> Creatis software - bbtk.git/commitdiff
#3039 BBTK Bug New Normal - vtk package MetaImageReader exeption file not exists
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 17 Nov 2016 14:42:55 +0000 (15:42 +0100)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Thu, 17 Nov 2016 14:42:55 +0000 (15:42 +0100)
packages/vtk/src/bbvtkMetaImageReader.cxx

index e339f3b8ea83995587b197c99b41f3ecf5c147c2..f092643b7aecd9497ec6755d60c9f3c55d5d7d26 100644 (file)
@@ -32,10 +32,17 @@ void MetaImageReader::Process()
 //    bbSetOutputOut( bbGetInputIn() );
 //    std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
 
-       vtkMetaImageReader *reader = vtkMetaImageReader::New();
-       reader->SetFileName(bbGetInputIn().c_str());
-       reader->Update();
-       bbSetOutputOut(reader->GetOutput());
+       FILE *ff=fopen(bbGetInputIn().c_str(),"r");
+       if (ff)
+       {
+               fclose(ff);
+               vtkMetaImageReader *reader = vtkMetaImageReader::New();
+               reader->SetFileName(bbGetInputIn().c_str());
+               reader->Update();
+               bbSetOutputOut(reader->GetOutput());
+       } else {
+                       bbSetOutputOut(NULL);
+       }
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)