Program: gdcm
Module: $RCSfile: gdcmSerieHeader.h,v $
Language: C++
- Date: $Date: 2005/01/06 20:03:28 $
- Version: $Revision: 1.3 $
+ Date: $Date: 2005/01/30 17:22:55 $
+ Version: $Revision: 1.9 $
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See Doc/License.txt or
#ifndef GDCMSERIEHEADER_H
#define GDCMSERIEHEADER_H
-#include "gdcmCommon.h"
+#include "gdcmCommon.h"
#include <list>
-
+#include <map>
namespace gdcm
{
-class Header;
+class File;
+
//-----------------------------------------------------------------------------
-/*
- * \defgroup SerieHeader
+/**
* \brief
- *
* - This class should be used for a stack of 2D dicom images.
- * - For a multiframe dicom image better use directly SerieHeader
-*/
+ * It allows to explore (recursively or not) a directory and
+ * makes a set of 'Coherent Files' list (coherent : same Serie UID)
+ * It allows to sort any of the Coherent File list on the image postion
+ */
class GDCM_EXPORT SerieHeader
{
public:
+ typedef std::list<File* > GdcmFileList;
+ typedef std::map<std::string, GdcmFileList *> CoherentFileListmap;
+
SerieHeader();
~SerieHeader();
+ void Print();
/// \todo should return bool or throw error ?
void AddFileName(std::string const &filename);
- void AddGdcmFile(Header *file);
- void SetDirectory(std::string const &dir);
- void OrderGdcmFileList();
+ void SetDirectory(std::string const &dir, bool recursive=false);
+ void OrderGdcmFileList(GdcmFileList *CoherentGdcmFileList);
- /// \warning Assumes all elements in the list have the same global infos.
- /// Assumes the list is not empty.
- Header *GetGdcmHeader() { return CoherentGdcmFileList.front(); }
-
- typedef std::list<Header* > GdcmHeaderList;
-
- /// \brief Gets the *coherent* File List
- /// @return the *coherent* File List
- const GdcmHeaderList &GetGdcmFileList() { return CoherentGdcmFileList; }
+ /// \brief Gets the FIRST *coherent* File List.
+ /// Deprecated; kept not to break the API
+ /// \note Caller must call OrderGdcmFileList first
+ /// @return the (first) *coherent* File List
+ const GdcmFileList &GetGdcmFileList() { return
+ *CoherentGdcmFileListHT.begin()->second; }
+
+ GdcmFileList *GetFirstCoherentFileList();
+ GdcmFileList *GetNextCoherentFileList();
+ GdcmFileList *GetCoherentFileList(std::string SerieUID);
private:
- bool ImagePositionPatientOrdering();
- bool ImageNumberOrdering();
- bool FileNameOrdering();
+ bool ImagePositionPatientOrdering(GdcmFileList *CoherentGdcmFileList);
+ bool ImageNumberOrdering(GdcmFileList *CoherentGdcmFileList);
+ bool FileNameOrdering(GdcmFileList *CoherentGdcmFileList);
- GdcmHeaderList CoherentGdcmFileList;
+ CoherentFileListmap CoherentGdcmFileListHT;
+ CoherentFileListmap::iterator ItListHt;
};
} // end namespace gdcm