]> Creatis software - gdcm.git/blobdiff - vtk/vtkGdcmReader.cxx
*ENH: Add a setup.py.in that cmake will parse and give the right path to VTK ...
[gdcm.git] / vtk / vtkGdcmReader.cxx
index 64750a0da01e20a3dd22a96bf08c670fc8e47c68..b9aa0732117d1438b2f337e5138c71cf2fb19a26 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.28 2003/11/13 10:23:41 malaterre 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();
 }
 
 //----------------------------------------------------------------------------
@@ -479,8 +481,9 @@ size_t vtkGdcmReader::LoadImageInMemory(
     {
     size               = GdcmFile.GetImageDataSizeRaw();
     Source             = (unsigned char*) GdcmFile.GetImageDataRaw();
-    unsigned char *Lut = (unsigned char*) GdcmFile.GetLUTRGBA();
-
+    unsigned char *Lut =                  GdcmFile.GetLUTRGBA();
+  
+    if(!this->LookupTable) this->LookupTable = vtkLookupTable::New();
     this->LookupTable->SetNumberOfTableValues(256);
     for (int tmp=0; tmp<256; tmp++)
       {