RTK  2.0.1
Reconstruction Toolkit
rtkImportImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright RTK 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 
19 #ifndef rtkImportImageFilter_h
20 #define rtkImportImageFilter_h
21 
22 #include "itkImageSource.h"
23 #include "rtkMacro.h"
24 
25 namespace rtk
26 {
43 template< typename TImage >
44 class ImportImageFilter : public itk::ImageSource<TImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_ASSIGN(ImportImageFilter);
48 
50  using OutputImagePointer = typename TImage::Pointer;
51  using SpacingType = typename TImage::SpacingType;
52  using OriginType = typename TImage::PointType;
53 
59 
61  itkNewMacro(Self);
62 
64  itkTypeMacro(ImportImageFilter, ImageSource);
65 
68 
72 
76 
78  using PixelType = typename TImage::PixelType;
79 
82 
91  bool LetFilterManageMemory);
92 
97  void SetRegion(const RegionType & region)
98  { if ( m_Region != region ) { m_Region = region; this->Modified(); } }
99 
104  const RegionType & GetRegion() const
105  { return m_Region; }
106 
109  itkSetMacro(Spacing, SpacingType);
110  itkGetConstReferenceMacro(Spacing, SpacingType);
111  itkSetVectorMacro(Spacing, const float, TImage::ImageDimension);
113 
116  itkSetMacro(Origin, OriginType);
117  itkGetConstReferenceMacro(Origin, OriginType);
118  itkSetVectorMacro(Origin, const float, TImage::ImageDimension);
120 
122 
125  virtual void SetDirection(const DirectionType & direction);
126 
129  itkGetConstReferenceMacro(Direction, DirectionType);
130 
131 protected:
133  ~ImportImageFilter() override;
134  void PrintSelf(std::ostream & os, itk::Indent indent) const override;
135 
138  void GenerateData() override;
139 
143  void GenerateOutputInformation() override;
144 
152  void EnlargeOutputRequestedRegion(itk::DataObject *output) override;
153 
154 private:
159 
163 };
164 } // end namespace itk
165 
166 #ifndef ITK_MANUAL_INSTANTIATION
167 #include "rtkImportImageFilter.hxx"
168 #endif
169 
170 #endif
TPixel * GetImportPointer()
void SetRegion(const RegionType &region)
void PrintSelf(std::ostream &os, Indent indent) const override
void EnlargeOutputRequestedRegion(DataObject *output) override
void GenerateOutputInformation() override
typename TImage::Pointer OutputImagePointer
virtual void SetDirection(const DirectionType &direction)
typename TImage::PointType OriginType
void SetImportPointer(TPixel *ptr, SizeValueType num, bool LetImageContainerManageMemory)
void GenerateData() override
const RegionType & GetRegion() const
~ImportImageFilter() override=default
typename TImage::PixelType PixelType
::itk::SizeValueType SizeValueType
typename TImage::SpacingType SpacingType
typename SizeType::SizeValueType SizeValueType
#define itkSetMacro(name, type)