Program: gdcm
Module: $RCSfile: MakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2006/01/18 10:20:56 $
- Version: $Revision: 1.19 $
+ Date: $Date: 2007/05/23 14:18:04 $
+ Version: $Revision: 1.24 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDebug.h"
#include "gdcmArgMgr.h"
+//#include <sys/times.h> // Linux Only
+
#include <iostream>
/**
" 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' ",
+ " debug : developper wants to run the program in 'debug mode' ",
" check : the dicomdir is checked as 'gdcm readable' ",
FINISH_USAGE
// ----- Initialize Arguments Manager ------
- gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+ GDCM_NAME_SPACE::ArgMgr *am = new GDCM_NAME_SPACE::ArgMgr(argc, argv);
if (argc == 1 || am->ArgMgrDefined("usage"))
{
return 0;
}
- char *dirName;
- dirName = am->ArgMgrGetString("dirName",(char *)".");
+ const char *dirName;
+ dirName = am->ArgMgrGetString("dirName",".");
- char *name;
- name = am->ArgMgrGetString("name",(char *)"DICOMDIR");
+ const char *name;
+ name = am->ArgMgrGetString("name","DICOMDIR");
- int loadMode = gdcm::LD_ALL;
+ int loadMode = GDCM_NAME_SPACE::LD_ALL;
if ( am->ArgMgrDefined("noshadowseq") )
- loadMode |= gdcm::LD_NOSHADOWSEQ;
+ loadMode |= GDCM_NAME_SPACE::LD_NOSHADOWSEQ;
else
{
if ( am->ArgMgrDefined("noshadow") )
- loadMode |= gdcm::LD_NOSHADOW;
+ loadMode |= GDCM_NAME_SPACE::LD_NOSHADOW;
if ( am->ArgMgrDefined("noseq") )
- loadMode |= gdcm::LD_NOSEQ;
+ loadMode |= GDCM_NAME_SPACE::LD_NOSEQ;
}
if (am->ArgMgrDefined("debug"))
- gdcm::Debug::DebugOn();
+ GDCM_NAME_SPACE::Debug::DebugOn();
int check = am->ArgMgrDefined("check");
// ----- Begin Processing -----
- gdcm::DicomDir *dcmdir;
-
+ GDCM_NAME_SPACE::DicomDir *dcmdir;
+
// we ask for Directory parsing
- dcmdir = gdcm::DicomDir::New( );
+ dcmdir = GDCM_NAME_SPACE::DicomDir::New( );
dcmdir->SetLoadMode(loadMode);
dcmdir->SetDirectoryName(dirName);
//dcmdir->SetParseDir(true);
- dcmdir->Load();
+
+ // struct tms tms1, tms2; // Time measurements
+ // times(&tms1);
+
+ dcmdir->Load(); // Reads all the files and creates the GDCM_NAME_SPACE::DicomDir
+
+ //times(&tms2);
+ //std::cout
+ // << (long) ((tms2.tms_utime) - (tms1.tms_utime))
+ // << std::endl;
- if ( gdcm::Debug::GetDebugFlag() )
+ if ( GDCM_NAME_SPACE::Debug::GetDebugFlag() )
std::cout << "======================= End Parsing Directory" << std::endl;
// ----- Check the result
return 1;
}
- // ----- Create the corresponding DicomDir
+ // ----- Writes the corresponding DICOMDIR file (from the GDCM_NAME_SPACE::DicomDir)
dcmdir->Write(name);
dcmdir->Delete();
if (check)
{
- if ( gdcm::Debug::GetDebugFlag() )
+ if ( GDCM_NAME_SPACE::Debug::GetDebugFlag() )
std::cout << "======================= End Writting DICOMDIR"
<< std::endl;
// Read from disc the just written DicomDir
- gdcm::DicomDir *newDicomDir = gdcm::DicomDir::New();
+ GDCM_NAME_SPACE::DicomDir *newDicomDir = GDCM_NAME_SPACE::DicomDir::New();
newDicomDir->SetFileName( name );
newDicomDir->Load();
- if ( gdcm::Debug::GetDebugFlag() )
+ if ( GDCM_NAME_SPACE::Debug::GetDebugFlag() )
std::cout << "======================= End Parsing DICOMDIR"
<< std::endl;
if( !newDicomDir->IsReadable() )