X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FPatchHeader.cxx;h=56bd952613e15ac4a1ee1f81fe4125ca4d01e14b;hb=2e0fae6ec87d9ecb1b76b32d8242a4fba9afefd3;hp=d9d5e3393fd1a3229a13fb2b91187415458fd45e;hpb=98f9b12c49d30369af3fed4b7d6c41d7dd0ef1ae;p=gdcm.git diff --git a/Example/PatchHeader.cxx b/Example/PatchHeader.cxx index d9d5e339..56bd9526 100644 --- a/Example/PatchHeader.cxx +++ b/Example/PatchHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: PatchHeader.cxx,v $ Language: C++ - Date: $Date: 2005/08/28 17:27:00 $ - Version: $Revision: 1.2 $ + Date: $Date: 2007/05/23 14:18:04 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -36,7 +36,7 @@ // global variables will be seen inside any function. -gdcm::File *f; +GDCM_NAME_SPACE::File *f; std::fstream *fp; uint16_t samplesperpixel; @@ -50,21 +50,21 @@ uint16_t bitsstored; uint16_t highbit; uint16_t pixelrepresentation; -bool bsamplesperpixel; -bool bplanarconfiguration; -bool bsize; -bool brows; -bool bcolumns; -bool bplanes; -bool bbitsallocated; -bool bbitsstored; -bool bhighbit; -bool bpixelrepresentation; +int bsamplesperpixel; +int bplanarconfiguration; +int bsize; +int brows; +int bcolumns; +int bplanes; +int bbitsallocated; +int bbitsstored; +int bhighbit; +int bpixelrepresentation; void update() { uint32_t offset; - gdcm::DocEntry *d; + GDCM_NAME_SPACE::DocEntry *d; // // Fields to replace. // @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) // ----- Initialize Arguments Manager ------ - gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv); + GDCM_NAME_SPACE::ArgMgr *am = new GDCM_NAME_SPACE::ArgMgr(argc, argv); if (am->ArgMgrDefined("usage") || argc == 1) { @@ -192,8 +192,8 @@ int main(int argc, char *argv[]) return 0; } - 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) || @@ -207,7 +207,7 @@ int main(int argc, char *argv[]) return 0; } -bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); + bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); if ( bsamplesperpixel ) samplesperpixel = am->ArgMgrWantInt("samplesperpixel",usage); @@ -262,17 +262,17 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); pixelrepresentation = am->ArgMgrWantInt("pixelrepresentation",usage); if (am->ArgMgrDefined("debug")) - gdcm::Debug::DebugOn(); + GDCM_NAME_SPACE::Debug::DebugOn(); - int loadMode = 0x00000000; + int loadMode = GDCM_NAME_SPACE::LD_ALL; if ( am->ArgMgrDefined("noshadowseq") ) - loadMode |= NO_SHADOWSEQ; + loadMode |= GDCM_NAME_SPACE::LD_NOSHADOWSEQ; else { - if ( am->ArgMgrDefined("noshadow") ) - loadMode |= NO_SHADOW; + if ( am->ArgMgrDefined("noshadow") ) + loadMode |= GDCM_NAME_SPACE::LD_NOSHADOW; if ( am->ArgMgrDefined("noseq") ) - loadMode |= NO_SEQ; + loadMode |= GDCM_NAME_SPACE::LD_NOSEQ; } /* if unused Param we give up */ @@ -288,33 +288,31 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); if ( fileName != 0 ) // ====== Deal with a single file ====== { - - // - // Parse the input file. - // - - f = new gdcm::File( ); + // + // Parse the input file. + // + f = GDCM_NAME_SPACE::File::New( ); f->SetLoadMode(loadMode); f->SetFileName( fileName ); bool res = f->Load(); - // gdcm::File::IsReadable() is no usable here, because we deal with - // any kind of gdcm::Readable *document* - // not only gdcm::File (as opposed to gdcm::DicomDir) + // GDCM_NAME_SPACE::File::IsReadable() is no usable here, because we deal with + // any kind of GDCM_NAME_SPACE::Readable *document* + // not only GDCM_NAME_SPACE::File (as opposed to GDCM_NAME_SPACE::DicomDir) if ( !res ) { - std::cout <Delete(); + return 1; } std::cout << fileName << " is readable " << std::endl; // // No need to load the pixels in memory. - // File will be overwritten + // File will be overwritten // // open the file @@ -325,27 +323,27 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); fp->close(); delete fp; - delete f; + f->Delete(); return 0; } else // ====== Deal with a (single Patient) Directory ====== { std::cout << "dirName [" << dirName << "]" << std::endl; - gdcm::DirList dirList(dirName,1); // gets recursively the file list - gdcm::DirListType fileList = dirList.GetFilenames(); - for( gdcm::DirListType::iterator it = fileList.begin(); + GDCM_NAME_SPACE::DirList dirList(dirName,1); // gets recursively the file list + GDCM_NAME_SPACE::DirListType fileList = dirList.GetFilenames(); + for( GDCM_NAME_SPACE::DirListType::iterator it = fileList.begin(); it != fileList.end(); ++it ) { - f = new gdcm::File( ); + f = GDCM_NAME_SPACE::File::New( ); f->SetLoadMode(loadMode); f->SetFileName( it->c_str() ); bool res = f->Load(); if ( !res ) { - delete f; + f->Delete(); continue; } @@ -357,8 +355,8 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); fp->close(); delete fp; - delete f; - } + f->Delete(); + } } return 0; }