X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Testing%2FVTKTestReadSeq.cxx;h=7cd5166ad8a6d5418d0a1b5fd5a149c0b9ebffbd;hb=e161f58fb8f791137c7cc5e54e79982850fe246d;hp=773c9671a0bf92192dbebaa855cc117c8856db1d;hpb=a9405cdbae88cf5bef6f6fa5883d2502563c3914;p=gdcm.git diff --git a/Testing/VTKTestReadSeq.cxx b/Testing/VTKTestReadSeq.cxx index 773c9671..7cd5166a 100644 --- a/Testing/VTKTestReadSeq.cxx +++ b/Testing/VTKTestReadSeq.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: VTKTestReadSeq.cxx,v $ Language: C++ - Date: $Date: 2005/01/19 13:50:11 $ - Version: $Revision: 1.3 $ + Date: $Date: 2005/02/09 15:31:15 $ + Version: $Revision: 1.10 $ 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 "gdcmFile.h" #include "vtkGdcmReader.h" #include "vtkImageViewer.h" #include "vtkImageData.h" @@ -34,10 +33,9 @@ #define vtkFloatingPointType float #endif -int VTKReadSeqTest(vtkTesting *t,vtkImageViewer *viewer, - std::string const & filename, - std::string const & referenceFileName, - bool show ) +int VTKReadSeqTest(vtkTesting *t, vtkImageViewer *viewer, + std::string const &filename, + std::string const &referenceFileName) { int retVal = 0; //by default this is an error @@ -64,12 +62,15 @@ int VTKReadSeqTest(vtkTesting *t,vtkImageViewer *viewer, delete[] newFileDcm; reader->Update(); - if( show ) + double range[2]; + reader->GetOutput()->GetScalarRange(range); + + // Show + if( viewer ) { viewer->SetInput ( reader->GetOutput() ); viewer->OffScreenRenderingOff(); - vtkFloatingPointType *range = reader->GetOutput()->GetScalarRange(); viewer->SetColorWindow (range[1] - range[0]); viewer->SetColorLevel (0.5 * (range[1] + range[0])); @@ -126,12 +127,11 @@ int VTKReadSeqTest(vtkTesting *t,vtkImageViewer *viewer, // Set an unsigned char image // Shift/Scale the image image->Update(); - double *rng=image->GetScalarRange(); vtkImageShiftScale *iss=vtkImageShiftScale::New(); iss->SetInput(image); iss->SetOutputScalarTypeToUnsignedChar(); - iss->SetShift(-rng[0]); - iss->SetScale(255.0/(rng[1]-rng[0])); + iss->SetShift(-range[0]); + iss->SetScale(255.0/(range[1]-range[0])); iss->ClampOverflowOn(); image->UnRegister(NULL); @@ -197,7 +197,7 @@ int VTKTestReadSeq(int argc, char *argv[]) } int ret = 0; - vtkTesting* t = vtkTesting::New(); + vtkTesting *t = vtkTesting::New(); vtkImageViewer *viewer; if( show ) viewer = vtkImageViewer::New(); @@ -214,7 +214,7 @@ int VTKTestReadSeq(int argc, char *argv[]) } else { - ret = VTKReadSeqTest(t,viewer,argv[1+show],argv[2+show],show); + ret = VTKReadSeqTest(t,viewer,argv[1+show],argv[2+show]); t->Delete(); if( viewer ) viewer->Delete(); @@ -237,7 +237,7 @@ int VTKTestReadSeq(int argc, char *argv[]) pngfile = pngfile.substr(0, dot_pos).append( ".png" ); pngfile.insert( 0, "Baseline/"); - ret += VTKReadSeqTest(t,viewer,filename,pngfile,show); + ret += VTKReadSeqTest(t,viewer,filename,pngfile); } t->Delete(); if( viewer )