SimpleITK  
sitkImageSeriesReader.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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"
26
27namespace itk::simple
28{
29
70{
71public:
73
75
77
79 std::string
80 ToString() const override;
81
83 std::string
84 GetName() const override
85 {
86 return std::string("ImageSeriesReader");
87 }
88
89
95 void
96 SetMetaDataDictionaryArrayUpdate(bool metaDataDictionaryArrayUpdate)
97 {
98 this->m_MetaDataDictionaryArrayUpdate = metaDataDictionaryArrayUpdate;
99 }
100 bool
105
106
108 void
113 void
118
119
147 static std::vector<PathType>
149 const std::string & seriesID = "",
150 bool useSeriesDetails = false,
151 bool recursive = false,
152 bool loadSequences = false);
153
164 static std::vector<std::string>
165 GetGDCMSeriesIDs(const PathType & directory, bool useSeriesDetails = false);
166
167 void
168 SetFileNames(const std::vector<PathType> & fileNames);
169 const std::vector<PathType> &
171
173 void
174 SetSpacingWarningRelThreshold(double spacingWarningRelThreshold);
175 double
177
183 void
184 SetForceOrthogonalDirection(bool forceOrthogonalDirection);
185 bool
187 void
189 void
191
196 void
197 SetReverseOrder(bool reverseOrder);
198 bool
200 void
202 void
204
205 Image
206 Execute() override;
207
222 std::vector<std::string>
223 GetMetaDataKeys(unsigned int slice) const
224 {
225 return this->m_pfGetMetaDataKeys(slice);
226 }
227
230 bool
231 HasMetaDataKey(unsigned int slice, const std::string & key) const
232 {
233 return this->m_pfHasMetaDataKey(slice, key);
234 }
235
244 std::string
245 GetMetaData(unsigned int slice, const std::string & key) const
246 {
247 return this->m_pfGetMetaData(slice, key);
248 }
249
250
251protected:
252 template <class TImageType>
253 Image
255
256private:
257 // function pointer type
259
260 // friend to get access to executeInternal member
264
265
266 std::function<std::vector<std::string>(int)> m_pfGetMetaDataKeys;
267 std::function<bool(int, const std::string &)> m_pfHasMetaDataKey;
268 std::function<std::string(int, const std::string &)> m_pfGetMetaData;
269
270 // Holder of a process object for active measurements
271 std::unique_ptr<itk::ProcessObject, ProcessObjectDeleter> m_Filter;
272
273
274 std::vector<PathType> m_FileNames;
275
277
279
281
282 bool m_ReverseOrder{ false };
283};
284
310ReadImage(const std::vector<PathType> & fileNames,
311 PixelIDValueEnum outputPixelType = sitkUnknown,
312 const std::string & imageIO = "");
313} // namespace itk::simple
314
315#endif
std::string ToString() const override
std::function< bool(int, const std::string &)> m_pfHasMetaDataKey
Image ExecuteInternal(itk::ImageIOBase *)
std::string GetName() const override
bool HasMetaDataKey(unsigned int slice, const std::string &key) const
Query a meta-data dictionary for the existence of a key.
std::vector< std::string > GetMetaDataKeys(unsigned int slice) const
Get the meta-data dictionary keys for a slice.
Image(Self::* MemberFunctionType)(itk::ImageIOBase *)
static std::vector< std::string > GetGDCMSeriesIDs(const PathType &directory, bool useSeriesDetails=false)
Get all the seriesIDs from a DICOM data set.
bool GetForceOrthogonalDirection() const
std::function< std::vector< std::string >(int)> m_pfGetMetaDataKeys
void SetForceOrthogonalDirection(bool forceOrthogonalDirection)
void SetSpacingWarningRelThreshold(double spacingWarningRelThreshold)
double GetSpacingWarningRelThreshold() const
const std::vector< PathType > & GetFileNames() const
static const detail::MemberFunctionFactory< MemberFunctionType > & GetMemberFunctionFactory()
std::string GetMetaData(unsigned int slice, const std::string &key) const
Get the value of a meta-data dictionary entry as a string.
std::function< std::string(int, const std::string &)> m_pfGetMetaData
void SetFileNames(const std::vector< PathType > &fileNames)
void SetMetaDataDictionaryArrayUpdate(bool metaDataDictionaryArrayUpdate)
std::unique_ptr< itk::ProcessObject, ProcessObjectDeleter > m_Filter
void SetReverseOrder(bool reverseOrder)
static std::vector< PathType > GetGDCMSeriesFileNames(const PathType &directory, const std::string &seriesID="", bool useSeriesDetails=false, bool recursive=false, bool loadSequences=false)
Generate a sequence of filenames from a directory with a DICOM data set and a series ID.
The Image class for SimpleITK.
Definition sitkImage.h:77
A class used to instantiate and generate function object to templated member functions.
std::string PathType
SITKIO_EXPORT Image ReadImage(const PathType &filename, PixelIDValueEnum outputPixelType=sitkUnknown, const std::string &imageIO="")
ReadImage is a procedural interface to the ImageFileReader class which is convenient for most image r...
PixelIDValueEnum
Enumerated values of pixelIDs.
#define SITKIO_EXPORT
Definition sitkIO.h:33