ITK  5.4.0
Insight Toolkit
itkRandomImageSource.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/*=========================================================================
19 *
20 * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21 *
22 * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23 *
24 * For complete copyright, license and disclaimer of warranty information
25 * please refer to the NOTICE file at the top of the ITK source tree.
26 *
27 *=========================================================================*/
28#ifndef itkRandomImageSource_h
29#define itkRandomImageSource_h
30
31#include "itkImageSource.h"
32#include "itkNumericTraits.h"
33
34namespace itk
35{
54template <typename TOutputImage>
55class ITK_TEMPLATE_EXPORT RandomImageSource : public ImageSource<TOutputImage>
56{
57public:
58 ITK_DISALLOW_COPY_AND_MOVE(RandomImageSource);
59
65
67 using OutputImagePixelType = typename TOutputImage::PixelType;
68
71
73 itkOverrideGetNameOfClassMacro(RandomImageSource);
74
76 itkNewMacro(Self);
77
81 using SpacingType = typename TOutputImage::SpacingType;
85 using SizeValueArrayType = SizeValueType[TOutputImage::ImageDimension];
86 using SpacingValueType = typename TOutputImage::SpacingValueType;
87 using SpacingValueArrayType = SpacingValueType[TOutputImage::ImageDimension];
88 using PointValueType = typename TOutputImage::PointValueType;
89 using PointValueArrayType = PointValueType[TOutputImage::ImageDimension];
90
92 static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
93
95 itkSetMacro(Size, SizeType);
96 virtual void
100 virtual const SizeValueType *
101 GetSize() const;
102
104 itkSetMacro(Spacing, SpacingType);
105 virtual void
109 virtual const SpacingValueType *
110 GetSpacing() const;
111
113 itkSetMacro(Origin, PointType);
114 virtual void
118 virtual const PointValueType *
119 GetOrigin() const;
120
121 itkSetMacro(Direction, DirectionType);
122 itkGetMacro(Direction, DirectionType);
123
126 itkSetClampMacro(Min,
130
132 itkGetConstMacro(Min, OutputImagePixelType);
133
136 itkSetClampMacro(Max,
140
142 itkGetConstMacro(Max, OutputImagePixelType);
143
144protected:
146 ~RandomImageSource() override = default;
147 void
148 PrintSelf(std::ostream & os, Indent indent) const override;
149
150 void
151 DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
152
153 void
155
156private:
157 SizeType m_Size{}; // size of the output image
158 SpacingType m_Spacing{}; // spacing
159 PointType m_Origin{}; // origin
160 DirectionType m_Direction{}; // direction
161
162 typename TOutputImage::PixelType m_Min{}; // minimum possible value
163 typename TOutputImage::PixelType m_Max{}; // maximum possible value
164
165 // The following variables are deprecated, and provided here just for
166 // backward compatibility. It use is discouraged.
167 mutable PointValueArrayType m_OriginArray{};
168 mutable SpacingValueArrayType m_SpacingArray{};
169};
170} // end namespace itk
171
172#ifndef ITK_MANUAL_INSTANTIATION
173# include "itkRandomImageSource.hxx"
174#endif
175
176#endif
Base class for all process objects that output image data.
typename OutputImageType::PixelType OutputImagePixelType
typename OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Define additional traits for native types such as int or float.
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Generate an n-dimensional image of random pixel values.
SizeValueType[TOutputImage::ImageDimension] SizeValueArrayType
virtual const SpacingValueType * GetSpacing() const
typename TOutputImage::PointType PointType
virtual void SetSpacing(SpacingValueArrayType spacingArray)
typename TOutputImage::SpacingValueType SpacingValueType
virtual void SetOrigin(PointValueArrayType originArray)
PointValueType[TOutputImage::ImageDimension] PointValueArrayType
void DynamicThreadedGenerateData(const OutputImageRegionType &outputRegionForThread) override
typename TOutputImage::SpacingType SpacingType
~RandomImageSource() override=default
void GenerateOutputInformation() override
typename TOutputImage::DirectionType DirectionType
void PrintSelf(std::ostream &os, Indent indent) const override
virtual const PointValueType * GetOrigin() const
typename TOutputImage::SizeType SizeType
virtual const SizeValueType * GetSize() const
typename TOutputImage::IndexType IndexType
SpacingValueType[TOutputImage::ImageDimension] SpacingValueArrayType
virtual void SetSize(SizeValueArrayType sizeArray)
typename TOutputImage::PointValueType PointValueType
typename SizeType::SizeValueType SizeValueType
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
unsigned long SizeValueType
Definition: itkIntTypes.h:83
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:72