]> Creatis software - gdcm.git/blobdiff - vtk/vtkgdcmViewer2.cxx
Add a small utility to extract (and create DICOM images) the overlays from all the
[gdcm.git] / vtk / vtkgdcmViewer2.cxx
index 4c499166ebc8247c6d01f2b0cde698558ea5939c..99b64110e03bce93398e79ce9559f41a10348bc6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/08/30 15:13:10 $
-  Version:   $Revision: 1.5 $
+  Date:      $Date: 2006/05/11 20:01:28 $
+  Version:   $Revision: 1.8 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -68,10 +68,19 @@ public:
       {
          if ( event == vtkCommand::CharEvent )
          {
+#if (VTK_MAJOR_VERSION >= 5)
+            int max = ImageViewer->GetSliceMax();
+            int slice = (ImageViewer->GetSlice() + 1 ) % ++max;
+            ImageViewer->SetSlice( slice );
+#else
             int max = ImageViewer->GetWholeZMax();
             int slice = (ImageViewer->GetZSlice() + 1 ) % ++max;
             ImageViewer->SetZSlice( slice );
+#endif
+#if !( (VTK_MAJOR_VERSION >= 5) || ( VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION >= 5 ) )
+         // This used to be a bug in version VTK 4.4 and earlier
             ImageViewer->GetRenderer()->ResetCameraClippingRange();
+#endif
             ImageViewer->Render();
          }
       }
@@ -117,6 +126,12 @@ int main(int argc, char *argv[])
    }
    else
    {
+   
+   // For a single medical image, it would be more efficient to use
+   // 0028|1050 [DS] [Window Center]
+   // 0028|1051 [DS] [Window Width]
+   // but vtkgdcmReader doesn't know about them :-(
+
       vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange();
       viewer->SetColorLevel (0.5 * (range[1] + range[0]));
       viewer->SetColorWindow (range[1] - range[0]);