Program: gdcm
Module: $RCSfile: TestBuildUpDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/10/18 08:35:46 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2006/04/11 16:05:03 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
{
if (argc)
{
- std::cerr << "Usage: " << argv[0] << " dummy ";
+ std::cerr << "Usage: " << argv[0] << " dummy " << std::endl;
}
-
+
+ //gdcm::Debug::DebugOn();
+
+ bool errorFound = false;
gdcm::DicomDir *dcmdir;
std::string dirName;
- dcmdir = new gdcm::DicomDir();
+ dcmdir = gdcm::DicomDir::New();
gdcm::DicomDirPatient *p1;
// --- Forget these 4 lines :
s11 = p1->NewStudy();
s11->SetEntryString("StudyDescrOne.One_",0x0008, 0x1030);
// we know entry (0008,1060) is not yet created
- s11->InsertEntryString("Dr Mabuse", 0x0008, 0x1060);
+ s11->InsertEntryString("Dr^Mabuse", 0x0008, 0x1060, "PN");
// fill here other Study characteristics
gdcm::DicomDirStudy *s12 = p1->NewStudy();
s12->SetEntryString("StudyDescrOne.Two",0x0008, 0x1030);
- s12->InsertEntryString("Dr Zorglub", 0x0008, 0x1060);
+ s12->InsertEntryString("Dr^Zorglub", 0x0008, 0x1060, "PN");
// fill here other Study characteristics
gdcm::DicomDirStudy *s13 = p1->NewStudy();
s13->SetEntryString("StudyDescrOne.Tree",0x0008, 0x1030);
- s13->InsertEntryString("Dr Follamour", 0x0008, 0x1060);
+ s13->InsertEntryString("Dr^Follamour", 0x0008, 0x1060, "PN");
// fill here other Study characteristics
gdcm::DicomDirSerie *s111;
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete dcmdir;
+ dcmdir->Delete();
return 1;
}
// Write it on disc
dcmdir->Write("NewDICOMDIR");
- delete dcmdir;
+
+ dcmdir->Delete();
// Read the newly written DicomDir
- gdcm::DicomDir *newDicomDir = new gdcm::DicomDir();
+ gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
newDicomDir->SetFileName("NewDICOMDIR");
newDicomDir->Load( );
if( !newDicomDir->IsReadable() )
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
// Check some value we are sure
{
std::cout << "A patient is missing in written DicomDir"
<< std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
<< "----------Final Check ---------------------"
<<std::endl;
- bool errorFound = false;
std::string valueStuff;
for (;;) // exit on 'break'
{
<< "]" << std::endl;
valueStuff = s11->GetEntryString(0x0008, 0x1060);
- if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Mabuse") )
+std::cout << "----------------length-----------------" << valueStuff.length() <<
+std::endl;
+ if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Mabuse") )
{
std::cout << "2 : 0x0008,0x1060 ["
<< s11->GetEntryString(0x0008,0x1060)
errorFound = true;
break;
}
- std::cout << "Pysician : ["
+ std::cout << "Physician : ["
<< valueStuff
<< "]" << std::endl;
if ( (s12 = p1->GetNextStudy()) == 0 )
<< "]" << std::endl;
if ( gdcm::Util::DicomStringEqual(s12->GetEntryString(0x0008,
- 0x1060),"Dr Zorglub " ))
+ 0x1060),"Dr^Zorglub " ))
{
std::cout << "4 0x0008,0x1060 ["
<< s12->GetEntryString(0x0008,0x1060)
errorFound = true;
break;
}
- std::cout << "Pysician : ["
+ std::cout << "___________________________________" << std::endl;
+ std::cout << "Pysician Reading Study: ["
<< s12->GetEntryString(0x0008,0x1060)
<< "]" << std::endl;
<< "]" << std::endl;
valueStuff = s13->GetEntryString(0x0008, 0x1060);
- if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr Follamour") )
+ if (!gdcm::Util::DicomStringEqual(valueStuff, "Dr^Follamour") )
{
std::cout << "5 0x0008,0x1060 ["
<< valueStuff
errorFound = true;
break;
}
-/*
- if ( s1111->GetEntryString(0x0004,0x1500) != "imageFileName1111 " )
- {
- errorFound = true;
- break;
- }
-*/
+
if ( (s1112 = s111->GetNextImage()) == 0 )
{
std::cout << "missing image S1112" << std::endl;
errorFound = true;
break;
}
-/*
- if ( s1112->GetEntryString(0x0004,0x1500) != "imageFileName1112 " )
- {
- errorFound = true;
- break;
- }
- */
- break; // No error found. Stop looping
+
+ break; // No error found. Stop looping
}
- delete newDicomDir;
if ( errorFound )
{
std::cout << "MissWritting / MissReading " << std::endl;
- std::cout<<std::flush;
- return(1);
}
std::cout<<std::flush;
- return 0;
+ newDicomDir->Delete();
+
+ return errorFound;
}