X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FMakeDicomDir.cxx;h=e8ebe98394f3057f880fbdbb2fc6bebe0eba24e5;hb=4331b970c740503e6827e72a172101a86d630907;hp=4a14581f8d4175f4f76a65869aea7a2402b2ca98;hpb=1184bb0a9f829f36d0aecb170427259a10c2d4e7;p=gdcm.git diff --git a/Example/MakeDicomDir.cxx b/Example/MakeDicomDir.cxx index 4a14581f..e8ebe983 100644 --- a/Example/MakeDicomDir.cxx +++ b/Example/MakeDicomDir.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: MakeDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/06/15 09:54:49 $ - Version: $Revision: 1.6 $ + Date: $Date: 2005/08/31 09:29:10 $ + Version: $Revision: 1.15 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,7 +20,6 @@ #include "gdcmDicomDirPatient.h" #include "gdcmDirList.h" #include "gdcmDebug.h" - #include "gdcmArgMgr.h" #include @@ -48,19 +47,23 @@ void EndMethod(void *toto) { 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 [noshadow] [noseq] [debug] ", - " 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 ------ gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv); - if (am->ArgMgrDefined("usage")) + if (argc == 1 || am->ArgMgrDefined("usage")) { am->ArgMgrUsage(usage); // Display 'usage' delete am; @@ -70,15 +73,16 @@ int main(int argc, char *argv[]) char *dirName; dirName = am->ArgMgrGetString("dirName",(char *)"."); - int loadMode; - if ( am->ArgMgrDefined("noshadow") && am->ArgMgrDefined("noseq") ) - loadMode = NO_SEQ | NO_SHADOW; - else if ( am->ArgMgrDefined("noshadow") ) - loadMode = NO_SHADOW; - else if ( am->ArgMgrDefined("noseq") ) - loadMode = NO_SEQ; - else - loadMode = 0; + int loadMode = gdcm::LD_ALL; + if ( am->ArgMgrDefined("noshadowseq") ) + loadMode |= gdcm::LD_NOSHADOWSEQ; + else + { + if ( am->ArgMgrDefined("noshadow") ) + loadMode |= gdcm::LD_NOSHADOW; + if ( am->ArgMgrDefined("noseq") ) + loadMode |= gdcm::LD_NOSEQ; + } if (am->ArgMgrDefined("debug")) gdcm::Debug::DebugOn(); @@ -100,13 +104,14 @@ int main(int argc, char *argv[]) // we ask for Directory parsing dcmdir = new gdcm::DicomDir( ); - dcmdir->SetParseDir(true); - dcmdir->SetStartMethod(StartMethod, (void *) NULL); + dcmdir->SetStartMethod(StartMethod); dcmdir->SetEndMethod(EndMethod); dcmdir->SetLoadMode(loadMode); - dcmdir->Load(dirName); + dcmdir->SetDirectoryName(dirName); + //dcmdir->SetParseDir(true); + dcmdir->Load(); // ----- Check the result @@ -120,11 +125,13 @@ int main(int argc, char *argv[]) // ----- Create the corresponding DicomDir - dcmdir->WriteDicomDir("NewDICOMDIR"); + dcmdir->Write("NewDICOMDIR"); delete dcmdir; // Read from disc the just written DicomDir - gdcm::DicomDir *newDicomDir = new gdcm::DicomDir("NewDICOMDIR"); + gdcm::DicomDir *newDicomDir = new gdcm::DicomDir(); + newDicomDir->SetFileName( "NewDICOMDIR" ); + newDicomDir->Load(); if( !newDicomDir->IsReadable() ) { std::cout<<" Written DicomDir 'NewDICOMDIR'"