Program: gdcm
Module: $RCSfile: MakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/07/08 10:15:04 $
- Version: $Revision: 1.9 $
+ Date: $Date: 2005/11/28 17:09:22 $
+ Version: $Revision: 1.17 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDicomDirPatient.h"
#include "gdcmDirList.h"
#include "gdcmDebug.h"
-
#include "gdcmArgMgr.h"
#include <iostream>
-// ---
-void StartMethod(void *toto) {
- (void)toto;
- std::cout<<"Start parsing"<<std::endl;
-}
-
-void EndMethod(void *toto) {
- (void)toto;
- std::cout<<"End parsing"<<std::endl;
-}
-// ---
-
/**
* \brief Explores recursively the given directory
* orders the gdcm-readable found Files
int main(int argc, char *argv[])
{
START_USAGE(usage)
- " \n MakeDicomDir :\n",
- " Explores recursively the given directory, makes the relevant DICOMDIR",
- " and writes it as 'NewDICOMDIR'",
- " usage: MakeDicomDir dirname=rootDirectoryName [noshadowseq][noshadow][noseq] [debug] ",
- " noshadowseq: user doesn't want to load Private Sequences",
- " noshadow : user doesn't want to load Private groups (odd number)",
- " noseq : user doesn't want to load Sequences ",
- " debug : user wants to run the program in 'debug mode' ",
+ " \n MakeDicomDir :\n ",
+ " Explores recursively the given directory, makes the relevant DICOMDIR ",
+ " and writes it as 'NewDICOMDIR' ",
+ " ",
+ " usage: MakeDicomDir dirname=rootDirectoryName ",
+ " [noshadowseq][noshadow][noseq] [debug] ",
+ " ",
+ " noshadowseq: user doesn't want to load Private Sequences ",
+ " noshadow : user doesn't want to load Private groups (odd number) ",
+ " noseq : user doesn't want to load Sequences ",
+ " debug : user wants to run the program in 'debug mode' ",
FINISH_USAGE
// ----- Initialize Arguments Manager ------
char *dirName;
dirName = am->ArgMgrGetString("dirName",(char *)".");
- int loadMode = 0x00000000;
+ int loadMode = gdcm::LD_ALL;
if ( am->ArgMgrDefined("noshadowseq") )
- loadMode |= NO_SHADOWSEQ;
+ loadMode |= gdcm::LD_NOSHADOWSEQ;
else
{
if ( am->ArgMgrDefined("noshadow") )
- loadMode |= NO_SHADOW;
+ loadMode |= gdcm::LD_NOSHADOW;
if ( am->ArgMgrDefined("noseq") )
- loadMode |= NO_SEQ;
+ loadMode |= gdcm::LD_NOSEQ;
}
if (am->ArgMgrDefined("debug"))
// we ask for Directory parsing
- dcmdir = new gdcm::DicomDir( );
-
- dcmdir->SetStartMethod(StartMethod, (void *) NULL);
- dcmdir->SetEndMethod(EndMethod);
+ dcmdir = gdcm::DicomDir::New( );
dcmdir->SetLoadMode(loadMode);
dcmdir->SetDirectoryName(dirName);
-dcmdir->SetParseDir(true);
+ //dcmdir->SetParseDir(true);
dcmdir->Load();
// ----- Check the result
{
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;
}