-// $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.26 2003/11/06 14:14:10 malaterre Exp $
// //////////////////////////////////////////////////////////////
// WARNING TODO CLENAME
// Actual limitations of this code:
vtkGdcmReader::vtkGdcmReader()
{
// Constructor
- this->LookupTable = vtkLookupTable::New();
+ this->LookupTable = NULL;
}
//----------------------------------------------------------------------------
{
this->RemoveAllFileName();
this->InternalFileNameList.clear();
- this->LookupTable->Delete();
+ if(this->LookupTable) this->LookupTable->Delete();
}
//----------------------------------------------------------------------------
size = GdcmFile.GetImageDataSizeRaw();
Source = (unsigned char*) GdcmFile.GetImageDataRaw();
unsigned char *Lut = (unsigned char*) GdcmFile.GetLUTRGBA();
-
+
+ if(!this->LookupTable) this->LookupTable = vtkLookupTable::New();
this->LookupTable->SetNumberOfTableValues(256);
for (int tmp=0; tmp<256; tmp++)
{
#include <vtkStructuredPointsWriter.h>
#include <vtkCommand.h>
#include <vtkRenderer.h>
+#include <vtkImageMapToColors.h>
+#include <vtkLookupTable.h>
#include "vtkGdcmReader.h"
vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();
vtkImageViewer2 *viewer = vtkImageViewer2::New();
- viewer->SetInput ( reader->GetOutput() );
+ if( reader->GetLookupTable() )
+ {
+ //convert to color:
+ vtkImageMapToColors *map = vtkImageMapToColors::New ();
+ map->SetInput (reader->GetOutput());
+ map->SetLookupTable (reader->GetLookupTable());
+ map->SetOutputFormatToRGB();
+ viewer->SetInput ( map->GetOutput() );
+ map->Delete();
+ }
+ else
+ {
+ viewer->SetInput ( reader->GetOutput() );
+ }
viewer->SetupInteractor (iren);
// float *range = reader->GetOutput()->GetScalarRange();