+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
#include "gdcmUtil.h"
#include <string>
+#include <algorithm>
#include <sys/types.h>
#include <errno.h>
for(gdcmDirList::iterator it=fileList.begin();
it!=fileList.end(); ++it)
{
-// std::cout<<*it<<std::endl;
header=new gdcmHeader(it->c_str());
if(header->IsReadable())
list.push_back(header);
delete header;
}
+ std::sort(list.begin(),list.end(),gdcmDicomDir::HeaderLessThan);
+
SetElements(path,list);
}
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"<<std::endl;
end=i;
AddObjectToEnd(type,begin,end);
if(v=="STUDY ")
{
- // std::cout<<"STUDY"<<std::endl;
end=i;
AddObjectToEnd(type,begin,end);
if(v=="SERIES")
{
- // std::cout<<"SERIES"<<std::endl;
end=i;
AddObjectToEnd(type,begin,end);
if(v=="IMAGE ")
{
- // std::cout<<"IMAGE"<<std::endl;
end=i;
AddObjectToEnd(type,begin,end);
ListTag::iterator debPat=listEntries.begin();
for(ListHeader::iterator it=list.begin();it!=list.end();++it)
{
- // get the current file characteristics
+ // get the current file characteristics
patCurName=(*it)->GetEntryByNumber(0x0010,0x0010);
patCurID=(*it)->GetEntryByNumber(0x0010,0x0011);
studCurInstanceUID=(*it)->GetEntryByNumber(0x0020,0x000d);
}
}
+bool gdcmDicomDir::HeaderLessThan(gdcmHeader *header1,gdcmHeader *header2)
+{
+ return(*header1<*header2);
+}
+
//-----------------------------------------------------------------------------
#include "gdcmPatient.h"
#include "gdcmDicomDirElement.h"
+#include <list>
+#include <vector>
+
//-----------------------------------------------------------------------------
typedef std::list<gdcmPatient *> ListPatient;
-typedef std::list<gdcmHeader *> ListHeader;
+typedef std::vector<gdcmHeader *> ListHeader;
//-----------------------------------------------------------------------------
/*
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;
};