--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: Anonymize.cxx,v $
+ Language: C++
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "gdcmFile.h"
+#include "gdcmFileHelper.h"
+#include "gdcmCommon.h"
+#include "gdcmDebug.h"
+
+#include "gdcmArgMgr.h"
+
+#include <iostream>
+
+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 exAnonymizeNoLoad 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);
+
+ if (am->ArgMgrDefined("usage"))
+ {
+ am->ArgMgrUsage(usage); // Display 'usage'
+ delete am;
+ return 0;
+ }
+ char *fileName = am->ArgMgrWantString("filein",usage);
+ if ( fileName == NULL )
+ {
+ delete am;
+ return 0;
+ }
+
+ char *outputFileName = am->ArgMgrWantString("fileout",usage);
+ if ( outputFileName == NULL )
+ {
+ delete am;
+ return 0;
+ }
+ if (am->ArgMgrDefined("debug"))
+ gdcm::Debug::DebugOn();
+
+ // if unused Param we give up
+ if ( am->ArgMgrPrintUnusedLabels() )
+ {
+ am->ArgMgrUsage(usage);
+ delete am;
+ return 0;
+ }
+
+ delete am; // we don't need Argument Manager any longer
+
+ // ============================================================
+ // Read the input file.
+ // ============================================================
+
+ gdcm::File *f1;
+
+ f1 = new gdcm::File( fileName );
+ if (!f1->IsReadable())
+ {
+ std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
+ << "DICOM / ACR File" <<std::endl;
+ delete f1;
+ return 0;
+ }
+ std::cout << " ... is readable " << std::endl;
+
+ // ============================================================
+ // Load the pixels in memory.
+ // ============================================================
+
+ // We need a gdcm::FileHelper, since we want to load the pixels
+ gdcm::FileHelper *fh1 = new gdcm::FileHelper(f1);
+
+ // (unit8_t DOESN'T mean it's mandatory for the image to be a 8 bits one)
+
+ uint8_t *imageData = fh1->GetImageData();
+
+ if ( imageData == 0 )
+ {
+ std::cerr << "Sorry, Pixels of" << fileName <<" are not "
+ << " gdcm-readable." << std::endl
+ << "Use exAnonymizeNoLoad" << std::endl;
+ delete f1;
+ delete fh1;
+ return 0;
+ }
+
+ // ============================================================
+ // Choose the fields to anonymize.
+ // ============================================================
+ // Institution name
+ f1->AddAnonymizeElement(0x0008, 0x0080, "Xanadoo");
+ // Patient's name
+ f1->AddAnonymizeElement(0x0010, 0x0010, "Fantomas");
+ // Patient's ID
+ f1->AddAnonymizeElement( 0x0010, 0x0020,"1515" );
+ // Study Instance UID
+ f1->AddAnonymizeElement(0x0020, 0x000d, "9.99.999.9999" );
+ // Telephone
+ f1->AddAnonymizeElement(0x0010, 0x2154, "3615" );
+
+ // Aware user will add more fields to anonymize here
+
+ // The gdcm::File is modified in memory
+
+ f1->AnonymizeFile();
+
+ // ============================================================
+ // Write a new file
+ // ============================================================
+
+ fh1->WriteDcmExplVR(outputFileName);
+ std::cout <<"End Anonymize" << std::cout;
+
+ // ============================================================
+ // Remove the Anonymize list
+ // ============================================================
+ f1->ClearAnonymizeList();
+
+ delete f1;
+ delete fh1;
+ return 0;
+}
+
Program: gdcm
Module: $RCSfile: AnonymizeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/03/09 19:15:04 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.2 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDocument.h"
#include "gdcmFile.h"
+#include "gdcmArgMgr.h"
+
#include <iostream>
void AnoNoLoad(gdcm::SQItem *s, std::fstream *fp,
}
int main(int argc, char *argv[])
-{
- gdcm::File *f1;
-
- gdcm::Debug::DebugOn();
- std::cout << "------------------------------------------------" << std::endl;
- std::cout << "Anonymize a gdcm-readable DICOMDIR " << std::endl;
- std::cout << "even some Objects are not yet taken into account" << std::endl;
- std::cout << "Warning : the DICOMDIR is overwritten" << std::endl;
- std::cout << " : to preserve file integrity "
- << " think unto using a copy .. " << std::endl;
+{
+
+ START_USAGE(usage)
+ " \n AnonymizeDicomDir :\n",
+ " Anonymize a gdcm-readable DICOMDIR ",
+ " even when some 'Objects' are not yet taken into account",
+ " Warning : the DICOMDIR is overwritten",
+ " usage: AnonymizeDicomDir filein=dicomDirName [debug] ",
+ " debug : user wants to run the program in 'debug mode' ",
+ FINISH_USAGE
+
+ // ----- Initialize Arguments Manager ------
+ gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+
+ if (am->ArgMgrDefined("usage"))
+ {
+ am->ArgMgrUsage(usage); // Display 'usage'
+ delete am;
+ return 0;
+ }
- if( argc < 3 )
- {
- std::cerr << "Usage " << argv[0] << " DICOMDIR to anonymize "
- << std::endl;
- return 1;
- }
+ char *fileName = am->ArgMgrWantString("filein",usage);
- std::string fileName = argv[1];
+ delete am; // we don't need Argument Manager any longer
// ============================================================
// Read the input DICOMDIR
// ============================================================
- std::cout << argv[1] << std::endl;
-
- f1 = new gdcm::File( fileName );
+ gdcm::File *f1 = new gdcm::File( fileName );
if (!f1->IsReadable()) {
std::cerr << "Sorry, " << fileName <<" not a gdcm-readable "
<< "file" <<std::endl;
}
std::cout << " ... is readable " << std::endl;
-
// Directory record sequence
gdcm::DocEntry *e = f1->GetDocEntry(0x0004, 0x1220);
if ( !e )
{
std::cout << "No Directory Record Sequence (0004,1220) found" <<std::endl;;
+ delete f1;
+ delete e;
return 0;
}
if ( !s )
{
std::cout << "Element (0004,1220) is not a Sequence ?!?" <<std::endl;
+ delete f1;
+ delete e;
return 0;
}
// Open the file LTTG (aka ALAP)
- std::fstream *fp = new std::fstream(fileName.c_str(),
+ std::fstream *fp = new std::fstream(fileName,
std::ios::in | std::ios::out | std::ios::binary);
gdcm::DocEntry *d;
std::string v;
// Close the file ASAP
fp->close();
+
delete fp;
-
+ delete e;
delete f1;
return 0;
}
FindTags
MakeDicomDir
AnonymizeDicomDir # without loading it as a gdcm::DicomDir
-
+ Anonymize # for full gdcm readable files
+ AnonymizeNoLoad # without loading the Pixel Data
+ ReWrite
+
#the following will be transformed into 'examples', or 'utilities'
# or will be removed
#
# Better you don't use them (not fully checked ...)
- #test
FlatHashTablePrint
TestCopyDicom
TestChangeHeader
Program: gdcm
Module: $RCSfile: MakeDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/06/03 15:40:53 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.4 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmDirList.h"
#include "gdcmDebug.h"
+#include "gdcmArgMgr.h"
+
#include <iostream>
// ---
/**
* \ingroup Test
- * \brief Explores recursively the given directory (or GDCM_DATA_ROOT by default)
+ * \brief Explores recursively the given directory
* orders the gdcm-readable found Files
* according their Patient/Study/Serie/Image characteristics
* makes the gdcmDicomDir
int main(int argc, char *argv[])
{
- // gdcm::Debug::DebugOn();
- std::string dirName;
-
- if (argc > 1)
+ START_USAGE(usage)
+ " \n MakeDicomDir :\n",
+ " Explores recursively the given directory, makes the relevant DICOMDIR",
+ " and writes it as 'NewDICOMDIR'",
+ " usage: MakeDicomDir dirname=rootDirectoryName [noshadow] [noseq] [debug] ",
+ " noshadow : user doesn't want to load Private groups (odd number)",
+ " noseq : user doesn't want to load Sequences ",
+ " debug : user wants to run the program in 'debug mode' ",
+ FINISH_USAGE
+
+ // ----- Initialize Arguments Manager ------
+ gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+
+ if (am->ArgMgrDefined("usage"))
{
- dirName = argv[1];
+ am->ArgMgrUsage(usage); // Display 'usage'
+ delete am;
+ return 0;
}
+
+ char *dirName;
+ dirName = am->ArgMgrGetString("dirName",".");
+
+ int loadMode;
+ if ( am->ArgMgrDefined("noshadow") && am->ArgMgrDefined("noseq") )
+ loadMode = NO_SEQ | NO_SHADOW;
+ else if ( am->ArgMgrDefined("noshadow") )
+ loadMode = NO_SHADOW;
+ else if ( am->ArgMgrDefined("noseq") )
+ loadMode = NO_SEQ;
else
- {
- dirName = GDCM_DATA_ROOT;
+ loadMode = 0;
+
+ if (am->ArgMgrDefined("debug"))
+ gdcm::Debug::DebugOn();
+
+ // if unused Param we give up
+ if ( am->ArgMgrPrintUnusedLabels() )
+ {
+ am->ArgMgrUsage(usage);
+ delete am;
+ return 0;
}
+ delete am; // we don't need Argument Manager any longer
+
+ // ----- Begin Processing -----
+
gdcm::DicomDir *dcmdir;
- // we ask for Directory parsing
-
- // Old style (still available) :
- // dcmdir = new gdcm::DicomDir(dirName, true);
- // new style (user is allowed no to load Sequences an/or Shadow Groups)
+ // we ask for Directory parsing
+
dcmdir = new gdcm::DicomDir( );
dcmdir->SetParseDir(true);
-// some images have a wrong length for element 0x0000 of private groups
-// dcmdir->SetLoadMode(NO_SEQ | NO_SHADOW);
-
- dcmdir->SetLoadMode(NO_SEQ);
- dcmdir->Load(dirName);
dcmdir->SetStartMethod(StartMethod, (void *) NULL);
dcmdir->SetEndMethod(EndMethod);
-
+
+ dcmdir->SetLoadMode(loadMode);
+ dcmdir->Load(dirName);
+
+ // ----- Check the result
+
if ( !dcmdir->GetFirstPatient() )
{
std::cout << "makeDicomDir: no patient found. Exiting."
<< std::endl;
-
delete dcmdir;
return 1;
}
- // Create the corresponding DicomDir
+ // ----- Create the corresponding DicomDir
+
dcmdir->WriteDicomDir("NewDICOMDIR");
delete dcmdir;
Program: gdcm
Module: $RCSfile: PrintDicomDir.cxx,v $
Language: C++
- Date: $Date: 2005/04/26 16:21:54 $
- Version: $Revision: 1.21 $
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.22 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#include "gdcmTS.h"
#include "gdcmDebug.h"
+#include "gdcmArgMgr.h"
+
#include <fstream>
#include <iostream>
int main(int argc, char* argv[])
-{
+{
+ START_USAGE(usage)
+ " \n PrintDicomDir :\n",
+ " Display the tree-like structure of a DICOMDIR File",
+ " usage: PrintDicomDir filein=fileName [level=n] [debug] ",
+ " detail = 1 : Patients, 2 : Studies, 3 : Series, 4 : Images ",
+ " 5 : Full Content ",
+ " level = 0,1,2 : depending on user (what he wants to see)",
+ " debug : user wants to run the program in 'debug mode' ",
+ FINISH_USAGE
+
+ // Initialize Arguments Manager
+ gdcm::ArgMgr *am= new gdcm::ArgMgr(argc, argv);
+
+ if (argc == 1)
+ {
+ am->ArgMgrUsage(usage); // Display 'usage'
+ delete am;
+ return 0;
+ }
+
gdcm::DicomDir *e1;
gdcm::TSKey v;
gdcm::DicomDirSerie *se;
gdcm::DicomDirImage *im;
- std::string fileName;
- if (argc > 1)
- fileName = argv[1];
- else
- {
- fileName = GDCM_DATA_ROOT;
- fileName += "/DICOMDIR";
- }
+ char *fileName;
+ fileName = am->ArgMgrWantString("filein",usage);
+
+ int level = am->ArgMgrGetInt("level", 2);
+
+ int detailLevel = am->ArgMgrGetInt("detail", 2);
- if (argc > 3)
+ if (am->ArgMgrDefined("debug"))
gdcm::Debug::DebugOn();
- // new style is useless, since it has no effect fore *reading* a DICOMDIR
+ /* if unused Param we give up */
+ if ( am->ArgMgrPrintUnusedLabels() )
+ {
+ am->ArgMgrUsage(usage);
+ delete e1;
+ delete am;
+ return 0;
+ }
+
+ // new style is useless, since it has no effect for *reading* a DICOMDIR
// (only meaningfull when *creating* a DICOMDIR)
e1 = new gdcm::DicomDir( fileName );
return 1;
}
- e1->SetPrintLevel(2);
- int detailLevel;
- if (argc > 2)
- detailLevel = atoi(argv[2]);
- else
- detailLevel = 3;
+ e1->SetPrintLevel(level);
// Test if the DicomDir contains any Patient
pa = e1->GetFirstPatient();
pa = e1->GetFirstPatient();
while ( pa ) { // les PATIENT de ce DICOMDIR
- std::cout << pa->GetEntryValue(0x0010, 0x0010) << std::endl; // Patient's Name
+ // Patient's Name, Patient ID
+ std::cout << "Pat.Name:[" << pa->GetEntryValue(0x0010, 0x0010) <<"]"; // Patient's Name
+ std::cout << " Pat.ID:[";
+ std::cout << pa->GetEntryValue(0x0010, 0x0020) << "]" << std::endl; // Patient ID
st = pa->GetFirstStudy();
while ( st ) { // on degouline les STUDY de ce patient
- std::cout << "--- "<< st->GetEntryValue(0x0008, 0x1030) << std::endl; // Study Description
- std::cout << " Stud.ID:[" << st->GetEntryValue(0x0020, 0x0010); // Study ID
+ std::cout << "--- Stud.descr:[" << st->GetEntryValue(0x0008, 0x1030) << "]";// Study Description
+ std::cout << " Stud.ID:[" << st->GetEntryValue(0x0020, 0x0010); // Study ID
+ std::cout << "]" << std::endl;
se = st->GetFirstSerie();
while ( se ) { // on degouline les SERIES de cette study
- std::cout << "--- --- "<< se->GetEntryValue(0x0008, 0x103e) << std::endl; // Serie Description
+ std::cout << "--- --- Ser.Descr:["<< se->GetEntryValue(0x0008, 0x103e)<< "]"; // Series Description
std::cout << " Ser.nb:[" << se->GetEntryValue(0x0020, 0x0011); // Series number
std::cout << "] Mod.:[" << se->GetEntryValue(0x0008, 0x0060) << "]"; // Modality
+ std::cout << std::endl;
im = se->GetFirstImage();
while ( im ) { // on degouline les Images de cette serie
Program: gdcm
Module: $RCSfile: PrintFile.cxx,v $
Language: C++
- Date: $Date: 2005/06/06 12:41:04 $
- Version: $Revision: 1.37 $
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.38 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
=========================================================================*/
#include "gdcmFile.h"
-#include "gdcmDebug.h"
#include "gdcmFileHelper.h"
+#include "gdcmDebug.h"
#include "gdcmArgMgr.h"
" debug : user wants to run the program in 'debug mode' ",
FINISH_USAGE
- gdcm::File *e1;
- gdcm::FileHelper *f1;
- char *fileName;
-
// Initialize Arguments Manager
gdcm::ArgMgr *am= new gdcm::ArgMgr(argc, argv);
- if (argc == 1)
+ if (argc == 1)
{
am->ArgMgrUsage(usage); // Display 'usage'
delete am;
return 0;
}
- fileName = am->ArgMgrWantString("filein",usage);
-
- if (am->ArgMgrDefined("debug"))
- gdcm::Debug::DebugOn();
-
- e1 = new gdcm::File();
+ char *fileName = am->ArgMgrWantString("filein",usage);
+ int loadMode;
if ( am->ArgMgrDefined("noshadow") && am->ArgMgrDefined("noseq") )
- e1->SetLoadMode(NO_SEQ | NO_SHADOW);
+ loadMode = NO_SEQ | NO_SHADOW;
else if ( am->ArgMgrDefined("noshadow") )
- e1->SetLoadMode(NO_SHADOW);
+ loadMode = NO_SHADOW;
else if ( am->ArgMgrDefined("noseq") )
- e1->SetLoadMode(NO_SEQ);
+ loadMode = NO_SEQ;
+ else
+ loadMode = 0;
int level = am->ArgMgrGetInt("level", 2);
+ if (am->ArgMgrDefined("debug"))
+ gdcm::Debug::DebugOn();
+
/* if unused Param we give up */
if ( am->ArgMgrPrintUnusedLabels() )
{
am->ArgMgrUsage(usage);
- delete e1;
delete am;
return 0;
}
- bool res;
// gdcm::File::IsReadable() is no usable here, because we deal with
// any kind of gdcm-Parsable *document*
// not only gdcm::File (as opposed to gdcm::DicomDir)
- res = e1->Load( fileName );
+ gdcm::File *e1 = new gdcm::File();
+ e1->SetLoadMode(loadMode);
+
+ bool res = e1->Load( fileName );
if ( !res )
{
delete e1;
return 0;
}
- f1 = new gdcm::FileHelper(e1);
+ gdcm::FileHelper *f1 = new gdcm::FileHelper(e1);
f1->SetPrintLevel( level );
f1->Print();
--- /dev/null
+/*=========================================================================
+
+ Program: gdcm
+ Module: $RCSfile: ReWrite.cxx,v $
+ Language: C++
+ Date: $Date: 2005/06/07 11:12:10 $
+ Version: $Revision: 1.1 $
+
+ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
+ l'Image). All rights reserved. See Doc/License.txt or
+ http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even
+ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+#include "gdcmFile.h"
+#include "gdcmFileHelper.h"
+#include "gdcmDebug.h"
+
+#include "gdcmArgMgr.h"
+
+#include <iostream>
+
+int main(int argc, char *argv[])
+{
+ START_USAGE(usage)
+ " \n ReWrite :\n",
+ " Re write a full gdcm-readable Dicom image",
+ " (usefull when the file header is not very straight).",
+ " ",
+ " usage: ReWrite filein=inputFileName fileout=anonymizedFileName ",
+ " [mode=write mode] [noshadow] [noseq][debug] ",
+ " mode = a (ACR), x (Explicit VR Dicom), r (RAW : only pixels)",
+ " noshadow : user doesn't want to load Private groups (odd number)",
+ " noseq : user doesn't want to load Sequences ",
+ " debug : user wants to run the program in 'debug mode' ",
+ FINISH_USAGE
+
+ // ----- Initialize Arguments Manager ------
+ gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
+
+ if (am->ArgMgrDefined("usage"))
+ {
+ am->ArgMgrUsage(usage); // Display 'usage'
+ delete am;
+ return 0;
+ }
+ char *fileName = am->ArgMgrWantString("filein",usage);
+ if ( fileName == NULL )
+ {
+ delete am;
+ return 0;
+ }
+
+ char *outputFileName = am->ArgMgrWantString("fileout",usage);
+ if ( outputFileName == NULL )
+ {
+ delete am;
+ return 0;
+ }
+
+ char *mode = am->ArgMgrGetString("filein","X");
+
+ int loadMode;
+ if ( am->ArgMgrDefined("noshadow") && am->ArgMgrDefined("noseq") )
+ loadMode = NO_SEQ | NO_SHADOW;
+ else if ( am->ArgMgrDefined("noshadow") )
+ loadMode = NO_SHADOW;
+ else if ( am->ArgMgrDefined("noseq") )
+ loadMode = NO_SEQ;
+ else
+ loadMode = 0;
+
+ if (am->ArgMgrDefined("debug"))
+ gdcm::Debug::DebugOn();
+
+ // if unused Param we give up
+ if ( am->ArgMgrPrintUnusedLabels() )
+ {
+ am->ArgMgrUsage(usage);
+ delete am;
+ return 0;
+ }
+
+ delete am; // we don't need Argument Manager any longer
+
+ void *imageData;
+ int dataSize;
+
+ gdcm::File *e1 = new gdcm::File();
+ e1->SetLoadMode(loadMode);
+
+ bool res = e1->Load( fileName );
+ if ( !res )
+ {
+ delete e1;
+ delete am;
+ return 0;
+ }
+ if (!e1->IsReadable())
+ {
+ std::cerr << "Sorry, not a Readable DICOM / ACR File" <<std::endl;
+ delete e1;
+ delete am;
+ return 0;
+ }
+
+ gdcm::FileHelper *f1 = new gdcm::FileHelper(e1);
+
+// ---
+
+ dataSize = f1->GetImageDataSize();
+ std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
+ int nX,nY,nZ,sPP,planarConfig;
+ std::string pixelType, transferSyntaxName;
+ nX=e1->GetXSize();
+ nY=e1->GetYSize();
+ nZ=e1->GetZSize();
+ std::cout << " DIMX=" << nX << " DIMY=" << nY << " DIMZ=" << nZ << std::endl;
+
+ pixelType = e1->GetPixelType();
+ sPP = e1->GetSamplesPerPixel();
+ planarConfig = e1->GetPlanarConfiguration();
+
+ std::cout << " pixelType=" << pixelType
+ << " SampleserPixel=" << sPP
+ << " PlanarConfiguration=" << planarConfig
+ << " PhotometricInterpretation="
+ << e1->GetEntryValue(0x0028,0x0004)
+ << std::endl;
+
+ int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
+ std::cout << "NumberOfScalarComponents " << numberOfScalarComponents <<std::endl;
+ transferSyntaxName = e1->GetTransferSyntaxName();
+ std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
+
+ imageData= f1->GetImageData();
+
+ switch (mode[0])
+ {
+ case 'A' :
+ // Writting an ACR file
+ // from a full gdcm readable File
+
+ std::cout << "WriteACR" << std::endl;
+ f1->WriteAcr(outputFileName);
+ break;
+
+ case 'D' : // Not documented in the 'usage', because the method is known to be bugged.
+
+ // Writting a DICOM Implicit VR file
+ // from a full gdcm readable File
+
+ std::cout << "WriteDCM Implicit VR" << std::endl;
+ f1->WriteDcmImplVR(outputFileName);
+ break;
+
+ case 'X' :
+ // writting a DICOM Explicit VR
+ // from a full gdcm readable File
+
+ std::cout << "WriteDCM Explicit VR" << std::endl;
+ f1->WriteDcmExplVR(outputFileName);
+ break;
+
+ case 'R' :
+ // Writting a Raw File,
+
+ std::cout << "WriteRaw" << std::endl;
+ f1->WriteRawData(outputFileName);
+ break;
+
+ }
+ delete e1;
+ delete f1;
+ delete am;
+ return 0;
+}
+