Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef MITKDICOMSERIESREADER_H_
00019 #define MITKDICOMSERIESREADER_H_
00020
00021 #include <mitkDataNode.h>
00022 #include <mitkConfig.h>
00023
00024 #ifdef MITK_USE_GDCMIO
00025 #include <itkGDCMImageIO.h>
00026 #else
00027 #include <itkDICOMImageIO2.h>
00028 #endif
00029
00030 #include <gdcmConfigure.h>
00031
00032 #if GDCM_MAJOR_VERSION >= 2
00033 #include <gdcmDataSet.h>
00034 #endif
00035
00036 #include <itkCommand.h>
00037
00038 namespace mitk
00039 {
00040
00049 class MITK_CORE_EXPORT DicomSeriesReader
00050 {
00051 public:
00052 typedef std::vector<std::string> StringContainer;
00053 typedef std::map<std::string, StringContainer> UidFileNamesMap;
00054 typedef void (*UpdateCallBackMethod)(float);
00055
00060 static DataNode::Pointer LoadDicomSeries(const StringContainer &filenames, UpdateCallBackMethod callback = 0);
00061
00066 static bool LoadDicomSeries(const StringContainer &filenames, DataNode &node, UpdateCallBackMethod callback = 0);
00067
00071 static bool IsDicom(const std::string &filename);
00072
00079 static UidFileNamesMap GetSeries(const std::string &dir, bool additional_criteria = false,
00080 const StringContainer &restrictions = StringContainer());
00081
00088 static StringContainer GetSeries(const std::string &dir, const std::string &series_uid,
00089 bool additional_criteria = false, const StringContainer &restrictions = StringContainer());
00090 protected:
00091 inline DicomSeriesReader()
00092 {}
00093
00094 inline ~DicomSeriesReader()
00095 {}
00096
00097 #ifdef MITK_USE_GDCMIO
00098 typedef itk::GDCMImageIO DcmIoType;
00099 #else
00100 typedef itk::DICOMImageIO2 DcmIoType;
00101 #endif
00102
00103 class CallbackCommand : public itk::Command
00104 {
00105 public:
00106 inline CallbackCommand(UpdateCallBackMethod callback)
00107 : m_Callback(callback)
00108 {}
00109
00110 inline void Execute(const itk::Object *caller, const itk::EventObject&)
00111 {
00112 (*this->m_Callback)(static_cast<const itk::ProcessObject*>(caller)->GetProgress());
00113 }
00114
00115 inline void Execute(itk::Object *caller, const itk::EventObject&)
00116 {
00117 (*this->m_Callback)(static_cast<itk::ProcessObject*>(caller)->GetProgress());
00118 }
00119 protected:
00120 UpdateCallBackMethod m_Callback;
00121 };
00122
00126 template <typename PixelType>
00127 static void LoadDicom(const StringContainer &filenames, DataNode &node, UpdateCallBackMethod callback);
00128
00129 #if GDCM_MAJOR_VERSION >= 2
00130
00131
00132
00133
00134 static bool GdcmSortFunction(const gdcm::DataSet &ds1, const gdcm::DataSet &ds2);
00135 #endif
00136 };
00137
00138 }
00139
00140 #include <mitkDicomSeriesReader.txx>
00141
00142 #endif