]> Creatis software - gdcm.git/blobdiff - Example/Anonymize.cxx
Add verbosity
[gdcm.git] / Example / Anonymize.cxx
index 3be4812d6e9609586641a8bb4184ec47f04ed761..8a2cf32c1da585219500d2a7653bd1533386dcfe 100644 (file)
@@ -3,8 +3,8 @@
   Program:   gdcm
   Module:    $RCSfile: Anonymize.cxx,v $
   Language:  C++
-  Date:      $Date: 2006/01/02 15:16:38 $
-  Version:   $Revision: 1.8 $
+  Date:      $Date: 2006/03/17 14:36:37 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
 
 #include <iostream>
 
+
+/// \todo : AnonymizeDirectory
+///         That should split the images : Patient/Study/Serie
+///         and keeps coherent the StudyInstanceUID, SeriesInstanceUID
+///         (Now, a new one is generated fore each image :-( )
 int main(int argc, char *argv[])
 {
    START_USAGE(usage)
    " \n Anonymize :\n                                                         ",
    " Anonymize a full gdcm-readable Dicom image                               ",
    "          Warning : probably segfaults if pixels are not gdcm readable.   ",
-   "                    Use AnonymizeNoLoad instead.                        ",
+   "                    Use AnonymizeNoLoad instead.                          ",
    " usage: Anonymize filein=inputFileName fileout=anonymizedFileName[debug]  ",
    "        debug    : user wants to run the program in 'debug mode'          ",
    FINISH_USAGE
@@ -105,7 +110,7 @@ int main(int argc, char *argv[])
    if ( imageData == 0 )
    {
        std::cerr << "Sorry, Pixels of" << fileName <<"  are not "
-           << " gdcm-readable."       << std::endl
+                 << " gdcm-readable."       << std::endl
                  << "Use exAnonymizeNoLoad" << std::endl;
        f->Delete();
        fh->Delete();
@@ -118,7 +123,7 @@ int main(int argc, char *argv[])
    // Institution name 
    f->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo"); 
    // Patient's name 
-   f->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");   
+   f->AddAnonymizeElement(0x0010, 0x0010, "Fantomas^X");   
    // Patient's ID
    f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );   
    // Study Instance UID
@@ -138,8 +143,10 @@ int main(int argc, char *argv[])
    
    // Since we just Anonymized the file, we know no modification 
    // was performed on the pixels.
-   // We don't want this image appears as a 'Secondary Captured image'
-   fh->SetKeepMediaStorageSOPClassUID(true);
+   // The written image will not appear as a 'Secondary Captured image'
+   // nor as a DERIVED one  
+
+   fh->SetContentType(gdcm::UNMODIFIED_PIXELS_IMAGE);
    
    fh->WriteDcmExplVR(outputFileName);
    std::cout <<"End Anonymize" << std::cout;