]> Creatis software - gdcm.git/blobdiff - Example/AnonymizeNoLoad.cxx
Remove trailing spaces
[gdcm.git] / Example / AnonymizeNoLoad.cxx
index cf6f22ee5d80c7035ac8ca9cf5dd0077de3d916b..5e66ae8203208ccc6f0de3e135f64592a9e92aeb 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: AnonymizeNoLoad.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/08/30 14:40:28 $
-  Version:   $Revision: 1.11 $
+  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)
         ||
@@ -75,15 +75,15 @@ int main(int argc, char *argv[])
        return 0;
  }
  
-   int loadMode = GDCM_LD_ALL;
+   int loadMode = gdcm::LD_ALL;
    if ( am->ArgMgrDefined("noshadowseq") )
-      loadMode |= GDCM_LD_NOSHADOWSEQ;
+      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;
+         loadMode |= gdcm::LD_NOSEQ;
    }
 
    int rubOutNb;
@@ -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;
 }