]> Creatis software - gdcm.git/blobdiff - vtk/vtkGdcmReader.cxx
Avoid troubles with progress bar.
[gdcm.git] / vtk / vtkGdcmReader.cxx
index 51597358c097dcee5ff34b7bf24c16ad0c3ba973..24e3f929775c761a4418994cc46b5b9c36fb6299 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkGdcmReader.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/08/30 14:40:35 $
-  Version:   $Revision: 1.77 $
+  Date:      $Date: 2005/10/25 14:52:37 $
+  Version:   $Revision: 1.85 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -69,7 +69,7 @@
 #include <vtkPointData.h>
 #include <vtkLookupTable.h>
 
-vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.77 $")
+vtkCxxRevisionMacro(vtkGdcmReader, "$Revision: 1.85 $")
 vtkStandardNewMacro(vtkGdcmReader)
 
 //-----------------------------------------------------------------------------
@@ -79,7 +79,7 @@ vtkGdcmReader::vtkGdcmReader()
    this->LookupTable = NULL;
    this->AllowLookupTable = false;
    this->AllowLightChecking = false;
-   this->LoadMode = GDCM_LD_ALL; // Load everything (possible values : 
+   this->LoadMode = gdcm::LD_ALL; // Load everything (possible values : 
                                  //  - LD_NOSEQ, 
                                  //  - LD_NOSHADOW,
                                  //  - LD_NOSHADOWSEQ)
@@ -452,7 +452,7 @@ void vtkGdcmReader::LoadFileInformation()
       fclose(fp);
 
       // Read the file
-      file=new gdcm::File();
+      file=gdcm::File::New();
       file->SetLoadMode( LoadMode );
       file->SetFileName(filename->c_str() );
       file->Load();
@@ -463,7 +463,7 @@ void vtkGdcmReader::LoadFileInformation()
          vtkErrorMacro(<< "Gdcm cannot parse file " << filename->c_str());
          vtkErrorMacro(<< "Removing this file from read files: "
                         << filename->c_str());
-         delete file;
+         file->Delete();
          file=NULL;
          InternalFileList.push_back(file);
          continue;
@@ -479,7 +479,7 @@ void vtkGdcmReader::LoadFileInformation()
                        << "   File type found : " << type.c_str() 
                        << " (might be 8U, 8S, 16U, 16S, 32U, 32S) \n"
                        << "   Removing this file from read files");
-         delete file;
+         file->Delete();
          file=NULL;
          InternalFileList.push_back(file);
          continue;
@@ -499,7 +499,7 @@ void vtkGdcmReader::LoadFileInformation()
       }
       else if(!TestFileInformation(file))
       {
-         delete file;
+         file->Delete();
          file=NULL;
       }
 
@@ -540,7 +540,11 @@ void vtkGdcmReader::GetFileInformation(gdcm::File *file)
    this->NumColumns = file->GetXSize();
    this->NumLines   = file->GetYSize();
    this->NumPlanes  = file->GetZSize();
-   this->TotalNumberOfPlanes = this->NumPlanes*InternalFileNameList.size();
+
+   if (CoherentFileList == 0)
+      this->TotalNumberOfPlanes = this->NumPlanes*InternalFileNameList.size();
+   else
+      this->TotalNumberOfPlanes = this->NumPlanes*CoherentFileList->size();
 
    this->ImageType = file->GetPixelType();
    this->PixelSize = file->GetPixelSize();
@@ -593,8 +597,8 @@ bool vtkGdcmReader::TestFileInformation(gdcm::File *file)
    int numColumns = file->GetXSize();
    int numLines   = file->GetYSize();
    int numPlanes  = file->GetZSize();
-   int pixelSize  = file->GetPixelSize();
    int numComponents;
+   unsigned int pixelSize  = file->GetPixelSize();
 
    if( file->HasLUT() && this->AllowLookupTable )
       numComponents = file->GetNumberOfScalarComponentsRaw();
@@ -611,7 +615,7 @@ bool vtkGdcmReader::TestFileInformation(gdcm::File *file)
    }
    if( numLines != this->NumLines )
    {
-      vtkErrorMacro(<< "File y value doesn't match with the previous ones: "
+      vtkErrorMacro(<< "File Y value doesn't match with the previous ones: "
                     << file->GetFileName().c_str()
                     << ". Found " << numLines << ", must be "
                     << this->NumLines);
@@ -619,7 +623,7 @@ bool vtkGdcmReader::TestFileInformation(gdcm::File *file)
    }
    if( numPlanes != this->NumPlanes )
    {
-      vtkErrorMacro(<< "File z value doesn't match with the previous ones: "
+      vtkErrorMacro(<< "File Z value doesn't match with the previous ones: "
                     << file->GetFileName().c_str()
                     << ". Found " << numPlanes << ", must be "
                     << this->NumPlanes);
@@ -677,7 +681,7 @@ void vtkGdcmReader::RemoveAllInternalFile(void)
                                  it!=InternalFileList.end();
                                  ++it)
       {
-         delete (*it);
+         (*it)->Delete();
       }
    }
    this->InternalFileList.clear();
@@ -737,7 +741,7 @@ void vtkGdcmReader::LoadImageInMemory(
    if(!f)
       return;
 
-   gdcm::FileHelper *fileH = new gdcm::FileHelper( f );
+   gdcm::FileHelper *fileH = gdcm::FileHelper::New( f );
    fileH->SetUserFunction( UserFunction );
 
    int numColumns = f->GetXSize();
@@ -749,9 +753,9 @@ void vtkGdcmReader::LoadImageInMemory(
       numComponents = f->GetNumberOfScalarComponentsRaw();
    else
       numComponents = f->GetNumberOfScalarComponents(); //rgb or mono
-
+   vtkDebugMacro(<< "numComponents:" << numComponents);
    vtkDebugMacro(<< "Copying to memory image [" << f->GetFileName().c_str() << "]");
-   size_t size;
+   //size_t size;
 
    // If the data structure of vtk for image/volume representation
    // were straigthforwards the following would be enough:
@@ -767,7 +771,8 @@ void vtkGdcmReader::LoadImageInMemory(
    
    if( fileH->GetFile()->HasLUT() && AllowLookupTable )
    {
-      size               = fileH->GetImageDataSize();
+      // to avoid bcc 5.5 w
+      /*size               = */ fileH->GetImageDataSize(); 
       src                = (unsigned char*) fileH->GetImageDataRaw();
       unsigned char *lut = (unsigned char*) fileH->GetLutRGBA();
 
@@ -792,8 +797,9 @@ void vtkGdcmReader::LoadImageInMemory(
    }
    else
    {
-      size = fileH->GetImageDataSize();
-      src  = (unsigned char*)fileH->GetImageData();
+      //size = fileH->GetImageDataSize(); 
+      // useless - just an accessor;  'size' unused
+      src  = (unsigned char*)fileH->GetImageData();  
    } 
 
    unsigned char *dst = dest + planeSize - lineSize;
@@ -815,7 +821,7 @@ void vtkGdcmReader::LoadImageInMemory(
       dst += 2 * planeSize;
    }
 
-   delete fileH;
+   fileH->Delete();
 }
 
 //-----------------------------------------------------------------------------