1 // This example illustrates how the vtkGdcmWriter vtk class can be
6 //----------------------------------------------------------------------------
9 #include <vtkImageMapToColors.h>
10 #include <vtkLookupTable.h>
11 #include <vtkImageData.h>
13 #include "vtkGdcmReader.h"
14 #include "vtkGdcmWriter.h"
16 #ifndef vtkFloatingPointType
17 #define vtkFloatingPointType float
20 //----------------------------------------------------------------------------
21 int main(int argc, char *argv[])
26 vtkGdcmReader *reader = vtkGdcmReader::New();
27 reader->AllowLookupTableOff();
30 reader->SetFileName( argv[1] );
32 for(int i=1; i< argc; i++)
33 reader->AddFileName( argv[i] );
38 if( reader->GetLookupTable() )
41 vtkImageMapToColors *map = vtkImageMapToColors::New ();
42 map->SetInput (reader->GetOutput());
43 map->SetLookupTable (reader->GetLookupTable());
44 map->SetOutputFormatToRGB();
45 output = map->GetOutput();
50 output = reader->GetOutput();
54 output->Print( cout );
56 //////////////////////////////////////////////////////////
58 //if you wish you can export dicom to a vtk file
59 // this file will have the add of .tmp.dcm extention
60 std::string fileName = argv[1];
61 fileName += ".tmp.dcm";
63 vtkGdcmWriter *writer = vtkGdcmWriter::New();
64 writer->SetFileName(fileName.c_str());
65 writer->SetInput(output);
67 //////////////////////////////////////////////////////////