]> Creatis software - gdcm.git/blobdiff - vtk/vtkgdcmViewer.cxx
ENH: Afterall change my mind we need a common place: gdcmJpeg to define the reading...
[gdcm.git] / vtk / vtkgdcmViewer.cxx
index f1c1c32f5d8ca558a56df9f704ea0e153127699c..3f64b40b02ff95ccde180c0206b822613959b4c9 100644 (file)
@@ -1,3 +1,17 @@
+// This example illustrates how the vtkGdcmReader vtk class can be
+// used in order to:
+//  * produce a simple (vtk based) Dicom image STACK VIEWER.
+//  * dump the stack considered as a volume in a vtkStructuredPoints
+//    vtk file: the vtk gdcm wrappers can be seen as a simple way to convert
+//    a stack of Dicom images into a native vtk volume.
+//
+// Usage:
+//  * the filenames of the Dicom images constituting the stack should be
+//    given as command line arguments,
+//  * you can navigate through the stack by hitting any character key,
+//  * the produced vtk file is named "foo.vtk" (in the invocation directory).
+// 
+//----------------------------------------------------------------------------
 #include <iostream>
 
 #include <vtkRenderWindowInteractor.h>
@@ -27,7 +41,7 @@ class vtkgdcmObserver : public vtkCommand
     {
       this->ImageViewer = NULL;
     }
-  virtual void Execute(vtkObject *wdg, unsigned long event, void* calldata)
+  virtual void Execute(vtkObject *, unsigned long event, void* )
     {
       if ( this->ImageViewer )
         {
@@ -51,6 +65,7 @@ int main(int argc, char *argv[])
     return 0;
   
   vtkGdcmReader *reader = vtkGdcmReader::New();
+  reader->AllowLookupTableOff();
 
   if( argc == 2 )
     reader->SetFileName( argv[1] );
@@ -68,7 +83,7 @@ int main(int argc, char *argv[])
 
   vtkImageViewer2 *viewer = vtkImageViewer2::New();
   
-/*  if( reader->GetLookupTable() )
+  if( reader->GetLookupTable() )
   {
     //convert to color:
     vtkImageMapToColors *map = vtkImageMapToColors::New ();
@@ -78,14 +93,13 @@ int main(int argc, char *argv[])
     viewer->SetInput ( map->GetOutput() );
     map->Delete();
   }
-  else*/
-  
+  else
   {
     viewer->SetInput ( reader->GetOutput() );
   }
   viewer->SetupInteractor (iren);
   
-  vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
+  //vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
   //viewer->SetColorWindow (range[1] - range[0]);
   //viewer->SetColorLevel (0.5 * (range[1] + range[0]));