]> Creatis software - gdcm.git/blobdiff - Testing/VTKTestRead.cxx
make output more readable
[gdcm.git] / Testing / VTKTestRead.cxx
index 14dbb9ea31c5d8b7ba075b1fb83d0caa2188432d..186afda0caedc9b23db178bc32a07c3d51fe1535 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: VTKTestRead.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/01/25 11:25:32 $
-  Version:   $Revision: 1.7 $
+  Date:      $Date: 2005/11/21 10:06:47 $
+  Version:   $Revision: 1.13 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -15,7 +15,6 @@
      PURPOSE.  See the above copyright notices for more information.
                                                                                 
 =========================================================================*/
-#include "gdcmFileHelper.h"
 #include "vtkGdcmReader.h"
 #include "vtkImageViewer.h"
 #include "vtkImageData.h"
@@ -25,6 +24,8 @@
 #include "vtkImageAppendComponents.h"
 #include "vtkImageShiftScale.h"
 
+#include "vtkPNGWriter.h"
+
 #include <iostream>
 
 //Generated file:
 #endif
 
 int VTKReadTest(vtkTesting *t,vtkImageViewer *viewer,
-                std::string const & filename, 
-                std::string const & referenceFileName)
+                std::string const &filename, 
+                std::string const &referenceFileName)
 {
-   int retVal = 0;  //by default this is an error
+   int retVal; // = 0; (to avoid bcc5.5 warnings)
 
    t->CleanArguments();
    t->AddArgument("-D");
@@ -48,22 +49,12 @@ int VTKReadTest(vtkTesting *t,vtkImageViewer *viewer,
    t->AddArgument("-T");
    t->AddArgument( "." );
    
-   // Instead of directly reading the dicom let's write it down to another file
-   // do a scope to be sure everything gets cleanup
-   {
-      gdcm::FileHelper file( filename );
-      file.GetImageData();
-      file.SetWriteModeToRaw();
-      file.WriteDcmExplVR( "TestWrite.dcm" );
-   }
-   // Ok for now still use the original image, 
    vtkGdcmReader *reader = vtkGdcmReader::New();
-   //reader->SetFileName( filename.c_str() );
-   reader->SetFileName( "TestWrite.dcm" );
+   reader->SetFileName( filename.c_str() );
    reader->Update();
 
-   double *range=reader->GetOutput()->GetScalarRange();
+   double range[2];
+   reader->GetOutput()->GetScalarRange(range);
    int dim[3];
    reader->GetOutput()->GetDimensions( dim );
 
@@ -124,7 +115,6 @@ int VTKReadTest(vtkTesting *t,vtkImageViewer *viewer,
 
    // Set an unsigned char image
    // Shift/Scale the image 
-   image->Update();
    vtkImageShiftScale *iss=vtkImageShiftScale::New();
    iss->SetInput(image);
    iss->SetOutputScalarTypeToUnsignedChar();
@@ -192,7 +182,7 @@ int VTKTestRead(int argc, char *argv[])
    }
 
    int ret = 0;
-   vtkTestingt = vtkTesting::New();
+   vtkTesting *t = vtkTesting::New();
    vtkImageViewer *viewer;
    if( show )
       viewer = vtkImageViewer::New();
@@ -214,6 +204,8 @@ int VTKTestRead(int argc, char *argv[])
 
       return ret;
    }
+   
+   gdcm::Debug::DebugOn(); // Comment out when no bug is to be tracked
 
    // Test for all images
    int i = 0;