ITK  5.4.0
Insight Toolkit
itkImportImageFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 #ifndef itkImportImageFilter_h
19 #define itkImportImageFilter_h
20 
21 #include "itkImageSource.h"
22 
23 namespace itk
24 {
42 template <typename TPixel, unsigned int VImageDimension = 2>
43 class ITK_TEMPLATE_EXPORT ImportImageFilter : public ImageSource<Image<TPixel, VImageDimension>>
44 {
45 public:
46  ITK_DISALLOW_COPY_AND_MOVE(ImportImageFilter);
47 
54 
60 
62  itkNewMacro(Self);
63 
65  itkOverrideGetNameOfClassMacro(ImportImageFilter);
66 
69 
72 
76 
78  using OutputImagePixelType = TPixel;
79 
81  TPixel *
82  GetImportPointer();
83 
91  void
92  SetImportPointer(TPixel * ptr, SizeValueType num, bool LetImageContainerManageMemory);
93 
98  void
99  SetRegion(const RegionType & region)
100  {
101  if (m_Region != region)
102  {
103  m_Region = region;
104  this->Modified();
105  }
106  }
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, VImageDimension);
128  itkSetMacro(Origin, OriginType);
129  itkGetConstReferenceMacro(Origin, OriginType);
130  itkSetVectorMacro(Origin, const float, VImageDimension);
134 
137  virtual void
138  SetDirection(const DirectionType & direction);
139 
142  itkGetConstReferenceMacro(Direction, DirectionType);
143 
144 protected:
145  ImportImageFilter() = default;
146  ~ImportImageFilter() override = default;
147  void
148  PrintSelf(std::ostream & os, Indent indent) const override;
149 
152  void
153  GenerateData() override;
154 
158  void
159  GenerateOutputInformation() override;
160 
168  void
169  EnlargeOutputRequestedRegion(DataObject * output) override;
170 
171 private:
172  RegionType m_Region{};
173  SpacingType m_Spacing{ MakeFilled<SpacingType>(1.0) };
174  OriginType m_Origin{};
175  DirectionType m_Direction{ DirectionType::GetIdentity() };
176 
177  typename ImportImageContainerType::Pointer m_ImportImageContainer{};
178  SizeValueType m_Size{};
179 };
180 } // end namespace itk
181 
182 #ifndef ITK_MANUAL_INSTANTIATION
183 # include "itkImportImageFilter.hxx"
184 #endif
185 
186 #endif
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itk::Index< VImageDimension >
itk::ImportImageFilter::OutputImagePixelType
TPixel OutputImagePixelType
Definition: itkImportImageFilter.h:78
itkImageSource.h
itk::Size< VImageDimension >
itk::ImageRegion
An image region represents a structured region of data.
Definition: itkImageRegion.h:80
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::Vector< SpacingValueType, VImageDimension >
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImportImageFilter::SetRegion
void SetRegion(const RegionType &region)
Definition: itkImportImageFilter.h:99
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::ImportImageFilter::GetRegion
const RegionType & GetRegion() const
Definition: itkImportImageFilter.h:114
itk::ImportImageFilter::OutputImagePointer
typename OutputImageType::Pointer OutputImagePointer
Definition: itkImportImageFilter.h:50
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::ImportImageFilter::SpacingType
typename OutputImageType::SpacingType SpacingType
Definition: itkImportImageFilter.h:51
itk::ImportImageContainer
Defines an itk::Image front-end to a standard C-array.
Definition: itkImportImageContainer.h:45
itk::ImportImageFilter::OriginType
typename OutputImageType::PointType OriginType
Definition: itkImportImageFilter.h:52
itk::ImportImageFilter
Import data from a standard C array into an itk::Image.
Definition: itkImportImageFilter.h:43
itk::Matrix< SpacePrecisionType, VImageDimension, VImageDimension >
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::Image
Templated n-dimensional image class.
Definition: itkImage.h:88
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::DataObject
Base class for all data objects in ITK.
Definition: itkDataObject.h:293