X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=vtk%2FvtkgdcmViewer.cxx;h=39b7c6c85588db451b7cdf17d925b2b9091c2728;hb=9fbd2a1441b5584a66a9422f4db9ff4722c48fac;hp=6526c1753482d7afafc3bccfd37eda4ab7476788;hpb=1d1824283002d1fcc3b8ff98170fc879c17f108f;p=gdcm.git diff --git a/vtk/vtkgdcmViewer.cxx b/vtk/vtkgdcmViewer.cxx index 6526c175..39b7c6c8 100644 --- a/vtk/vtkgdcmViewer.cxx +++ b/vtk/vtkgdcmViewer.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: vtkgdcmViewer.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 20:10:50 $ - Version: $Revision: 1.24 $ + Date: $Date: 2007/08/28 09:41:39 $ + Version: $Revision: 1.30 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -39,7 +39,7 @@ #include #include "vtkGdcmReader.h" - +#include "gdcmDocument.h" // for NO_SHADOWSEQ #ifndef vtkFloatingPointType #define vtkFloatingPointType float #endif @@ -67,10 +67,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 +102,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_NAME_SPACE::LD_NOSHADOWSEQ); reader->Update(); //print debug info: @@ -114,7 +125,13 @@ int main(int argc, char *argv[]) } else { - double *range = reader->GetOutput()->GetScalarRange(); + + // 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]);