ITK  5.4.0
Insight Toolkit
itkGridImageSource.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 itkGridImageSource_h
19 #define itkGridImageSource_h
20 
21 #include "itkGenerateImageSource.h"
22 #include "itkFixedArray.h"
23 #include "itkKernelFunctionBase.h"
24 #include "itkVectorContainer.h"
25 
26 #include "vnl/vnl_vector.h"
27 
28 namespace itk
29 {
57 template <typename TOutputImage>
58 class ITK_TEMPLATE_EXPORT GridImageSource : public GenerateImageSource<TOutputImage>
59 {
60 public:
61  ITK_DISALLOW_COPY_AND_MOVE(GridImageSource);
62 
68 
70  itkOverrideGetNameOfClassMacro(GridImageSource);
71 
73  itkNewMacro(Self);
74 
75  using RealType = double;
76 
78  static constexpr unsigned int ImageDimension = TOutputImage::ImageDimension;
79 
81  using ImageType = TOutputImage;
83  using PixelType = typename TOutputImage::PixelType;
84  using SpacingType = typename TOutputImage::SpacingType;
87  using SizeType = typename TOutputImage::SizeType;
88 
93  using PixelArrayType = vnl_vector<RealType>;
95 
97  itkSetObjectMacro(KernelFunction, KernelFunctionType);
98  itkGetConstReferenceObjectMacro(KernelFunction, KernelFunctionType);
103  itkSetMacro(Sigma, ArrayType);
104  itkGetConstReferenceMacro(Sigma, ArrayType);
108  itkSetMacro(GridSpacing, ArrayType);
109  itkGetConstReferenceMacro(GridSpacing, ArrayType);
113  itkSetMacro(GridOffset, ArrayType);
114  itkGetConstReferenceMacro(GridOffset, ArrayType);
118  itkSetMacro(WhichDimensions, BoolArrayType);
119  itkGetConstReferenceMacro(WhichDimensions, BoolArrayType);
123  itkSetMacro(Scale, RealType);
124  itkGetConstReferenceMacro(Scale, RealType);
127 protected:
128  GridImageSource();
129  ~GridImageSource() override = default;
130  void
131  PrintSelf(std::ostream & os, Indent indent) const override;
132 
133  void
134  DynamicThreadedGenerateData(const ImageRegionType & outputRegionForThread) override;
135 
136 
137  void
138  BeforeThreadedGenerateData() override;
139 
140 private:
142  typename PixelArrayContainerType::Pointer m_PixelArrays{};
143 
144  typename KernelFunctionType::Pointer m_KernelFunction{};
145 
146  ArrayType m_Sigma{};
147 
148  ArrayType m_GridSpacing{};
149 
150  ArrayType m_GridOffset{};
151 
152  BoolArrayType m_WhichDimensions{};
153 
154  RealType m_Scale{ 255.0 };
155 };
156 } // end namespace itk
157 
158 #ifndef ITK_MANUAL_INSTANTIATION
159 # include "itkGridImageSource.hxx"
160 #endif
161 
162 #endif
itk::GenerateImageSource::PixelType
typename OutputImageType::PixelType PixelType
Definition: itkGenerateImageSource.h:54
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itk::GridImageSource::PixelArrayType
vnl_vector< RealType > PixelArrayType
Definition: itkGridImageSource.h:93
itk::GridImageSource::OriginType
typename TOutputImage::PointType OriginType
Definition: itkGridImageSource.h:85
itk::GenerateImageSource
a Base class for image sources which need to have image size, and other meta-data set.
Definition: itkGenerateImageSource.h:41
itk::GridImageSource
Generate an n-dimensional image of a grid.
Definition: itkGridImageSource.h:58
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::GridImageSource::ImageRegionType
typename TOutputImage::RegionType ImageRegionType
Definition: itkGridImageSource.h:82
itk::KernelFunctionBase< double >
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itkKernelFunctionBase.h
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::GridImageSource::RealType
double RealType
Definition: itkGridImageSource.h:75
itk::GridImageSource::ImageType
TOutputImage ImageType
Definition: itkGridImageSource.h:81
itk::GenerateImageSource::SizeType
typename TOutputImage::SizeType SizeType
Definition: itkGenerateImageSource.h:64
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itkFixedArray.h
itk::FixedArray< RealType, Self::ImageDimension >
itkVectorContainer.h
itkGenerateImageSource.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::GenerateImageSource::SpacingType
typename OutputImageType::SpacingType SpacingType
Definition: itkGenerateImageSource.h:56
itk::GenerateImageSource::DirectionType
typename OutputImageType::DirectionType DirectionType
Definition: itkGenerateImageSource.h:58
itk::VectorContainer
Define a front-end to the STL "vector" container that conforms to the IndexedContainerInterface.
Definition: itkVectorContainer.h:48