X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Example%2FexExtractCSA.cxx;h=a1368f9bd8d0006bb2b8c8a1263d75dbbe3c16b5;hb=28a3ba592eab9953ff1840d19357ae0db5e3e6a1;hp=ff5e444acf4d353c18ed38bb127fdc2c1b3dc2f4;hpb=7dc67f3f6c048f30c66765c15710ceaa82f228e9;p=gdcm.git diff --git a/Example/exExtractCSA.cxx b/Example/exExtractCSA.cxx index ff5e444a..a1368f9b 100755 --- a/Example/exExtractCSA.cxx +++ b/Example/exExtractCSA.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exExtractCSA.cxx,v $ Language: C++ - Date: $Date: 2007/06/15 13:18:51 $ - Version: $Revision: 1.2 $ + Date: $Date: 2007/10/03 09:14:55 $ + Version: $Revision: 1.8 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -43,19 +43,6 @@ #include "gdcmSQItem.h" #include "gdcmArgMgr.h" -// Looks like there is mapping in between syngodt and vr... -// O <=> UN -// 3 <=> DS -// 4 <=> FD -// 5 <=> FL -// 6 <=> IS -// 9 <=> UL -// 10 <=> US -// 16 <=> CS -// 19 <=> LO -// 20 <=> LT -// 22 <=> SH -// 25 <=> UI // -------------------------------------------------------- @@ -87,12 +74,27 @@ struct equ char vr[2+1]; }; +// Looks like there is mapping in between syngodt and vr... +// O <=> UN +// 3 <=> DS +// 4 <=> FD +// 5 <=> FL +// 6 <=> IS +// 9 <=> UL +// 10 <=> US +// 16 <=> CS +// 19 <=> LO +// 20 <=> LT +// 22 <=> SH +// 25 <=> UI static equ mapping[] = { { 0 , "UN" }, { 3 , "DS" }, { 4 , "FD" }, { 5 , "FL" }, { 6 , "IS" }, + { 7 , "SL" }, + { 8 , "SS" }, { 9 , "UL" }, { 10 , "US" }, { 16 , "CS" }, @@ -101,6 +103,7 @@ static equ mapping[] = { { 22 , "SH" }, { 23 , "ST" }, { 25 , "UI" }, + { 27 , "UT" } }; bool check_mapping(uint32_t syngodt, const char *vr) @@ -122,7 +125,7 @@ bool check_mapping(uint32_t syngodt, const char *vr) } - ///\to fix the Desctructor! + ///\to fix the Destructor! void DeleteCSA_content (CSA_content &myMap) { for ( CSA_content::const_iterator it = myMap.begin(); it != myMap.end(); @@ -180,7 +183,7 @@ int main(int argc, char *argv[]) " 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 ", @@ -196,7 +199,7 @@ int main(int argc, char *argv[]) { am->ArgMgrUsage(usage); // Display 'usage' delete am; - return 0; + return 1; } if (am->ArgMgrDefined("debug")) @@ -216,20 +219,26 @@ int main(int argc, char *argv[]) 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;kArgMgrUsage(usage); delete am; - return 0; + return 1; } delete am; // ------ we don't need Arguments Manager any longer ------ @@ -246,14 +255,14 @@ int main(int argc, char *argv[]) // 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(); @@ -282,18 +291,25 @@ for (int tag_no=0; tag_noGetEntryString(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(dicom_tag_doc); + GDCM_NAME_SPACE::DocEntry *dicom_tag_doc = f->GetDocEntry(group, elem); + GDCM_NAME_SPACE::DataEntry *dicom_tag = dynamic_cast(dicom_tag_doc); if( !dicom_tag ) { std::cerr << "Sorry DataEntry only please" << std::endl; @@ -314,7 +330,10 @@ for (int tag_no=0; tag_no