Program: gdcm
Module: $RCSfile: TestImageSet.cxx,v $
Language: C++
- Date: $Date: 2005/03/02 16:39:28 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2005/07/08 13:39:57 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
// If there is sameSerie, sameStudy is set to true
int CompareImages(FileList &list, bool sameSerie, bool sameStudy)
{
+ gdcm::Debug::DebugOn();
+
if( sameSerie )
sameStudy = true;
list.clear();
}
-gdcm::File *WriteImage(gdcm::File *file,const std::string &fileName)
+gdcm::File *WriteImage(gdcm::File *file, const std::string &fileName)
{
// Create a 256x256x1 image 8 bits, unsigned
std::ostringstream str;
// Set the samples per pixel
file->InsertValEntry("1",0x0028,0x0002); // Samples per Pixel
- if( !file->IsReadable() )
- {
- std::cout << "Failed\n"
- << " Prepared image isn't readable\n";
- return NULL;
- }
+ // The so called 'prepared image', built ex nihilo just before,
+ // has NO Pixel Element yet.
+ // therefore, it's NEVER 'file readable' ...
+
+ //if( !file->IsReadable() )
+ // {
+ // std::cout << "Failed\n"
+ // << " Prepared image isn't readable\n";
+ // return NULL;
+ //}
size_t size = 256 * 256 * 1;
unsigned char *imageData = new unsigned char[size];
delete hlp;
// Read the written image
- gdcm::File *reread = new gdcm::File( fileName );
+ gdcm::File *reread = new gdcm::File( );
+ reread->SetFileName( fileName );
+ reread->Load();
if( !reread->IsReadable() )
{
std::cerr << "Failed" << std::endl
return reread;
}
-int TestSequence(int argc, char *argv[])
+int TestImageSet(int argc, char *argv[])
{
if (argc < 1)
{
serieUID = gdcm::Util::CreateUniqueUID();
file->InsertValEntry(serieUID, 0x0020, 0x000e);
- newFile = WriteImage(file,fileName.str());
+ newFile = WriteImage(file, fileName.str());
if( !newFile )
{
delete file;
delete file;
}
- if( CompareImages(fileList,false,false) )
+ if( CompareImages(fileList, false, false) )
{
ClearList(fileList);
return 1;
std::ostringstream fileName;
fileName << "FileSeq" << i << ".dcm";
file = new gdcm::File();
- file->InsertValEntry(studyUID,0x0020,0x000d);
- file->InsertValEntry(serieUID,0x0020,0x000e);
+ file->InsertValEntry(studyUID, 0x0020, 0x000d);
+ file->InsertValEntry(serieUID, 0x0020, 0x000e);
- newFile = WriteImage(file,fileName.str());
+ newFile = WriteImage(file, fileName.str());
if( !newFile )
{
delete file;
delete file;
}
- if( CompareImages(fileList,true,true) )
+ if( CompareImages(fileList, true, true) )
{
ClearList(fileList);
return 1;
std::ostringstream fileName;
fileName << "FileSeq" << i << ".dcm";
file = new gdcm::File();
- file->InsertValEntry(studyUID,0x0020,0x000d);
+ file->InsertValEntry(studyUID, 0x0020, 0x000d);
serieUID = gdcm::Util::CreateUniqueUID();
- file->InsertValEntry(serieUID,0x0020,0x000e);
- newFile = WriteImage(file,fileName.str());
+ file->InsertValEntry(serieUID, 0x0020, 0x000e);
+ newFile = WriteImage(file, fileName.str());
if( !newFile )
{
delete file;
delete file;
}
- if( CompareImages(fileList,false,true) )
+ if( CompareImages(fileList, false, true) )
{
ClearList(fileList);
return 1;