From e503428831ed53cbd0d206d87ac25bac3254af2b Mon Sep 17 00:00:00 2001 From: regrain Date: Wed, 4 Feb 2004 13:27:55 +0000 Subject: [PATCH] * FIX : sort the images in the dicom dir -- BeNours --- ChangeLog | 5 +++++ src/gdcmDicomDir.cxx | 18 +++++++++--------- src/gdcmDicomDir.h | 7 ++++++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 973aeda3..1ba6d046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-02-04 Benoit Regrain + * FIX : sort the images in the dicom dir + * FIX : Bug fix for python use of dicom dir + * Add a python demo + 2004-02-04 Jean-Pierre Roux * FIX : Final solution (?) for icone embedded images * FIX : dicomVR.dic Overlay group is not *only* 6000, but 60xxx diff --git a/src/gdcmDicomDir.cxx b/src/gdcmDicomDir.cxx index cc371276..92cdc6f8 100644 --- a/src/gdcmDicomDir.cxx +++ b/src/gdcmDicomDir.cxx @@ -8,6 +8,7 @@ #include "gdcmUtil.h" #include +#include #include #include @@ -133,7 +134,6 @@ void gdcmDicomDir::NewDicomDir(std::string path) for(gdcmDirList::iterator it=fileList.begin(); it!=fileList.end(); ++it) { -// std::cout<<*it<c_str()); if(header->IsReadable()) list.push_back(header); @@ -141,6 +141,8 @@ void gdcmDicomDir::NewDicomDir(std::string path) delete header; } + std::sort(list.begin(),list.end(),gdcmDicomDir::HeaderLessThan); + SetElements(path,list); } @@ -187,13 +189,9 @@ void gdcmDicomDir::CreateDicomDir() end=begin; for(ListTag::iterator i=listEntries.begin();i !=listEntries.end();++i) { - // std::cout << std::hex <<(*i)->GetGroup() << - // " " <<(*i)->GetElement() << endl; - std::string v=(*i)->GetValue(); if(v=="PATIENT ") { - // std::cout<<"PATIENT"<GetEntryByNumber(0x0010,0x0010); patCurID=(*it)->GetEntryByNumber(0x0010,0x0011); studCurInstanceUID=(*it)->GetEntryByNumber(0x0020,0x000d); @@ -484,4 +479,9 @@ void gdcmDicomDir::SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader } } +bool gdcmDicomDir::HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2) +{ + return(*header1<*header2); +} + //----------------------------------------------------------------------------- diff --git a/src/gdcmDicomDir.h b/src/gdcmDicomDir.h index b0bc7453..3604104e 100644 --- a/src/gdcmDicomDir.h +++ b/src/gdcmDicomDir.h @@ -8,9 +8,12 @@ #include "gdcmPatient.h" #include "gdcmDicomDirElement.h" +#include +#include + //----------------------------------------------------------------------------- typedef std::list ListPatient; -typedef std::list ListHeader; +typedef std::vector ListHeader; //----------------------------------------------------------------------------- /* @@ -61,6 +64,8 @@ private: void SetElements(std::string &path,ListHeader &list); void SetElement(std::string &path,gdcmDicomDirType type,gdcmHeader *header); + static bool HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2); + ListPatient patients; }; -- 2.46.2