From 98d2a744bb591fe14a627fc9cdf14dab829e3356 Mon Sep 17 00:00:00 2001 From: jpr Date: Thu, 21 Jun 2007 15:01:00 +0000 Subject: [PATCH] gdcm:: --- Example/FlatHashTablePrint.cxx | 10 +++++----- Example/WriteDicomAsJPEG2000.cxx | 22 +++++++++++----------- Example/WriteDicomAsMPEG.cxx | 8 ++++---- Example/exExtractCSA.cxx | 31 ++++++++++++++++++++++--------- Example/exInline.cxx | 8 ++++---- Example/exPrintTime.cxx | 18 +++++++++--------- Example/exPrintWritePrint.cxx | 16 ++++++++-------- Example/exSerieHelper.cxx | 12 ++++++------ Example/toBrainVisa.cxx | 6 +++--- 9 files changed, 72 insertions(+), 59 deletions(-) diff --git a/Example/FlatHashTablePrint.cxx b/Example/FlatHashTablePrint.cxx index 6aa17d22..09b42727 100644 --- a/Example/FlatHashTablePrint.cxx +++ b/Example/FlatHashTablePrint.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: FlatHashTablePrint.cxx,v $ Language: C++ - Date: $Date: 2005/07/08 12:02:02 $ - Version: $Revision: 1.10 $ + Date: $Date: 2007/06/21 15:01:00 $ + Version: $Revision: 1.11 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -30,13 +30,13 @@ int main(int, char*[]) argv[0] << " input_dicom " << std::endl; return 1; } - gdcm::File *header = new gdcm::File(); + GDCM_NAME_SPACE::File *header = new GDCM_NAME_SPACE::File(); header->SetFileName(argv[1] ); header->Load(); - gdcm::TagDocEntryHT *Ht = header->BuildFlatHashTable(); + GDCM_NAME_SPACE::TagDocEntryHT *Ht = header->BuildFlatHashTable(); - for (gdcm::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag) + for (GDCM_NAME_SPACE::TagDocEntryHT::iterator tag = Ht->begin(); tag != Ht->end(); ++tag) { tag->second->Print(); std::cout << std::endl; diff --git a/Example/WriteDicomAsJPEG2000.cxx b/Example/WriteDicomAsJPEG2000.cxx index f0e9ec8e..d864ea17 100644 --- a/Example/WriteDicomAsJPEG2000.cxx +++ b/Example/WriteDicomAsJPEG2000.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomAsJPEG2000.cxx,v $ Language: C++ - Date: $Date: 2006/07/20 17:47:34 $ - Version: $Revision: 1.3 $ + Date: $Date: 2007/06/21 15:01:00 $ + 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 @@ -39,16 +39,16 @@ int main(int argc, char *argv[]) std::cerr << "Using quality: " << quality << std::endl; // Step 1 : Create the header of the image - //gdcm::File *f = new gdcm::File(); + //GDCM_NAME_SPACE::File *f = new GDCM_NAME_SPACE::File(); // gdcm1.3 syntax. Sorry - gdcm::File *f = gdcm::File::New(); - f->SetLoadMode ( gdcm::LD_ALL ); // Load everything + GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New(); + f->SetLoadMode ( GDCM_NAME_SPACE::LD_ALL ); // Load everything f->SetFileName( filename ); f->Load(); - //gdcm::FileHelper *tested = new gdcm::FileHelper( f ); + //GDCM_NAME_SPACE::FileHelper *tested = new GDCM_NAME_SPACE::FileHelper( f ); // gdcm1.3 syntax. Sorry - gdcm::FileHelper *tested = gdcm::FileHelper::New( f ); + GDCM_NAME_SPACE::FileHelper *tested = GDCM_NAME_SPACE::FileHelper::New( f ); std::string PixelType = tested->GetFile()->GetPixelType(); int xsize = f->GetXSize(); int ysize = f->GetYSize(); @@ -61,9 +61,9 @@ int main(int argc, char *argv[]) // Step 1 : Create the header of the image -// gdcm::File *fileToBuild = new gdcm::File(); +// GDCM_NAME_SPACE::File *fileToBuild = new GDCM_NAME_SPACE::File(); // gdcm1.3 syntax. Sorry ! - gdcm::File *fileToBuild = gdcm::File::New(); + GDCM_NAME_SPACE::File *fileToBuild = GDCM_NAME_SPACE::File::New(); std::ostringstream str; @@ -127,9 +127,9 @@ int main(int argc, char *argv[]) fileToBuild->InsertEntryString(str.str(),0x0028,0x0002, "US"); // Samples per Pixel // Step 2 : Create the output image - //gdcm::FileHelper *fileH = new gdcm::FileHelper(fileToBuild); + //GDCM_NAME_SPACE::FileHelper *fileH = new GDCM_NAME_SPACE::FileHelper(fileToBuild); // gdcm1.3 syntax. Sorry ! - gdcm::FileHelper *fileH = gdcm::FileHelper::New(fileToBuild); + GDCM_NAME_SPACE::FileHelper *fileH = GDCM_NAME_SPACE::FileHelper::New(fileToBuild); fileH->SetWriteTypeToJPEG2000( ); fileH->SetImageData(testedImageData, testedDataSize); if( !fileH->Write(outfilename) ) diff --git a/Example/WriteDicomAsMPEG.cxx b/Example/WriteDicomAsMPEG.cxx index 17a6b130..8e106e20 100644 --- a/Example/WriteDicomAsMPEG.cxx +++ b/Example/WriteDicomAsMPEG.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: WriteDicomAsMPEG.cxx,v $ Language: C++ - Date: $Date: 2006/07/26 17:47:39 $ - Version: $Revision: 1.2 $ + Date: $Date: 2007/06/21 15:01:00 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -33,7 +33,7 @@ int main(int argc, char *argv[]) // Step 1 : Create the header of the image - gdcm::File *fileToBuild = gdcm::File::New(); + GDCM_NAME_SPACE::File *fileToBuild = GDCM_NAME_SPACE::File::New(); std::ostringstream str; // Set the image size @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) * samplesPerPixel /* * img.componentSize / 8*/; uint8_t *imageData = new uint8_t[size]; - gdcm::FileHelper *fileH = gdcm::FileHelper::New(fileToBuild); + GDCM_NAME_SPACE::FileHelper *fileH = GDCM_NAME_SPACE::FileHelper::New(fileToBuild); //fileH->SetImageData(imageData,size); std::ifstream mpeg("/tmp/ts.mpg"); mpeg.seekg(0, std::ios::end); diff --git a/Example/exExtractCSA.cxx b/Example/exExtractCSA.cxx index ff5e444a..f3ca03bf 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/06/21 15:01:00 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -180,7 +180,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 ", @@ -216,20 +216,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;kGetEntryString(group, elem); if (dicom_tag_value == gdcm::GDCM_UNFOUND) { gdcm::DictEntry *dictEntry = f->GetPubDict()->GetEntry( group, elem); - std::cerr << "Image doesn't contain any tag: " << dictEntry->GetName() - << std::endl; + 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; } diff --git a/Example/exInline.cxx b/Example/exInline.cxx index c0d08ccf..9a88fd3d 100755 --- a/Example/exInline.cxx +++ b/Example/exInline.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exInline.cxx,v $ Language: C++ - Date: $Date: 2006/06/30 09:54:30 $ - Version: $Revision: 1.2 $ + Date: $Date: 2007/06/21 15:01:00 $ + Version: $Revision: 1.3 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -197,7 +197,7 @@ std::cout<< std::hex <SetFileName( filename ); e1->Load( ); @@ -59,8 +59,8 @@ int main(int, char *[]) if (!e1->IsReadable()) std::cout << "-----------Not Readable " << std::endl; delete e1; - e1= new gdcm::File( ); - e1->SetLoadMode( gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW ); + e1= new GDCM_NAME_SPACE::File( ); + e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW ); r3 = times(&tms3); e1->SetFileName( filename ); e1->Load( ); @@ -95,7 +95,7 @@ int main(int, char *[]) filename += "/"; //doh! filename += gdcmDataImages[i]; - e1= new gdcm::File( ); + e1= new GDCM_NAME_SPACE::File( ); e1->SetFileName( filename ); e1->Load( ); if (!e1->IsReadable()) @@ -120,8 +120,8 @@ int main(int, char *[]) filename += "/"; //doh! filename += gdcmDataImages[i]; - e1= new gdcm::File( ); - e1->SetLoadMode( gdcm::LD_NOSEQ | gdcm::LD_NOSHADOW ); + e1= new GDCM_NAME_SPACE::File( ); + e1->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ | GDCM_NAME_SPACE::LD_NOSHADOW ); e1->SetFileName( filename ); e1->Load( ); if (!e1->IsReadable()) diff --git a/Example/exPrintWritePrint.cxx b/Example/exPrintWritePrint.cxx index 476063b1..f3eee5c3 100644 --- a/Example/exPrintWritePrint.cxx +++ b/Example/exPrintWritePrint.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exPrintWritePrint.cxx,v $ Language: C++ - Date: $Date: 2005/10/18 08:35:44 $ - Version: $Revision: 1.5 $ + Date: $Date: 2007/06/21 15:01:00 $ + Version: $Revision: 1.6 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -20,14 +20,14 @@ int main(int argc, char *argv[]) { - gdcm::File *f; - gdcm::FileHelper *fh; + GDCM_NAME_SPACE::File *f; + GDCM_NAME_SPACE::FileHelper *fh; std::string fileNameToWrite; void *imageData; int dataSize; std::cout << " This program allows to see at a glance" << std::endl; - std::cout << " if the gdcm::File remains unimpaired" << std::endl; + std::cout << " if the GDCM_NAME_SPACE::File remains unimpaired" << std::endl; std::cout << " after a Write" << std::endl; std::cout << " In a future step, we could move it to" << std::endl; std::cout << " gdcm Testing, for a systematic checking"<< std::endl; @@ -55,8 +55,8 @@ int main(int argc, char *argv[]) std::string fileName = argv[1]; std::string mode = argv[2]; - f = new gdcm::File( ); - f->SetLoadMode( gdcm::LD_NOSEQ ); + f = new GDCM_NAME_SPACE::File( ); + f->SetLoadMode( GDCM_NAME_SPACE::LD_NOSEQ ); f->SetFileName( fileName ); f->Load( ); @@ -66,7 +66,7 @@ int main(int argc, char *argv[]) return 0; } - fh = new gdcm::FileHelper(f); + fh = new GDCM_NAME_SPACE::FileHelper(f); // --- f->Print(); diff --git a/Example/exSerieHelper.cxx b/Example/exSerieHelper.cxx index 01e222df..a2fb12ef 100644 --- a/Example/exSerieHelper.cxx +++ b/Example/exSerieHelper.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: exSerieHelper.cxx,v $ Language: C++ - Date: $Date: 2007/06/04 08:51:23 $ - Version: $Revision: 1.11 $ + Date: $Date: 2007/06/21 15:01:00 $ + Version: $Revision: 1.12 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -90,16 +90,16 @@ int main(int argc, char *argv[]) //--------------------------------------------------------- zspacing = s->GetZSpacing(); - // Just to show : GetZSpacing from a gdcm::SerieHelper is right + // Just to show : GetZSpacing from a GDCM_NAME_SPACE::SerieHelper is right std::cout << "GetZSpacing() of sorted SingleSerieUIDFileSet " - << "from gdcm::SerieHelper: " << zspacing << std::endl; + << "from GDCM_NAME_SPACE::SerieHelper: " << zspacing << std::endl; std::cout << " ('-1' means all the files have the same position)" << std::endl; for (std::vector::iterator it = l->begin(); it != l->end(); ++it) { - // Just to show : GetZSpacing from a gdcm::File may be different - std::cout << (*it)->GetFileName() << " --> GetZSpacing() from gdcm::File : " + // Just to show : GetZSpacing from a GDCM_NAME_SPACE::File may be different + std::cout << (*it)->GetFileName() << " --> GetZSpacing() from GDCM_NAME_SPACE::File : " << (*it)->GetZSpacing() << std::endl; } diff --git a/Example/toBrainVisa.cxx b/Example/toBrainVisa.cxx index 2008367f..a1e63692 100755 --- a/Example/toBrainVisa.cxx +++ b/Example/toBrainVisa.cxx @@ -25,7 +25,7 @@ int main (int argc , char *argv[]) { // ============== 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")) { @@ -63,8 +63,8 @@ int main (int argc , char *argv[]) std::cout << "Failed to open [" << fileout << "] for writting" << std::endl; return 0; } - gdcm::File *f = gdcm::File::New(); - f->SetLoadMode( gdcm::LD_ALL); + GDCM_NAME_SPACE::File *f = GDCM_NAME_SPACE::File::New(); + f->SetLoadMode( GDCM_NAME_SPACE::LD_ALL); f->SetFileName( filein ); bool res = f->Load(); -- 2.45.1