X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=vtk%2FvtkgdcmViewer.cxx;h=3f64b40b02ff95ccde180c0206b822613959b4c9;hb=59e65d18af23304dfdaca6b5fb488e74bbe4755a;hp=e0a17943fa76e999a7a0ac8f4875d7c034f5eb9e;hpb=c11dce1faf0053eb984aed57f01e6b7d29cbd1ab;p=gdcm.git diff --git a/vtk/vtkgdcmViewer.cxx b/vtk/vtkgdcmViewer.cxx index e0a17943..3f64b40b 100644 --- a/vtk/vtkgdcmViewer.cxx +++ b/vtk/vtkgdcmViewer.cxx @@ -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 #include @@ -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] ); @@ -62,11 +77,12 @@ int main(int argc, char *argv[]) reader->Update(); //print debug info: - reader->GetOutput()->Print( std::cout ); + reader->GetOutput()->Print( cout ); vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New(); vtkImageViewer2 *viewer = vtkImageViewer2::New(); + if( reader->GetLookupTable() ) { //convert to color: @@ -83,9 +99,9 @@ int main(int argc, char *argv[]) } viewer->SetupInteractor (iren); - vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange(); - viewer->SetColorWindow (range[1] - range[0]); - viewer->SetColorLevel (0.5 * (range[1] + range[0])); + //vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange(); + //viewer->SetColorWindow (range[1] - range[0]); + //viewer->SetColorLevel (0.5 * (range[1] + range[0])); // Here is where we setup the observer, vtkgdcmObserver *obs = vtkgdcmObserver::New();