]> Creatis software - gdcm.git/blobdiff - vtk/vtkgdcmViewer.cxx
upgrades for 4DSplitter
[gdcm.git] / vtk / vtkgdcmViewer.cxx
index 82dfd691b8c9e166345c1be315aad66541700386..6d2751a6b90218f8c82512260cd4200061371780 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: vtkgdcmViewer.cxx,v $
   Language:  C++
-  Date:      $Date: 2007/06/19 13:09:45 $
-  Version:   $Revision: 1.29 $
+  Date:      $Date: 2011/03/29 07:36:02 $
+  Version:   $Revision: 1.33 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -70,7 +70,6 @@ public:
             int max = ImageViewer->GetWholeZMax();
             int slice = (ImageViewer->GetZSlice() + 1 ) % ++max;
             ImageViewer->SetZSlice( slice );
-            ImageViewer->GetRenderer()->ResetCameraClippingRange();
             ImageViewer->Render();
          }
       }
@@ -97,6 +96,18 @@ int main(int argc, char *argv[])
    reader->SetLoadMode(GDCM_NAME_SPACE::LD_NOSHADOWSEQ);  
    reader->Update();
 
+
+
+std::cout << "[0][0]==========" <<
+reader->GetOutput()->GetScalarComponentAsFloat(0,0,0,0) <<
+"===================="
+<< std::endl;
+std::cout << "[127][127]==========" <<
+reader->GetOutput()->GetScalarComponentAsFloat(0,127,0,0) <<
+"===================="
+<< std::endl;
+
+
    //print debug info:
    reader->GetOutput()->Print( cout );
 
@@ -116,6 +127,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]);
@@ -138,12 +155,21 @@ int main(int argc, char *argv[])
    iren->Initialize();
    iren->Start();
 
-   //if you wish you can export dicom to a vtk file  
+   //if you wish you can export dicom to a vtk file
    vtkStructuredPointsWriter *writer = vtkStructuredPointsWriter::New();
    writer->SetInput( reader->GetOutput());
    writer->SetFileName( "foo.vtk" );
    writer->SetFileTypeToBinary();
    //writer->Write();
+   
+std::cout << "==========" << std::endl;
+   
+std::cout << "==========" <<
+reader->GetOutput()->GetScalarComponentAsFloat(0,0,0,0) <<
+"===================="
+<< std::endl;
+     
+   
 
    reader->Delete();
    iren->Delete();