]> Creatis software - gdcm.git/blobdiff - vtk/vtkGdcmReader.cxx
All the 'accesors with euristics' move to the end of the file
[gdcm.git] / vtk / vtkGdcmReader.cxx
index 90d0a6dcb3ac983c28f592e89b42dbf62448498b..a3e871f78974451c97d875e16343df3b48e80d65 100644 (file)
@@ -1,5 +1,4 @@
-// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.10 2003/06/11 13:36:54 frog Exp $
-//CLEANME#include <vtkByteSwap.h>
+// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.13 2003/07/01 10:04:37 frog Exp $
 #include <stdio.h>
 #include <vtkObjectFactory.h>
 #include <vtkImageData.h>
@@ -16,6 +15,7 @@ vtkGdcmReader::vtkGdcmReader()
 vtkGdcmReader::~vtkGdcmReader()
 { 
   // FIXME free memory
+  this->FileNameList.clear();
 }
 
 //----------------------------------------------------------------------------
@@ -28,6 +28,7 @@ void vtkGdcmReader::AddFileName(const char* name)
   strcpy(LocalName, name);
   this->FileNameList.push_back(LocalName);
   this->Modified();
+  delete[] LocalName;
 }
 
 //----------------------------------------------------------------------------
@@ -37,7 +38,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:
-  this->FileNameList.empty();
+  this->FileNameList.clear();
   this->Modified();
 }
 
@@ -222,11 +223,11 @@ int vtkGdcmReader::CheckFileCoherence()
    ///////// The files we CANNOT load are flaged. On debugging purposes
    // count the loadable number of files and display thir number:
    int NumberCoherentFiles = 0;
-   for (std::list<std::string>::iterator FileName  = FileNameList.begin();
-                                        FileName != FileNameList.end();
-                                      ++FileName)
+   for (std::list<std::string>::iterator Filename  = FileNameList.begin();
+                                        Filename != FileNameList.end();
+                                      ++Filename)
      {
-     if (*FileName != "GDCM_UNREADABLE")
+     if (*Filename != "GDCM_UNREADABLE")
         NumberCoherentFiles++;    
      }
    vtkDebugMacro("Number of coherent files: " << NumberCoherentFiles);
@@ -409,9 +410,9 @@ void vtkGdcmReader::ExecuteData(vtkDataObject *output)
 
   // Variables for the UpdateProgress. We shall use 50 steps to signify
   // the advance of the process:
-  unsigned long UpdateProgressTarget = (unsigned long) this->NumLines
+  unsigned long UpdateProgressTarget = (unsigned long) ceil (this->NumLines
                                      * this->TotalNumberOfPlanes
-                                     / 50.0;
+                                     / 50.0);
   // The actual advance measure:
   unsigned long UpdateProgressCount = 0;