Program: gdcm
Module: $RCSfile: VTKTestRead.cxx,v $
Language: C++
- Date: $Date: 2005/01/19 14:45:40 $
- Version: $Revision: 1.4 $
+ Date: $Date: 2007/09/18 07:58:38 $
+ Version: $Revision: 1.15 $
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 "vtkImageAppendComponents.h"
#include "vtkImageShiftScale.h"
+#include "vtkPNGWriter.h"
+
#include <iostream>
+#include <sstream>
//Generated file:
#include "gdcmDataImages.h"
#endif
int VTKReadTest(vtkTesting *t,vtkImageViewer *viewer,
- std::string const & filename,
- std::string const & referenceFileName,
- bool show )
+ 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");
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::File 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 );
// Set an unsigned char image
// Shift/Scale the image
- image->Update();
vtkImageShiftScale *iss=vtkImageShiftScale::New();
iss->SetInput(image);
iss->SetOutputScalarTypeToUnsignedChar();
//----------------------------------------------------------------------
// make test
- ostrstream str;
+ std::ostringstream str;
retVal = t->RegressionTest(image,0.0,str);
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 = VTKReadTest(t,viewer,argv[1+show],argv[2+show],show);
+ ret = VTKReadTest(t,viewer,argv[1+show],argv[2+show]);
t->Delete();
if( viewer )
viewer->Delete();
return ret;
}
+
+ //gdcm::Debug::DebugOn(); // Comment out when no bug is to be tracked
// Test for all images
int i = 0;
pngfile.insert( 0, "Baseline/");
//std::cerr << "PNG file: " << pngfile << std::endl;
- ret += VTKReadTest(t,viewer,filename,pngfile,show);
+ ret += VTKReadTest(t,viewer,filename,pngfile);
}
t->Delete();
if( viewer )