]> Creatis software - gdcm.git/blobdiff - Example/exAnonymizeNoLoad.cxx
ENH: Adding a deprecation mechanism to gdcm via two MACRO and two config options
[gdcm.git] / Example / exAnonymizeNoLoad.cxx
index a5d3de75cef24fa173bff234f13b83f3d9ea8a6b..dece2b6a6194ccd010cdd225e50b194acb7883ef 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: exAnonymizeNoLoad.cxx,v $
   Language:  C++
-  Date:      $Date: 2005/05/03 10:40:28 $
-  Version:   $Revision: 1.6 $
+  Date:      $Date: 2005/07/07 17:31:54 $
+  Version:   $Revision: 1.9 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -24,7 +24,7 @@
 
 int main(int argc, char *argv[])
 {  
-   gdcm::File *f1;
+   gdcm::File *f;
     
    gdcm::Debug::DebugOn();
 
@@ -47,14 +47,16 @@ int main(int argc, char *argv[])
 // ============================================================
 //   Read the input image.
 // ============================================================
-   bool res;
-
-   f1 = new gdcm::File( );
-   f1->SetLoadMode(NO_SEQ - NO_SHADOW);
-   res = f1->Load(fileName);
-   // IsReadable() is no usable here, because we deal with
-   // any kind of gdcm::Readable *document* (no only gdcm::File)
-   if (res) {
+
+   f = new gdcm::File( );
+   f->SetLoadMode(NO_SEQ - NO_SHADOW);
+   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)
+   if ( !res ) {
        std::cout <<std::endl
            << "Sorry, " << fileName <<"  not a gdcm-readable "
            << "DICOM / ACR Document"
@@ -73,21 +75,21 @@ int main(int argc, char *argv[])
 //  Choose the fields to anonymize.
 // ============================================================
    // Institution name 
-   f1->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
+   f->AddAnonymizeElement( 0x0008, 0x0080, "Xanadoo" ); 
    // Patient's name 
-   f1->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
+   f->AddAnonymizeElement( 0x0010, 0x0010, "Fantomas" );   
    // Patient's ID
-   f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+   f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
    // Patient's Birthdate
-   f1->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
+   f->AddAnonymizeElement( 0x0010, 0x0030,"11.11.1111" );
    // Patient's Adress
-   f1->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
+   f->AddAnonymizeElement( 0x0010, 0x1040,"Sing-sing" );
    // Patient's Mother's Birth Name
-   f1->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
+   f->AddAnonymizeElement( 0x0010, 0x1060,"Vampirella" );   
    // Study Instance UID
-   f1->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
+   f->AddAnonymizeElement( 0x0020, 0x000d, "9.99.999.9999" );
    // Telephone
-   f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+   f->AddAnonymizeElement(0x0010, 0x2154, "3615" );
   // Aware use will add new fields here
 
 
@@ -102,7 +104,7 @@ int main(int argc, char *argv[])
 
 // The gdcm::File remains untouched in memory
 
-   f1->AnonymizeNoLoad();
+   f->AnonymizeNoLoad();
 
 // No need to write the File : modif were done on disc !
 // File was overwritten ...
@@ -112,9 +114,9 @@ int main(int argc, char *argv[])
 // ============================================================
 //   Remove the Anonymize list
 // ============================================================  
-   f1->ClearAnonymizeList();
+   f->ClearAnonymizeList();
     
-   delete f1;
+   delete f;
    return 0;
 }