From: regrain Date: Mon, 3 May 2004 09:15:01 +0000 (+0000) Subject: * vtk/vtkGdcmReader.cxx : bug fix when loading a list of files using the X-Git-Tag: Version0.5.bp~199 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=c04f72b2466db911700aaea2d14426de678e9b94;p=gdcm.git * vtk/vtkGdcmReader.cxx : bug fix when loading a list of files using the file pattern (SetFilePattern) -- BeNours --- diff --git a/ChangeLog b/ChangeLog index 38b881b0..4896c3e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-03-30 Benoit Regrain + * vtk/vtkGdcmReader.cxx : bug fix when loading a list of files using the + file pattern (SetFilePattern) + 2004-05-02 Mathieu Malaterre * Add a new test: ShowDicom, for now this is just the c++ version of checkRead.sh, later it will be able to compare the image read against a diff --git a/vtk/vtkGdcmReader.cxx b/vtk/vtkGdcmReader.cxx index 34f53f25..7708dee3 100644 --- a/vtk/vtkGdcmReader.cxx +++ b/vtk/vtkGdcmReader.cxx @@ -122,6 +122,7 @@ void vtkGdcmReader::SetFileName(const char *name) // Since we maintain a list of filenames, when building a volume, // (see vtkGdcmReader::AddFileName), we additionaly need to purge // this list when we manually positionate the filename. + vtkDebugMacro("Clearing all files given with AddFileName"); this->FileNameList.clear(); this->Modified(); } @@ -319,10 +320,26 @@ void vtkGdcmReader::ExecuteData(vtkDataObject *output) */ void vtkGdcmReader::BuildFileListFromPattern() { + this->RemoveAllInternalFileName(); + if ((! this->FileNameList.empty()) && this->FileName ) { - vtkErrorMacro("Both file patterns and AddFileName schemes were used"); - vtkErrorMacro("Only the files specified with AddFileName shall be used"); + vtkErrorMacro("Both AddFileName and SetFileName schemes were used"); + vtkErrorMacro("No images loaded ! "); + return; + } + + if ((! this->FileNameList.empty()) && this->FilePattern ) + { + vtkErrorMacro("Both AddFileName and SetFilePattern schemes were used"); + vtkErrorMacro("No images loaded ! "); + return; + } + + if (this->FileName && this->FilePattern) + { + vtkErrorMacro("Both SetFileName and SetFilePattern schemes were used"); + vtkErrorMacro("No images loaded ! "); return; } @@ -340,17 +357,17 @@ void vtkGdcmReader::BuildFileListFromPattern() return; } - this->RemoveAllInternalFileName(); - if( this->FileNameList.empty() ) + if( this->FileName ) { - //Multiframe case: + // Single file loading (as given with ::SetFileName()): + // Case of multi-frame file considered here this->ComputeInternalFileName(this->DataExtent[4]); vtkDebugMacro("Adding file " << this->InternalFileName); this->AddInternalFileName(this->InternalFileName); } else { - //stack of 2D dicom case: + // Multi file loading (as given with ::SetFilePattern()): for (int idx = this->DataExtent[4]; idx <= this->DataExtent[5]; ++idx) { this->ComputeInternalFileName(idx);