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
" \n ReWrite :\n",
" Re write a full gdcm-readable Dicom image ",
" (usefull when the file header is not very straight). ",
" \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] ",
" usage: ReWrite filein=inputFileName fileout=anonymizedFileName ",
" [mode=write mode] [noshadow] [noseq][debug] ",
" mode = a (ACR), x (Explicit VR Dicom), r (RAW : only pixels) ",
" 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 ",
" rgb : user wants to tranform LUT (if any) to RGB pixels ",
" noshadow : user doesn't want to load Private groups (odd number)",
" noseq : user doesn't want to load Sequences ",
" rgb : user wants to tranform LUT (if any) to RGB pixels ",
// ----- Initialize Arguments Manager ------
gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
// ----- Initialize Arguments Manager ------
gdcm::ArgMgr *am = new gdcm::ArgMgr(argc, argv);
char *outputFileName = am->ArgMgrWantString("fileout",usage);
if ( outputFileName == NULL )
{
char *outputFileName = am->ArgMgrWantString("fileout",usage);
if ( outputFileName == NULL )
{
- 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;
+ int loadMode = 0x00000000;
+ if ( am->ArgMgrDefined("noshadowseq") )
+ loadMode |= NO_SHADOWSEQ;
+ else
+ {
+ if ( am->ArgMgrDefined("noshadow") )
+ loadMode |= NO_SHADOW;
+ if ( am->ArgMgrDefined("noseq") )
+ loadMode |= NO_SEQ;
+ }
- gdcm::File *e1 = new gdcm::File();
- e1->SetLoadMode(loadMode);
-
- bool res = e1->Load( fileName );
+ gdcm::File *f = new gdcm::File();
+ f->SetLoadMode( loadMode );
+ f->SetFileName( fileName );
+ bool res = f->Load();
- dataSize = f1->GetImageDataSize();
- imageData = f1->GetImageData(); // somewhat important... can't remember
- f1->SetWriteModeToRGB();
+ dataSize = fh->GetImageDataSize();
+ imageData = fh->GetImageData(); // somewhat important... can't remember
+ fh->SetWriteModeToRGB();
- dataSize = f1->GetImageDataRawSize();
- imageData = f1->GetImageDataRaw();
- f1->SetWriteModeToRaw();
+ dataSize = fh->GetImageDataRawSize();
+ imageData = fh->GetImageDataRaw();// somewhat important... can't remember
+ fh->SetWriteModeToRaw();
std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
int nX,nY,nZ,sPP,planarConfig;
std::string pixelType, transferSyntaxName;
std::cout <<std::endl <<" dataSize " << dataSize << std::endl;
int nX,nY,nZ,sPP,planarConfig;
std::string pixelType, transferSyntaxName;
- pixelType = e1->GetPixelType();
- sPP = e1->GetSamplesPerPixel();
- planarConfig = e1->GetPlanarConfiguration();
+ pixelType = f->GetPixelType();
+ sPP = f->GetSamplesPerPixel();
+ planarConfig = f->GetPlanarConfiguration();
std::cout << " pixelType=" << pixelType
<< " SampleserPixel=" << sPP
<< " PlanarConfiguration=" << planarConfig
<< " PhotometricInterpretation="
std::cout << " pixelType=" << pixelType
<< " SampleserPixel=" << sPP
<< " PlanarConfiguration=" << planarConfig
<< " PhotometricInterpretation="
- int numberOfScalarComponents=e1->GetNumberOfScalarComponents();
- std::cout << "NumberOfScalarComponents " << numberOfScalarComponents <<std::endl;
- transferSyntaxName = e1->GetTransferSyntaxName();
- std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]" << std::endl;
+ int numberOfScalarComponents=f->GetNumberOfScalarComponents();
+ std::cout << "NumberOfScalarComponents " << numberOfScalarComponents
+ <<std::endl;
+ transferSyntaxName = f->GetTransferSyntaxName();
+ std::cout << " TransferSyntaxName= [" << transferSyntaxName << "]"
+ << std::endl;
// Writting a DICOM Implicit VR file
// from a full gdcm readable File
std::cout << "WriteDCM Implicit VR" << std::endl;
// Writting a DICOM Implicit VR file
// from a full gdcm readable File
std::cout << "WriteDCM Implicit VR" << std::endl;