Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
" Warning : the image is OVERWRITTEN ",
" to preserve image integrity, use a copy. ",
" usage: AnonymizeReWriteMultiPatient dirin=inputDirectoryName dicomdir ",
" Warning : the image is OVERWRITTEN ",
" to preserve image integrity, use a copy. ",
" usage: AnonymizeReWriteMultiPatient 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 ",
" listOfElementsToRubOut : group-elem,g2-e2,... (in hexa, no space) ",
" of extra Elements to rub out ",
" dicomdir : user wants to generate a DICOMDIR ",
bool verbose = ( 0 != am->ArgMgrDefined("verbose") );
bool dicomdir = ( 0 != am->ArgMgrDefined("dicomdir") );
bool verbose = ( 0 != am->ArgMgrDefined("verbose") );
bool dicomdir = ( 0 != am->ArgMgrDefined("dicomdir") );
int sequentialPatientNumber = 0;
char char_sequentialPatientNumber[10]; // 999999999 patients in a directory should be enough?
int sequentialPatientNumber = 0;
char char_sequentialPatientNumber[10]; // 999999999 patients in a directory should be enough?
patID = pa->GetEntryString(0x0010, 0x0020);
codedID = GDCM_NAME_SPACE::Util::ConvertToMD5(patID);
patID = pa->GetEntryString(0x0010, 0x0020);
codedID = GDCM_NAME_SPACE::Util::ConvertToMD5(patID);
- fullFileName += GDCM_NAME_SPACE::GDCM_FILESEPARATOR;
+ const char lastChar = dirName.c_str()[strlen(dirName.c_str())-1];
+ if ( lastChar != '/' && lastChar != '\\')
+ fullFileName += GDCM_NAME_SPACE::GDCM_FILESEPARATOR;
+
+ // -- remove trailing space, if any
+ int pos=fullFileName.length()-1;
+ if (fullFileName[pos] == ' ')
+ {
+ fullFileName.erase(pos);
+ }
+ // --
+
f = GDCM_NAME_SPACE::File::New( );
f->SetMaxSizeLoadEntry(0x7fff); // we want to load entries of any length !
f->SetLoadMode(loadMode);
f->SetFileName( fullFileName );
if ( !f->Load() )
f = GDCM_NAME_SPACE::File::New( );
f->SetMaxSizeLoadEntry(0x7fff); // we want to load entries of any length !
f->SetLoadMode(loadMode);
f->SetFileName( fullFileName );
if ( !f->Load() )
GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
// unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one !
GDCM_NAME_SPACE::FileHelper *fh = GDCM_NAME_SPACE::FileHelper::New(f);
// unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one !