ITK  6.0.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 
34 namespace itk
35 {
54 template <typename TOutputImage>
55 class ITK_TEMPLATE_EXPORT RandomImageSource : public ImageSource<TOutputImage>
56 {
57 public:
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 
79  using SizeType = typename TOutputImage::SizeType;
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
97  SetSize(SizeValueArrayType sizeArray);
100  virtual const SizeValueType *
101  GetSize() const;
102 
104  itkSetMacro(Spacing, SpacingType);
105  virtual void
106  SetSpacing(SpacingValueArrayType spacingArray);
109  virtual const SpacingValueType *
110  GetSpacing() const;
111 
113  itkSetMacro(Origin, PointType);
114  virtual void
115  SetOrigin(PointValueArrayType originArray);
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 
144 protected:
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
154  GenerateOutputInformation() override;
155 
156 private:
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
itk::GTest::TypedefsAndConstructors::Dimension2::DirectionType
ImageBaseType::DirectionType DirectionType
Definition: itkGTestTypedefsAndConstructors.h:52
itkImageSource.h
itk::Size
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:69
itk::RandomImageSource::SpacingType
typename TOutputImage::SpacingType SpacingType
Definition: itkRandomImageSource.h:81
itk::GTest::TypedefsAndConstructors::Dimension2::PointType
ImageBaseType::PointType PointType
Definition: itkGTestTypedefsAndConstructors.h:51
itk::GTest::TypedefsAndConstructors::Dimension2::SizeType
ImageBaseType::SizeType SizeType
Definition: itkGTestTypedefsAndConstructors.h:49
itk::RandomImageSource::DirectionType
typename TOutputImage::DirectionType DirectionType
Definition: itkRandomImageSource.h:82
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itk::RandomImageSource::SizeValueType
typename SizeType::SizeValueType SizeValueType
Definition: itkRandomImageSource.h:84
itk::RandomImageSource::PointValueArrayType
PointValueType[TOutputImage::ImageDimension] PointValueArrayType
Definition: itkRandomImageSource.h:89
itk::GTest::TypedefsAndConstructors::Dimension2::IndexType
ImageBaseType::IndexType IndexType
Definition: itkGTestTypedefsAndConstructors.h:50
itk::ImageSource
Base class for all process objects that output image data.
Definition: itkImageSource.h:67
itk::GTest::TypedefsAndConstructors::Dimension2::RegionType
ImageBaseType::RegionType RegionType
Definition: itkGTestTypedefsAndConstructors.h:54
itk::RandomImageSource::SizeType
typename TOutputImage::SizeType SizeType
Definition: itkRandomImageSource.h:79
itk::RandomImageSource
Generate an n-dimensional image of random pixel values.
Definition: itkRandomImageSource.h:55
itk::NumericTraits
Define additional traits for native types such as int or float.
Definition: itkNumericTraits.h:60
itk::ImageSource::OutputImageRegionType
typename OutputImageType::RegionType OutputImageRegionType
Definition: itkImageSource.h:92
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::ProcessObject
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Definition: itkProcessObject.h:139
itk::ImageSource::OutputImagePixelType
typename OutputImageType::PixelType OutputImagePixelType
Definition: itkImageSource.h:93
itk::RandomImageSource::SizeValueArrayType
SizeValueType[TOutputImage::ImageDimension] SizeValueArrayType
Definition: itkRandomImageSource.h:85
itkNumericTraits.h
itk::RandomImageSource::PointValueType
typename TOutputImage::PointValueType PointValueType
Definition: itkRandomImageSource.h:88
itk::RandomImageSource::SpacingValueArrayType
SpacingValueType[TOutputImage::ImageDimension] SpacingValueArrayType
Definition: itkRandomImageSource.h:87
itk::RandomImageSource::IndexType
typename TOutputImage::IndexType IndexType
Definition: itkRandomImageSource.h:80
itk::RandomImageSource::SpacingValueType
typename TOutputImage::SpacingValueType SpacingValueType
Definition: itkRandomImageSource.h:86
itk::SizeValueType
unsigned long SizeValueType
Definition: itkIntTypes.h:86
itk::RandomImageSource::PointType
typename TOutputImage::PointType PointType
Definition: itkRandomImageSource.h:83