]> Creatis software - gdcm.git/blobdiff - vtk/vtkgdcmViewer2.cxx
Move comments
[gdcm.git] / vtk / vtkgdcmViewer2.cxx
index bb3b8f865c7463be23a4689710506414b450fc7d..99b64110e03bce93398e79ce9559f41a10348bc6 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer2.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/11 14:40:58 $
-  Version:   $Revision: 1.2 $
+  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
@@ -39,6 +39,7 @@
 #include <vtkLookupTable.h>
 
 #include "vtkGdcmReader.h"
+#include "gdcmDocument.h"  // for NO_SHADOWSEQ
 
 #ifndef vtkFloatingPointType
 #define vtkFloatingPointType float
@@ -67,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();
          }
       }
@@ -93,6 +103,8 @@ int main(int argc, char *argv[])
       for(int i=1; i< argc; i++)
          reader->AddFileName( argv[i] );
 
+// TODO : allow user to choose Load Mode
+   reader->SetLoadMode(gdcm::LD_NOSHADOWSEQ);  
    reader->Update();
 
    //print debug info:
@@ -114,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]);