X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FPatchHeader.cxx;h=adc06698e0a5a82fed885c5db9196a00a732f342;hb=4725aeb3e10e02e1e0ad9ac18baf7cc6a3feed6d;hp=e1d8dd19e98d63e7013ae6b50996fddfbee89ac3;hpb=993bc33a54fcb6097d7f48488911881448c0194d;p=gdcm.git diff --git a/Example/PatchHeader.cxx b/Example/PatchHeader.cxx index e1d8dd19..adc06698 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:10:49 $ - Version: $Revision: 1.1 $ + Date: $Date: 2006/03/01 09:51:56 $ + Version: $Revision: 1.7 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -31,7 +31,7 @@ // and re-write with a right value. // This program does the job by brutally overwritting the wrong values. // It may be usefull to save a set of images ... -// (It dosn't allow to *add* a missing field) +// (It doesn't allow to *add* a missing field) // ------------------------------------------------------------------------ // global variables will be seen inside any function. @@ -50,16 +50,16 @@ 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() { @@ -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); @@ -264,15 +264,15 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); if (am->ArgMgrDefined("debug")) gdcm::Debug::DebugOn(); - 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; + if ( am->ArgMgrDefined("noshadow") ) + loadMode |= gdcm::LD_NOSHADOW; if ( am->ArgMgrDefined("noseq") ) - loadMode |= NO_SEQ; + loadMode |= gdcm::LD_NOSEQ; } /* if unused Param we give up */ @@ -288,12 +288,10 @@ 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::File::New( ); f->SetLoadMode(loadMode); f->SetFileName( fileName ); bool res = f->Load(); @@ -303,18 +301,18 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); // not only gdcm::File (as opposed to gdcm::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,7 +323,7 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); fp->close(); delete fp; - delete f; + f->Delete(); return 0; } @@ -338,14 +336,14 @@ bsamplesperpixel = am->ArgMgrDefined("samplesperpixel"); it != fileList.end(); ++it ) { - f = new gdcm::File( ); + f = gdcm::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; }