]> Creatis software - gdcm.git/commitdiff
* vtk/vtkGdcmReader.cxx : bug fix when loading a list of files using the
authorregrain <regrain>
Mon, 3 May 2004 09:15:01 +0000 (09:15 +0000)
committerregrain <regrain>
Mon, 3 May 2004 09:15:01 +0000 (09:15 +0000)
       file pattern (SetFilePattern)
     -- BeNours

ChangeLog
vtk/vtkGdcmReader.cxx

index 38b881b00bebf677fa618247ccbae0df92cc1b9c..4896c3e68fe396273e641e22ac66fe10d6532cdc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-03-30 Benoit Regrain <Benoit.Regrain@creatis.insa-lyon.fr>
+     * vtk/vtkGdcmReader.cxx : bug fix when loading a list of files using the
+       file pattern (SetFilePattern)
+
 2004-05-02  Mathieu Malaterre  <Mathieu.Malaterre@creatis.insa-lyon.fr>
      * 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
index 34f53f257c92b132bfd882086e2168f16b68bd37..7708dee3a60966b772290817960c13f26b1fe332 100644 (file)
@@ -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);