RTK  2.5.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  * https://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 ITK_TEMPLATE_EXPORT ImportImageFilter : public itk::ImageSource<TImage>
45 {
46 public:
47  ITK_DISALLOW_COPY_AND_MOVE(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 #ifdef itkOverrideGetNameOfClassMacro
65  itkOverrideGetNameOfClassMacro(ImportImageFilter);
66 #else
67  itkTypeMacro(ImportImageFilter, ImageSource);
68 #endif
69 
70 
73 
77 
81 
83  using PixelType = typename TImage::PixelType;
84 
86  PixelType *
87  GetImportPointer();
88 
96  void
97  SetImportPointer(PixelType * ptr, SizeValueType num, bool LetFilterManageMemory);
98 
103  void
104  SetRegion(const RegionType & region)
105  {
106  if (m_Region != region)
107  {
108  m_Region = region;
109  this->Modified();
110  }
111  }
113 
118  const RegionType &
119  GetRegion() const
120  {
121  return m_Region;
122  }
123 
126  itkSetMacro(Spacing, SpacingType);
127  itkGetConstReferenceMacro(Spacing, SpacingType);
128  itkSetVectorMacro(Spacing, const float, TImage::ImageDimension);
130 
133  itkSetMacro(Origin, OriginType);
134  itkGetConstReferenceMacro(Origin, OriginType);
135  itkSetVectorMacro(Origin, const float, TImage::ImageDimension);
137 
139 
142  virtual void
143  SetDirection(const DirectionType & direction);
144 
147  itkGetConstReferenceMacro(Direction, DirectionType);
148 
149 protected:
151  ~ImportImageFilter() override;
152  void
153  PrintSelf(std::ostream & os, itk::Indent indent) const override;
154 
157  void
158  GenerateData() override;
159 
163  void
164  GenerateOutputInformation() override;
165 
173  void
174  EnlargeOutputRequestedRegion(itk::DataObject * output) override;
175 
176 private:
181 
185 };
186 } // namespace rtk
187 
188 #ifndef ITK_MANUAL_INSTANTIATION
189 # include "rtkImportImageFilter.hxx"
190 #endif
191 
192 #endif
void SetRegion(const RegionType &region)
const RegionType & GetRegion() const
typename TImage::Pointer OutputImagePointer
typename TImage::PointType OriginType
#define itkSetMacro(name, type)
typename TImage::PixelType PixelType
itk::SizeValueType SizeValueType
typename TImage::SpacingType SpacingType
typename SizeType::SizeValueType SizeValueType