Program: gdcm
Module: $RCSfile: AnonymizeMultiPatient.cxx,v $
Language: C++
- Date: $Date: 2007/05/23 14:18:04 $
- Version: $Revision: 1.5 $
+ Date: $Date: 2007/11/09 17:23:48 $
+ Version: $Revision: 1.6 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
START_USAGE(usage)
" \n AnonymizeMultiPatient :\n ",
" AnonymizeMultiPatient a full gdcm-readable Dicom image ",
+ " optionnaly, creates the DICOMDIR ",
" Warning : the image is OVERWRITTEN ",
" to preserve image integrity, use a copy. ",
- " usage: AnonymizeMultiPatient dirin=inputDirectoryName ",
+ " usage: AnonymizeMultiPatient dirin=inputDirectoryName dicomdir ",
" listOfElementsToRubOut : group-elem,g2-e2,... (in hexa, no space) ",
" of extra Elements to rub out ",
+ " dicomdir : user wants to generate a DICOMDIR ",
" 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 ",
}
std::string dirName = name;
-
- int verbose = am->ArgMgrDefined("verbose");
+
+ bool verbose = ( 0 != am->ArgMgrDefined("verbose") );
+ bool dicomdir = ( 0 != am->ArgMgrDefined("dicomdir") );
if (am->ArgMgrDefined("debug"))
GDCM_NAME_SPACE::Debug::DebugOn();
GDCM_NAME_SPACE::DicomDirSerie *se;
GDCM_NAME_SPACE::DicomDirImage *im;
- std::string codedName;
+ std::string codedName;
+ std::string codedID;
std::string fullFileName;
std::string patName;
-
+ std::string patID;
+
GDCM_NAME_SPACE::File *f;
pa = dcmdir->GetFirstPatient();
{ // on degouline les PATIENT du DICOMDIR
patName = pa->GetEntryString(0x0010, 0x0010);
codedName = "g^" + GDCM_NAME_SPACE::Util::ConvertToMD5(patName);
- if (verbose)
- std::cout << patName << " --> " << codedName << std::endl;
+ patID = pa->GetEntryString(0x0010, 0x0020);
+ codedID = GDCM_NAME_SPACE::Util::ConvertToMD5(patID);
+
+ if (verbose) {
+ std::cout << "[" << patName << "] --> [" << codedName << "]" << std::endl;
+ std::cout << "[" << patID << "] --> [" << codedID << "]" << std::endl;
+ }
st = pa->GetFirstStudy();
while ( st )
{ // on degouline les STUDY de ce patient
f->AddAnonymizeElement( 0x0010, 0x0010, codedName );
// Patient's ID
- f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+ //f->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+ f->AddAnonymizeElement( 0x0010, 0x0020,codedID );
// Patient's Birthdate
f->AddAnonymizeElement( 0x0010, 0x0030,"11111111" );
// Patient's Adress
pa = dcmdir->GetNextPatient();
}
+ if (dicomdir)
+ {
+ dcmdir->Write("DICOMDIR");
+ }
+
dcmdir->Delete();
return 0;