RTK  2.1.0
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 
81  PixelType *
83 
91  void
92  SetImportPointer(PixelType * ptr, SizeValueType num, bool LetFilterManageMemory);
93 
98  void
99  SetRegion(const RegionType & region)
100  {
101  if (m_Region != region)
102  {
103  m_Region = region;
104  this->Modified();
105  }
106  }
108 
113  const RegionType &
114  GetRegion() const
115  {
116  return m_Region;
117  }
118 
121  itkSetMacro(Spacing, SpacingType);
122  itkGetConstReferenceMacro(Spacing, SpacingType);
123  itkSetVectorMacro(Spacing, const float, TImage::ImageDimension);
125 
128  itkSetMacro(Origin, OriginType);
129  itkGetConstReferenceMacro(Origin, OriginType);
130  itkSetVectorMacro(Origin, const float, TImage::ImageDimension);
132 
134 
137  virtual void
138  SetDirection(const DirectionType & direction);
139 
142  itkGetConstReferenceMacro(Direction, DirectionType);
143 
144 protected:
146  ~ImportImageFilter() override;
147  void
148  PrintSelf(std::ostream & os, itk::Indent indent) const override;
149 
152  void
153  GenerateData() override;
154 
158  void
159  GenerateOutputInformation() override;
160 
168  void
170 
171 private:
176 
180 };
181 } // namespace rtk
182 
183 #ifndef ITK_MANUAL_INSTANTIATION
184 # include "rtkImportImageFilter.hxx"
185 #endif
186 
187 #endif
typename OutputImageType::SpacingType SpacingType
TPixel * GetImportPointer()
void SetRegion(const RegionType &region)
void PrintSelf(std::ostream &os, Indent indent) const override
typename OutputImageType::PointType OriginType
void EnlargeOutputRequestedRegion(DataObject *output) override
void GenerateOutputInformation() override
const RegionType & GetRegion() const
typename TImage::Pointer OutputImagePointer
virtual void SetDirection(const DirectionType &direction)
typename TImage::PointType OriginType
#define itkSetMacro(name, type)
void SetImportPointer(TPixel *ptr, SizeValueType num, bool LetImageContainerManageMemory)
void GenerateData() override
~ImportImageFilter() override=default
typename TImage::PixelType PixelType
::itk::SizeValueType SizeValueType
typename TImage::SpacingType SpacingType
typename SizeType::SizeValueType SizeValueType
virtual void Modified() const