From 6a6586d40e77dbdadd6a92145b9919e3c68457d8 Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Thu, 17 Nov 2016 15:42:55 +0100 Subject: [PATCH] #3039 BBTK Bug New Normal - vtk package MetaImageReader exeption file not exists --- packages/vtk/src/bbvtkMetaImageReader.cxx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/vtk/src/bbvtkMetaImageReader.cxx b/packages/vtk/src/bbvtkMetaImageReader.cxx index e339f3b..f092643 100644 --- a/packages/vtk/src/bbvtkMetaImageReader.cxx +++ b/packages/vtk/src/bbvtkMetaImageReader.cxx @@ -32,10 +32,17 @@ void MetaImageReader::Process() // bbSetOutputOut( bbGetInputIn() ); // std::cout << "Output value = " <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) -- 2.47.1