From bbfa3cf89fc2ede7c43259e945f021044b56069f Mon Sep 17 00:00:00 2001 From: jpr Date: Wed, 2 Feb 2005 14:26:30 +0000 Subject: [PATCH] Strange name gdcm::SerieHeader turned to gdcm::SerieHelper --- Example/CMakeLists.txt | 2 +- .../{makeDicomDir.cxx => MakeDicomDir.cxx} | 6 +- Example/TestChangeHeader.cxx | 8 +- Example/TestCopyDicom.cxx | 14 ++-- Testing/CMakeLists.txt | 2 +- Testing/TestSerieHelper.cxx | 73 +++++++++++++++++++ src/CMakeLists.txt | 2 +- src/gdcmDocEntrySet.h | 22 +++--- 8 files changed, 100 insertions(+), 29 deletions(-) rename Example/{makeDicomDir.cxx => MakeDicomDir.cxx} (94%) create mode 100644 Testing/TestSerieHelper.cxx diff --git a/Example/CMakeLists.txt b/Example/CMakeLists.txt index 45160677..99404d4b 100644 --- a/Example/CMakeLists.txt +++ b/Example/CMakeLists.txt @@ -8,7 +8,7 @@ SET(EXAMPLE_SOURCES BuildUpDicomDir FindTags FlatHashTablePrint - makeDicomDir + MakeDicomDir PrintDocument PrintFile PrintHeader diff --git a/Example/makeDicomDir.cxx b/Example/MakeDicomDir.cxx similarity index 94% rename from Example/makeDicomDir.cxx rename to Example/MakeDicomDir.cxx index 81e3b9cf..9f9ac06b 100644 --- a/Example/makeDicomDir.cxx +++ b/Example/MakeDicomDir.cxx @@ -1,10 +1,10 @@ /*========================================================================= Program: gdcm - Module: $RCSfile: makeDicomDir.cxx,v $ + Module: $RCSfile: MakeDicomDir.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:06:32 $ - Version: $Revision: 1.12 $ + Date: $Date: 2005/02/02 14:26:30 $ + 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 diff --git a/Example/TestChangeHeader.cxx b/Example/TestChangeHeader.cxx index 4e8b7503..1d74abe2 100644 --- a/Example/TestChangeHeader.cxx +++ b/Example/TestChangeHeader.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestChangeHeader.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:06:31 $ - Version: $Revision: 1.13 $ + Date: $Date: 2005/02/02 14:26:30 $ + Version: $Revision: 1.14 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -26,7 +26,7 @@ int main(int argc, char *argv[]) if (argc < 3) { std::cerr << "usage :" << std::endl << - argv[0] << " nomFichierPourEntete nomFichierPourDonnées" << + argv[0] << " fileNameForHeader fileNameForData" << std::endl; return 1; } @@ -55,5 +55,3 @@ int main(int argc, char *argv[]) return 0; } - - diff --git a/Example/TestCopyDicom.cxx b/Example/TestCopyDicom.cxx index 423a3ded..554f3a5c 100644 --- a/Example/TestCopyDicom.cxx +++ b/Example/TestCopyDicom.cxx @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: TestCopyDicom.cxx,v $ Language: C++ - Date: $Date: 2005/02/02 10:06:31 $ - Version: $Revision: 1.23 $ + Date: $Date: 2005/02/02 14:26:30 $ + Version: $Revision: 1.24 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -57,7 +57,7 @@ bool RemoveFile(const char *source) // Here we load a gdcmFile and then try to create from scratch a copy of it, // copying field by field the dicom image -int main(int argc, char* argv[]) +int main(int argc, char *argv[]) { if (argc < 3) { @@ -112,10 +112,10 @@ int main(int argc, char* argv[]) else { // We skip pb of SQ recursive exploration - //std::cout << "Skipped Sequence " - // << "------------- " << d->GetVR() << " "<< std::hex - // << d->GetGroup() << " " << d->GetElement() - // << std::endl; + std::cout << "Skipped Sequence " + << "------------- " << d->GetVR() << " "<< std::hex + << d->GetGroup() << "," << d->GetElement() + << std::endl; } d=original->GetFile()->GetNextEntry(); diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt index b3519641..a2475543 100644 --- a/Testing/CMakeLists.txt +++ b/Testing/CMakeLists.txt @@ -22,7 +22,6 @@ SET(TEST_SOURCES # add tests that require data IF (GDCM_DATA_ROOT) SET(TEST_SOURCES ${TEST_SOURCES} - TestSerieHeader # uses gdcmData as a default root directory TestReadWriteReadCompare.cxx # includes generated gdcmDataImages.h TestPrintAllDocument.cxx # includes generated gdcmDataImages.h TestAllReadCompareDicom.cxx # includes generated gdcmDataImages.h @@ -34,6 +33,7 @@ IF (GDCM_DATA_ROOT) TestBuildUpDicomDir.cxx # writes a file named "NewDICOMDIR" TestMakeDicomDir.cxx # writes a file named "NewDICOMDIR" TestDirList.cxx + TestSerieHelper # uses gdcmData as a default root directory ) # add test that require VTK: IF(GDCM_VTK) diff --git a/Testing/TestSerieHelper.cxx b/Testing/TestSerieHelper.cxx new file mode 100644 index 00000000..a36cfdef --- /dev/null +++ b/Testing/TestSerieHelper.cxx @@ -0,0 +1,73 @@ +/*========================================================================= + + Program: gdcm + Module: $RCSfile: TestSerieHelper.cxx,v $ + Language: C++ + Date: $Date: 2005/02/02 14:26:34 $ + 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 "gdcmSerieHelper.h" +#include "gdcmFile.h" +#include "gdcmDebug.h" +#include + +typedef std::list GdcmFileList; + +int TestSerieHelper(int argc, char* argv[]) +{ + gdcm::SerieHelper *s; + + std::string dirName; + if (argc > 1) + dirName = argv[1]; + else + { + dirName = GDCM_DATA_ROOT; + } + + //if (argc > 2) + // gdcm::Debug::SetDebugOn(); + + std::cout << "Dir Name :[" << dirName << "]" << std::endl; + + s = new gdcm::SerieHelper(); + s->SetDirectory(dirName, true); // true : recursive exploration + std::cout << " -------------------------------------------Finish parsing :[" + << dirName << "]" << std::endl; + + s->Print(); + std::cout << " -----------------------------------------Finish printing (1)" + << std::endl; + + int nbFiles; + // For all the Coherent Files lists of the gdcm::Serie + GdcmFileList *l = s->GetFirstCoherentFileList(); + while (l) + { + nbFiles = l->size() ; + if ( l->size() > 3 ) // Why not ? Just an example, for testing + { + std::cout << "Sort list : " << nbFiles << " long" << std::endl; + s->OrderGdcmFileList(l); // sort the list + } + l = s->GetNextCoherentFileList(); + } + std::cout << " ----------------------------------------------Finish sorting" + << std::endl; + s->Print(); // Prints all the Coherent Files lists (sorted or not) + std::cout << " ---------------------------------------------Finish printing" + << std::endl; + + delete s; + + return 0; +} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 29b710f9..69c3e2f8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,7 +49,7 @@ SET(libgdcm_la_SOURCES gdcmRLEFrame.cxx gdcmRLEFramesInfo.cxx gdcmSeqEntry.cxx - gdcmSerieHeader.cxx + gdcmSerieHelper.cxx gdcmSQItem.cxx gdcmTS.cxx gdcmUtil.cxx diff --git a/src/gdcmDocEntrySet.h b/src/gdcmDocEntrySet.h index 9eaa474b..7ac500c8 100644 --- a/src/gdcmDocEntrySet.h +++ b/src/gdcmDocEntrySet.h @@ -3,8 +3,8 @@ Program: gdcm Module: $RCSfile: gdcmDocEntrySet.h,v $ Language: C++ - Date: $Date: 2005/01/26 11:42:02 $ - Version: $Revision: 1.45 $ + Date: $Date: 2005/02/02 14:26:34 $ + Version: $Revision: 1.46 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -69,9 +69,9 @@ public: /// \brief adds any type of entry to the entry set virtual bool AddEntry(DocEntry *Entry) = 0; /// \brief Removes any type of entry out of the entry set, and destroys it - virtual bool RemoveEntry(DocEntry *EntryToRemove)=0; + virtual bool RemoveEntry(DocEntry *EntryToRemove) = 0; /// \brief Removes any type of entry out of the entry set, DOESN'T destroy it - virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove)= 0; + virtual bool RemoveEntryNoDestroy(DocEntry *EntryToRemove) = 0; virtual DocEntry *GetFirstEntry()=0; virtual DocEntry *GetNextEntry()=0; @@ -82,13 +82,13 @@ public: virtual std::string GetEntryVR(uint16_t group, uint16_t elem); /// \brief Gets any type of DocEntry, identified by its (group,elem) - virtual DocEntry *GetDocEntry(uint16_t group,uint16_t elem) = 0; - /// \brief Gets a ValEntry, identified by its (group,elem) - virtual ValEntry *GetValEntry(uint16_t group,uint16_t elem); + virtual DocEntry *GetDocEntry(uint16_t group, uint16_t elem) = 0; + /// \brief Gets a ValEntry, identified by its (group, elem) + virtual ValEntry *GetValEntry(uint16_t group, uint16_t elem); /// \brief Gets a BinEntry, identified by its (group,elem) - virtual BinEntry *GetBinEntry(uint16_t group,uint16_t elem); + virtual BinEntry *GetBinEntry(uint16_t group, uint16_t elem); /// \brief Gets a SeqEntry, identified by its (group,elem) - virtual SeqEntry *GetSeqEntry(uint16_t group,uint16_t elem); + virtual SeqEntry *GetSeqEntry(uint16_t group, uint16_t elem); virtual bool SetValEntry(std::string const &content, uint16_t group, uint16_t elem); @@ -116,9 +116,9 @@ public: // DocEntry related utilities ValEntry *NewValEntry(uint16_t group,uint16_t elem, TagName const &vr = GDCM_UNKNOWN); - BinEntry *NewBinEntry(uint16_t group,uint16_t elem, + BinEntry *NewBinEntry(uint16_t group, uint16_t elem, TagName const &vr = GDCM_UNKNOWN); - SeqEntry *NewSeqEntry(uint16_t group,uint16_t elem); + SeqEntry *NewSeqEntry(uint16_t group, uint16_t elem); protected: // DictEntry related utilities -- 2.45.1