Program: gdcm
Module: $RCSfile: exExtractCSA.cxx,v $
Language: C++
- Date: $Date: 2007/06/07 16:13:14 $
- Version: $Revision: 1.1 $
+ Date: $Date: 2007/06/21 15:06:13 $
+ 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
" inputFileName : Name of the (single) file user wants to anonymize ",
" listOfElementsExtract : group-elem,g2-e2,... (in hexa, no space) ",
" of Elements to extract ",
- " default : 0029-1210,0029-1220 ",
+ " default : 0029-1010,0029-1020 ",
" 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 ",
if ( am->ArgMgrDefined("noseq") )
loadMode |= GDCM_NAME_SPACE::LD_NOSEQ;
}
-
+
const char *tempWorkFile = am->ArgMgrGetString("tmp");
int extractNb;
uint16_t *elemsToExtract;
- if (am->ArgMgrDefined("extract"))
+ if (am->ArgMgrDefined("extract"))
+ {
am->ArgMgrGetXInt16Enum("extract", &extractNb);
+ std::cout << "extractNb=" << extractNb << std::endl;
+ if (extractNb =! 0)
+ for (int k=0;k<extractNb; k++)
+ std::cout << std::hex << elemsToExtract[2*k] << "|" << elemsToExtract[2*k+1] <<std::endl;
+ }
else
{
elemsToExtract = new uint16_t[4];
elemsToExtract[0] = 0x0029;
- elemsToExtract[1] = 0x1210;
+ elemsToExtract[1] = 0x1010;
elemsToExtract[2] = 0x0029;
- elemsToExtract[3] = 0x1220;
+ elemsToExtract[3] = 0x1020;
extractNb=2;
}
// Read the input image.
// ============================================================
- gdcm::File *f = gdcm::File::New( );
+ GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New( );
- //f->SetLoadMode(gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW);
+ //f->SetLoadMode(GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW);
f->SetFileName( fileName );
f->SetMaxSizeLoadEntry(0xffff);
bool res = f->Load();
- if( gdcm::Debug::GetDebugFlag())
+ if( GDCM_NAME_SPACE::Debug::GetDebugFlag())
{
std::cout << "---------------------------------------------" << std::endl;
f->Print();
uint16_t group = elemsToExtract[2*tag_no];
uint16_t elem = elemsToExtract[2*tag_no+1];
+ if (verbose)
+ std::cout << "Let's try tag : " << std::hex << group << "|" << elem << std::endl;
+
std::string dicom_tag_value = f->GetEntryString(group, elem);
- if (dicom_tag_value == gdcm::GDCM_UNFOUND)
+ if (dicom_tag_value == GDCM_NAME_SPACE::GDCM_UNFOUND)
{
- gdcm::DictEntry *dictEntry = f->GetPubDict()->GetEntry( group, elem);
- std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName()
- << std::endl;
+ GDCM_NAME_SPACE::DictEntry *dictEntry = f->GetPubDict()->GetEntry( group, elem);
+ if (dictEntry != NULL)
+ std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName()
+ << std::endl;
+ else
+ std::cerr << "Dicom Dictionary doesn't contain any tag: "
+ << std::hex << group << "|" << elem << std::endl;
f->Delete();
return 1;
}
- gdcm::DocEntry *dicom_tag_doc = f->GetDocEntry(group, elem);
- gdcm::DataEntry *dicom_tag = dynamic_cast<gdcm::DataEntry *>(dicom_tag_doc);
+ GDCM_NAME_SPACE::DocEntry *dicom_tag_doc = f->GetDocEntry(group, elem);
+ GDCM_NAME_SPACE::DataEntry *dicom_tag = dynamic_cast<GDCM_NAME_SPACE::DataEntry *>(dicom_tag_doc);
if( !dicom_tag )
{
std::cerr << "Sorry DataEntry only please" << std::endl;
uint32_t item_xx[4];
is.read((char*)&item_xx, 4*sizeof(uint32_t));
if (verbose)
- std::cout << "item_xx=" << item_xx[0] << " " << item_xx[1] << " "
+ std::cout << std::dec
+ << "item_xx=" << item_xx[0] << " " << item_xx[1] << " "
<< item_xx[2] << " " << item_xx[3] << std::endl;
//std::cout << "0x" << std::hex << is.tellg() << std::dec << std::endl;
assert( item_xx[2] == 77 || item_xx[2] == 205 );