Program: gdcm
Module: $RCSfile: VTKTestReadSeq.cxx,v $
Language: C++
- Date: $Date: 2005/01/19 13:50:11 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2007/09/18 07:58:38 $
+ Version: $Revision: 1.12 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
-#include "gdcmFile.h"
#include "vtkGdcmReader.h"
#include "vtkImageViewer.h"
#include "vtkImageData.h"
#include "vtkImageShiftScale.h"
#include <iostream>
+#include <sstream>
//Generated file:
#include "gdcmDataSeqImages.h"
#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
+ int retVal; // = 0; (to avoid bcc 5.5 warnings)
// Set the reader
vtkGdcmReader *reader = vtkGdcmReader::New();
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]));
// make test
int ret = 0;
- ostrstream str;
+ std::ostringstream str;
char *newFilePng = new char[referenceFileName.size()+1];
for(int j=0;j<fileCount;j++)
{
// 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);
{
std::cerr << str.str();
}
- str.rdbuf()->freeze(1);
if( retVal == vtkTesting::PASSED )
{
}
int ret = 0;
- vtkTesting* t = vtkTesting::New();
+ vtkTesting *t = vtkTesting::New();
vtkImageViewer *viewer;
if( show )
viewer = vtkImageViewer::New();
}
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();
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 )