1
/*=========================================================================
3
* Copyright Insight Software Consortium
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
9
* http://www.apache.org/licenses/LICENSE-2.0.txt
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.
17
*=========================================================================*/
18
#ifndef sitkImageSeriesReader_h
19
#define sitkImageSeriesReader_h
21
#include "sitkMacro.h"
22
#include "sitkImage.h"
23
#include "sitkImageReaderBase.h"
24
#include "sitkMemberFunctionFactory.h"
29
/** \class ImageSeriesReader
30
* \brief Read series of image into a SimpleITK image
32
* \sa itk::simple::ReadImage for the procedural interface
34
class SITKIO_EXPORT ImageSeriesReader
35
: public ImageReaderBase
38
typedef ImageSeriesReader Self;
42
/** Print ourselves to string */
43
virtual std::string ToString() const;
45
/** return user readable name fo the filter */
46
virtual std::string GetName() const { return std::string("ImageSeriesReader"); }
48
/** \brief Generate a sequence of filenames from a directory with a DICOM data set and a series ID.
50
* This method generates a sequence of filenames whose filenames
51
* point to DICOM files. The data set may contain multiple series.
52
* The seriesID string is used to select a specific series. The
53
* ordering of the filenames is based of one of several strategies,
54
* which will read all images in the directory ( assuming there is
55
* only one study/series ).
57
* \param directory Set the directory that contains the DICOM data set.
58
* \param recursive Recursively parse the input directory.
59
* \param seriesID Set the name that identifies a particular series. Default value is an empty string which will return the file names associated with the first series found in the directory.
60
* \param useSeriesDetails Use additional series information such as ProtocolName and SeriesName to identify when a single SeriesUID contains multiple 3D volumes - as can occur with perfusion and DTI imaging.
61
* \param loadSequences Parse any sequences in the DICOM data set. Loading DICOM files is faster when sequences are not needed.
63
* \sa itk::GDCMSeriesFileNames
65
static std::vector<std::string> GetGDCMSeriesFileNames( const std::string &directory,
66
const std::string &seriesID = "",
67
bool useSeriesDetails = false,
68
bool recursive = false,
69
bool loadSequences = false );
71
/** \brief Get all the seriesIDs from a DICOM data set
73
* \param directory The directory that contains the DICOM data set
74
* \sa itk::GDCMSeriesFileNames
76
static std::vector<std::string> GetGDCMSeriesIDs( const std::string &directory );
78
SITK_RETURN_SELF_TYPE_HEADER SetFileNames ( const std::vector<std::string> &fileNames );
79
const std::vector<std::string> &GetFileNames() const;
85
template <class TImageType> Image ExecuteInternal ( itk::ImageIOBase * );
89
// function pointer type
90
typedef Image (Self::*MemberFunctionType)( itk::ImageIOBase * );
92
// friend to get access to executeInternal member
93
friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
94
nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
96
std::vector<std::string> m_FileNames;
100
* \brief ReadImage is a procedural interface to the ImageSeriesReader
101
* class which is convenient for most image reading tasks.
103
* Note that when reading a series of images that have meta-data
104
* associated with them (e.g. a DICOM series) the resulting
105
* image will have an empty meta-data dictionary. It is possible to
106
* programmatically add a meta-data dictionary to the compounded image by reading in
107
* one or more images from the series using the ImageFileReader
108
* class, analyzing the meta-dictionary associated with each of
109
* those images and creating one that is relevant for the
112
* \sa itk::simple::ImageFileReader for reading a single file
114
SITKIO_EXPORT Image ReadImage ( const std::vector<std::string> &fileNames, PixelIDValueEnum outputPixelType=sitkUnknown );