Program: gdcm
Module: $RCSfile: Anonymize.cxx,v $
Language: C++
- Date: $Date: 2006/01/02 15:16:38 $
- Version: $Revision: 1.8 $
+ Date: $Date: 2007/06/15 13:18:50 $
+ Version: $Revision: 1.13 $
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
// ----- Initialize Arguments Manager ------
- gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+ GDCM_NAME_SPACE::ArgMgr *am = new GDCM_NAME_SPACE::ArgMgr(argc, argv);
if (argc == 1 || am->ArgMgrDefined("usage"))
{
return 0;
}
if (am->ArgMgrDefined("debug"))
- gdcm::Debug::DebugOn();
+ GDCM_NAME_SPACE::Debug::DebugOn();
// if unused Param we give up
if ( am->ArgMgrPrintUnusedLabels() )
// Read the input file.
// ============================================================
- gdcm::File *f;
+ GDCM_NAME_SPACE::File *f;
- f = gdcm::File::New( );
- f->SetLoadMode( gdcm::LD_ALL );
+ f = GDCM_NAME_SPACE::File::New( );
+ f->SetLoadMode( GDCM_NAME_SPACE::LD_ALL );
f->SetFileName( fileName );
int res = f->Load();
// ============================================================
// We need a gdcm::FileHelper, since we want to load the pixels
- gdcm::FileHelper *fh = gdcm::FileHelper::New(f);
+ 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 !
// Feel free to cast if you know it's not.
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();
// 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
// Write a new file
// ============================================================
- // Since we just Anonymized the file, we know no modification
+ // Since we just Anonymized the file, we know that 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_NAME_SPACE::UNMODIFIED_PIXELS_IMAGE);
fh->WriteDcmExplVR(outputFileName);
std::cout <<"End Anonymize" << std::cout;