00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
#ifndef __itkDICOMSeriesFileNames_h
00018
#define __itkDICOMSeriesFileNames_h
00019
00020
#ifdef _MSC_VER
00021
#pragma warning ( disable : 4786 )
00022
#endif
00023
00024
#include "itkObject.h"
00025
#include "itkObjectFactory.h"
00026
#include "itkExceptionObject.h"
00027
#include <vector>
00028
00029
#include "DICOMParser.h"
00030
#include "DICOMAppHelper.h"
00031
00032
namespace itk
00033 {
00034
00048 class ITK_EXPORT DICOMSeriesFileNames :
public Object
00049 {
00050
public:
00052 typedef DICOMSeriesFileNames
Self;
00053 typedef Object Superclass;
00054 typedef SmartPointer<Self> Pointer;
00055
00057
itkNewMacro(
Self);
00058
00060
itkTypeMacro(DICOMSeriesFileNames,
Object);
00061
00062
00063
00073 void SetDirectory(
const std::string& dir)
00074 {
00075
if (m_Directory != dir)
00076 {
00077 m_Directory = dir;
00078 this->Modified();
00079
00080
00081 m_SeriesUIDs.clear();
00082 m_FileNames.clear();
00083 m_AppHelper.Clear();
00084 }
00085
00086
00087
00088
00089
00090
00091 m_DirectorySetTime.Modified();
00092 }
00093
00095
itkGetStringMacro(
Directory);
00096
00100
const std::vector<std::string> &GetSeriesUIDs(
bool recursive =
false);
00101
00105
const std::vector<std::string> &GetFileNames (
bool recursive =
false);
00106
00111
const std::vector<std::string> &GetFileNames (
const std::string& seriesUID,
00112
bool recursive =
false);
00113
00118
typedef enum {SortByImageNumber, SortBySliceLocation, SortByImagePositionPatient} FileNameSortingOrderType;
00119 itkSetMacro(FileNameSortingOrder, FileNameSortingOrderType);
00120
itkGetMacro(FileNameSortingOrder, FileNameSortingOrderType);
00121
void SetFileNameSortingOrderToSortByImageNumber()
00122 { this->SetFileNameSortingOrder(SortByImageNumber); }
00123
void SetFileNameSortingOrderToSortBySliceLocation()
00124 { this->SetFileNameSortingOrder(SortBySliceLocation); }
00125
void SetFileNameSortingOrderToSortByImagePositionPatient()
00126 { this->SetFileNameSortingOrder(SortByImagePositionPatient); }
00127
00131 std::string GetFileName(
const std::string& instanceUID);
00132
00133
00134
protected:
00135 DICOMSeriesFileNames();
00136 ~DICOMSeriesFileNames() {};
00137
void PrintSelf(std::ostream& os, Indent indent)
const;
00138
00139
private:
00140 DICOMSeriesFileNames(
const Self&);
00141
void operator=(
const Self&);
00142
00143
int CanReadFile(
const char* fname);
00144
void RecurseDirectory( std::string directory, std::vector<std::string> &filenames);
00145
00146 DICOMParser m_Parser;
00147 DICOMAppHelper m_AppHelper;
00148
00149 std::string m_Directory;
00150 std::vector<std::string> m_FileNames;
00151 std::vector<std::string> m_SeriesUIDs;
00152
00153 FileNameSortingOrderType m_FileNameSortingOrder;
00154
00155
TimeStamp m_DirectorySetTime;
00156
TimeStamp m_DirectoryScanTime;
00157 };
00158
00159 }
00160
00161
#endif // __itkDICOMSeriesFileNames_h