X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FAnonymizeNoLoad.cxx;h=5e66ae8203208ccc6f0de3e135f64592a9e92aeb;hb=70502c22fe6a622c3bf335f27f9db7ba553e8190;hp=3fa8500583f2e5cbf000660614440308e99440c9;hpb=f3cc252fad08c3e8dbc395f2ca7cabf47bf95302;p=gdcm.git diff --git a/Example/AnonymizeNoLoad.cxx b/Example/AnonymizeNoLoad.cxx index 3fa85005..5e66ae82 100644 --- a/Example/AnonymizeNoLoad.cxx +++ b/Example/AnonymizeNoLoad.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: AnonymizeNoLoad.cxx,v $ Language: C++ - Date: $Date: 2005/08/30 15:13:05 $ - Version: $Revision: 1.12 $ + Date: $Date: 2006/07/17 13:25:00 $ + Version: $Revision: 1.18 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -29,8 +29,8 @@ int main(int argc, char *argv[]) { START_USAGE(usage) "\n AnonymizeNoLoad :\n ", - "Anonymize a gdcm-readable Dicom image even if pixels aren't gdcm readable ", - " Warning : Warning : the image is overwritten ", + "Anonymize a gdcm-parsable Dicom image even if pixels aren't gdcm readable ", + " Warning : the image is OVERWRITTEN ", " to preserve image integrity, use a copy. ", "usage: AnonymizeNoLoad {filein=inputFileName|dirin=inputDirectoryName} ", " [rubout=listOfElementsToRubOut] ", @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) " 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' ", FINISH_USAGE // ----- Initialize Arguments Manager ------ @@ -60,8 +60,8 @@ int main(int argc, char *argv[]) if (am->ArgMgrDefined("debug")) gdcm::Debug::DebugOn(); - char *fileName = am->ArgMgrGetString("filein",(char *)0); - char *dirName = am->ArgMgrGetString("dirin",(char *)0); + const char *fileName = am->ArgMgrGetString("filein"); + const char *dirName = am->ArgMgrGetString("dirin"); if ( (fileName == 0 && dirName == 0) || @@ -80,8 +80,8 @@ int main(int argc, char *argv[]) loadMode |= gdcm::LD_NOSHADOWSEQ; else { - if ( am->ArgMgrDefined("noshadow") ) - loadMode |= gdcm::LD_NOSHADOW; + if ( am->ArgMgrDefined("noshadow") ) + loadMode |= gdcm::LD_NOSHADOW; if ( am->ArgMgrDefined("noseq") ) loadMode |= gdcm::LD_NOSEQ; } @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) // // Parse the input file. // - f = new gdcm::File( ); + f = gdcm::File::New( ); f->SetLoadMode(loadMode); f->SetFileName( fileName ); @@ -119,7 +119,7 @@ int main(int argc, char *argv[]) << "Sorry, " << fileName <<" not a gdcm-readable " << "DICOM / ACR Document" << std::endl; - delete f; + f->Delete(); return 1; } std::cout << fileName << " is readable " << std::endl; @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) // Patient's ID f->AddAnonymizeElement( 0x0010, 0x0020,"1515" ); // Patient's Birthdate - f->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" ); + f->AddAnonymizeElement( 0x0010, 0x0030,"11111111" ); // Patient's Adress f->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" ); // Patient's Mother's Birth Name @@ -179,7 +179,7 @@ int main(int argc, char *argv[]) // f->ClearAnonymizeList(); - delete f; + f->Delete(); return 0; } @@ -192,13 +192,13 @@ int main(int argc, char *argv[]) it != fileList.end(); ++it ) { - f = new gdcm::File( ); + f = gdcm::File::New( ); f->SetLoadMode(loadMode); f->SetFileName( it->c_str() ); if ( !f->Load() ) { - delete f; + f->Delete(); continue; } // @@ -212,7 +212,7 @@ int main(int argc, char *argv[]) // Patient's ID f->AddAnonymizeElement( 0x0010, 0x0020,"1515" ); // Patient's Birthdate - f->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" ); + f->AddAnonymizeElement( 0x0010, 0x0030,"11111111" ); // Patient's Adress f->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" ); // Patient's Mother's Birth Name @@ -243,10 +243,9 @@ int main(int argc, char *argv[]) f->ClearAnonymizeList(); - delete f; - } - - } + f->Delete(); + } + } return 0; }