]> Creatis software - gdcm.git/blobdiff - vtk/vtkGdcmReader.cxx
* src/gdcmDict.cxx, gdcmElValSet.cxx : bug fix under windows for prints.
[gdcm.git] / vtk / vtkGdcmReader.cxx
index 64750a0da01e20a3dd22a96bf08c670fc8e47c68..1e0852bdbab52c64923cf2d9c62321b20455b80e 100644 (file)
@@ -1,4 +1,4 @@
-// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.25 2003/11/05 18:15:41 malaterre Exp $
+// $Header: /cvs/public/gdcm/vtk/vtkGdcmReader.cxx,v 1.29 2003/12/22 12:46:19 regrain Exp $
 // //////////////////////////////////////////////////////////////
 // WARNING TODO CLENAME 
 // Actual limitations of this code:
 // time...
 // //////////////////////////////////////////////////////////////
 
-#include <stdio.h>
+#include "gdcmFile.h"
+#include "gdcmHeaderHelper.h"
+#include "vtkGdcmReader.h"
+
+//#include <stdio.h>
 #include <vtkObjectFactory.h>
 #include <vtkImageData.h>
 #include <vtkPointData.h>
 #include <vtkLookupTable.h>
-#include "vtkGdcmReader.h"
-#include "gdcm.h"
-#include "gdcmHeaderHelper.h"
+
 
 vtkGdcmReader::vtkGdcmReader()
 {
   // Constructor
-  this->LookupTable = vtkLookupTable::New();
+  this->LookupTable = NULL;
 }
 
 //----------------------------------------------------------------------------
@@ -62,7 +64,7 @@ vtkGdcmReader::~vtkGdcmReader()
 { 
   this->RemoveAllFileName();
   this->InternalFileNameList.clear();
-  this->LookupTable->Delete();
+  if(this->LookupTable) this->LookupTable->Delete();
 }
 
 //----------------------------------------------------------------------------
@@ -469,18 +471,19 @@ size_t vtkGdcmReader::LoadImageInMemory(
   // But vtk chooses to invert the lines of an image, that is the last
   // line comes first (for some axis related reasons?). Hence we need
   // to load the image line by line, starting from the end.
-  int NumColumns = GdcmFile.GetXSize();
-  int NumLines   = GdcmFile.GetYSize();
-  int NumPlanes  = GdcmFile.GetZSize();
-  int LineSize   = NumComponents * NumColumns * GdcmFile.GetPixelSize();
+  int NumColumns = GdcmFile.GetHeader()->GetXSize();
+  int NumLines   = GdcmFile.GetHeader()->GetYSize();
+  int NumPlanes  = GdcmFile.GetHeader()->GetZSize();
+  int LineSize   = NumComponents * NumColumns * GdcmFile.GetHeader()->GetPixelSize();
 
   unsigned char * Source;
-  if( GdcmFile.HasLUT() )
+  if( GdcmFile.GetHeader()->HasLUT() )
     {
     size               = GdcmFile.GetImageDataSizeRaw();
     Source             = (unsigned char*) GdcmFile.GetImageDataRaw();
-    unsigned char *Lut = (unsigned char*) GdcmFile.GetLUTRGBA();
-
+    unsigned char *Lut =                  GdcmFile.GetHeader()->GetLUTRGBA();
+  
+    if(!this->LookupTable) this->LookupTable = vtkLookupTable::New();
     this->LookupTable->SetNumberOfTableValues(256);
     for (int tmp=0; tmp<256; tmp++)
       {