SimpleITK  1.2.4
sitkImageSeriesReader.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef sitkImageSeriesReader_h
19 #define sitkImageSeriesReader_h
20 
21 #include "sitkMacro.h"
22 #include "sitkImage.h"
23 #include "sitkImageReaderBase.h"
25 
26 namespace itk {
27  namespace simple {
28 
46  : public ImageReaderBase
47  {
48  public:
50 
51  virtual ~ImageSeriesReader();
52 
54 
56  virtual std::string ToString() const;
57 
59  virtual std::string GetName() const { return std::string("ImageSeriesReader"); }
60 
61 
67  SITK_RETURN_SELF_TYPE_HEADER SetMetaDataDictionaryArrayUpdate ( bool metaDataDictionaryArrayUpdate )
68  { this->m_MetaDataDictionaryArrayUpdate = metaDataDictionaryArrayUpdate; return *this; }
69  bool GetMetaDataDictionaryArrayUpdate() { return this->m_MetaDataDictionaryArrayUpdate; }
70 
71 
73  SITK_RETURN_SELF_TYPE_HEADER MetaDataDictionaryArrayUpdateOn() { return this->SetMetaDataDictionaryArrayUpdate(true); }
74  SITK_RETURN_SELF_TYPE_HEADER MetaDataDictionaryArrayUpdateOff() { return this->SetMetaDataDictionaryArrayUpdate(false); }
75 
76 
100  static std::vector<std::string> GetGDCMSeriesFileNames( const std::string &directory,
101  const std::string &seriesID = "",
102  bool useSeriesDetails = false,
103  bool recursive = false,
104  bool loadSequences = false );
105 
111  static std::vector<std::string> GetGDCMSeriesIDs( const std::string &directory );
112 
113  SITK_RETURN_SELF_TYPE_HEADER SetFileNames ( const std::vector<std::string> &fileNames );
114  const std::vector<std::string> &GetFileNames() const;
115 
116  Image Execute();
117 
132  std::vector<std::string> GetMetaDataKeys( unsigned int slice ) const { return this->m_pfGetMetaDataKeys(slice); }
133 
136  bool HasMetaDataKey( unsigned int slice, const std::string &key ) const { return this->m_pfHasMetaDataKey(slice, key); }
137 
146  std::string GetMetaData( unsigned int slice, const std::string &key ) const { return this->m_pfGetMetaData(slice, key); }
147 
148 
149  protected:
150 
151  template <class TImageType> Image ExecuteInternal ( itk::ImageIOBase * );
152 
153  private:
154 
155  // function pointer type
156  typedef Image (Self::*MemberFunctionType)( itk::ImageIOBase * );
157 
158  // friend to get access to executeInternal member
159  friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
160  nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
161 
162 
163  nsstd::function<std::vector<std::string>(int)> m_pfGetMetaDataKeys;
164  nsstd::function<bool(int, const std::string &)> m_pfHasMetaDataKey;
165  nsstd::function<std::string(int, const std::string &)> m_pfGetMetaData;
166 
167  // Holder of process object for active measurements
169 
170 
171  std::vector<std::string> m_FileNames;
172 
174  };
175 
193  SITKIO_EXPORT Image ReadImage ( const std::vector<std::string> &fileNames,
194  PixelIDValueEnum outputPixelType=sitkUnknown,
195  const std::string &imageIO="");
196  }
197 }
198 
199 #endif
An abract base class for image readers.
bool HasMetaDataKey(unsigned int slice, const std::string &key) const
Query a meta-data dictionary for the existence of a key.
nsstd::function< std::string(int, const std::string &)> m_pfGetMetaData
PixelIDValueEnum
Enumerated values of pixelIDs.
Read series of image files into a SimpleITK image.
std::vector< std::string > m_FileNames
SITKIO_EXPORT Image ReadImage(const std::string &filename, PixelIDValueEnum outputPixelType=sitkUnknown, const std::string &imageIO="")
ReadImage is a procedural interface to the ImageFileReader class which is convenient for most image r...
virtual std::string GetName() const
nsstd::auto_ptr< detail::MemberFunctionFactory< MemberFunctionType > > m_MemberFactory
std::vector< std::string > GetMetaDataKeys(unsigned int slice) const
Get the meta-data dictionary keys for a slice.
#define SITKIO_EXPORT
Definition: sitkIO.h:33
The Image class for SimpleITK.
Definition: sitkImage.h:78
std::string GetMetaData(unsigned int slice, const std::string &key) const
Get the value of a meta-data dictionary entry as a string.
nsstd::function< bool(int, const std::string &)> m_pfHasMetaDataKey
Self & SetMetaDataDictionaryArrayUpdate(bool metaDataDictionaryArrayUpdate)