~ubuntu-branches/debian/sid/simpleitk/sid

« back to all changes in this revision

Viewing changes to Code/IO/include/sitkImageSeriesReader.h

  • Committer: Package Import Robot
  • Author(s): Ghislain Antony Vaillant
  • Date: 2017-11-02 08:49:18 UTC
  • Revision ID: package-import@ubuntu.com-20171102084918-7hs09ih668xq87ej
Tags: upstream-1.0.1
ImportĀ upstreamĀ versionĀ 1.0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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"
 
24
#include "sitkMemberFunctionFactory.h"
 
25
 
 
26
namespace itk {
 
27
  namespace simple {
 
28
 
 
29
    /** \class ImageSeriesReader
 
30
     * \brief Read series of image into a SimpleITK image
 
31
     *
 
32
     * \sa itk::simple::ReadImage for the procedural interface
 
33
     **/
 
34
    class SITKIO_EXPORT ImageSeriesReader
 
35
      : public ImageReaderBase
 
36
    {
 
37
    public:
 
38
      typedef ImageSeriesReader Self;
 
39
 
 
40
      ImageSeriesReader();
 
41
 
 
42
      /** Print ourselves to string */
 
43
      virtual std::string ToString() const;
 
44
 
 
45
      /** return user readable name fo the filter */
 
46
      virtual std::string GetName() const { return std::string("ImageSeriesReader"); }
 
47
 
 
48
      /** \brief Generate a sequence of filenames from a directory with a DICOM data set and a series ID.
 
49
       *
 
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 ).
 
56
       *
 
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.
 
62
       *
 
63
       * \sa itk::GDCMSeriesFileNames
 
64
       **/
 
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 );
 
70
 
 
71
      /** \brief Get all the seriesIDs from a DICOM data set
 
72
       *
 
73
       * \param directory  The directory that contains the DICOM data set
 
74
       * \sa itk::GDCMSeriesFileNames
 
75
       **/
 
76
      static std::vector<std::string> GetGDCMSeriesIDs( const std::string &directory );
 
77
 
 
78
      SITK_RETURN_SELF_TYPE_HEADER SetFileNames ( const std::vector<std::string> &fileNames );
 
79
      const std::vector<std::string> &GetFileNames() const;
 
80
 
 
81
      Image Execute();
 
82
 
 
83
    protected:
 
84
 
 
85
      template <class TImageType> Image ExecuteInternal ( itk::ImageIOBase * );
 
86
 
 
87
    private:
 
88
 
 
89
      // function pointer type
 
90
      typedef Image (Self::*MemberFunctionType)( itk::ImageIOBase * );
 
91
 
 
92
      // friend to get access to executeInternal member
 
93
      friend struct detail::MemberFunctionAddressor<MemberFunctionType>;
 
94
      nsstd::auto_ptr<detail::MemberFunctionFactory<MemberFunctionType> > m_MemberFactory;
 
95
 
 
96
      std::vector<std::string> m_FileNames;
 
97
    };
 
98
 
 
99
  /**
 
100
   * \brief ReadImage is a procedural interface to the ImageSeriesReader
 
101
   *     class which is convenient for most image reading tasks.
 
102
   *
 
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
 
110
   *     compounded image.
 
111
   *
 
112
   * \sa itk::simple::ImageFileReader for reading a single file
 
113
   */
 
114
  SITKIO_EXPORT Image ReadImage ( const std::vector<std::string> &fileNames, PixelIDValueEnum outputPixelType=sitkUnknown );
 
115
  }
 
116
}
 
117
 
 
118
#endif