Program: gdcm
Module: $RCSfile: TestMakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/02/02 10:41:10 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2005/10/25 14:52:31 $
+ 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
int TestMakeDicomDir(int argc, char *argv[])
{
-// gdcm::Debug::DebugOn();
+ //gdcm::Debug::DebugOn();
std::string dirName;
if (argc > 1)
{
dirName = GDCM_DATA_ROOT;
}
+
+ gdcm::DicomDir *dcmdir;
- // we ask for Directory parsing
- gdcm::DicomDir *dcmdir = new gdcm::DicomDir(dirName, true);
+ // new style (user is allowed no to load Sequences an/or Shadow Groups)
+ dcmdir = gdcm::DicomDir::New( );
+
+ // dcmdir->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
+ // some images have a wrong length for element 0x0000 of private groups
+ dcmdir->SetLoadMode(gdcm::LD_NOSEQ);
+ dcmdir->SetDirectoryName(dirName);
+ dcmdir->Load( );
- dcmdir->SetStartMethod(StartMethod, (void *) NULL);
+ dcmdir->SetStartMethod(StartMethod);
dcmdir->SetEndMethod(EndMethod);
if ( !dcmdir->GetFirstPatient() )
std::cout << "makeDicomDir: no patient found. Exiting."
<< std::endl;
- delete dcmdir;
+ dcmdir->Delete();
return 1;
}
// Create the corresponding DicomDir
- dcmdir->WriteDicomDir("NewDICOMDIR");
- delete dcmdir;
+ dcmdir->Write("NewDICOMDIR");
+ dcmdir->Delete();
// Read from disc the just written DicomDir
- gdcm::DicomDir *newDicomDir = new gdcm::DicomDir("NewDICOMDIR");
+ gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
+ newDicomDir->SetFileName("NewDICOMDIR");
+ newDicomDir->Load();
+
if( !newDicomDir->IsReadable() )
{
std::cout<<" Written DicomDir 'NewDICOMDIR'"
<<" is not readable"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return 1;
}
<<" has no patient"<<std::endl
<<" ...Failed"<<std::endl;
- delete newDicomDir;
+ newDicomDir->Delete();
return(1);
}
std::cout<<std::flush;
-
- delete newDicomDir;
+ newDicomDir->Delete();
return 0;
}