ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkRandomImageSource.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software 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  * http://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 {
53 template< typename TOutputImage >
54 class ITK_TEMPLATE_EXPORT RandomImageSource:public ImageSource< TOutputImage >
55 {
56 public:
57  ITK_DISALLOW_COPY_AND_ASSIGN(RandomImageSource);
58 
64 
66  using OutputImagePixelType = typename TOutputImage::PixelType;
67 
70 
72  itkTypeMacro(RandomImageSource, ImageSource);
73 
75  itkNewMacro(Self);
76 
78  using SizeType = typename TOutputImage::SizeType;
80  using SpacingType = typename TOutputImage::SpacingType;
84  typedef SizeValueType SizeValueArrayType[TOutputImage::ImageDimension];
85  using SpacingValueType = typename TOutputImage::SpacingValueType;
86  typedef SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension];
87  using PointValueType = typename TOutputImage::PointValueType;
88  typedef PointValueType PointValueArrayType[TOutputImage::ImageDimension];
89 
91  static constexpr unsigned int OutputImageDimension = TOutputImage::ImageDimension;
92 
94  itkSetMacro(Size, SizeType);
95  virtual void SetSize(SizeValueArrayType sizeArray);
97 
98  virtual const SizeValueType * GetSize() const;
99 
101  itkSetMacro(Spacing, SpacingType);
102  virtual void SetSpacing(SpacingValueArrayType spacingArray);
104 
105  virtual const SpacingValueType * GetSpacing() const;
106 
108  itkSetMacro(Origin, PointType);
109  virtual void SetOrigin(PointValueArrayType originArray);
111 
112  virtual const PointValueType * GetOrigin() const;
113 
114  itkSetMacro(Direction, DirectionType);
115  itkGetMacro(Direction, DirectionType);
116 
119  itkSetClampMacro( Min, OutputImagePixelType,
122 
124  itkGetConstMacro(Min, OutputImagePixelType);
125 
128  itkSetClampMacro( Max, OutputImagePixelType,
131 
133  itkGetConstMacro(Max, OutputImagePixelType);
134 
135 protected:
137  ~RandomImageSource() override = default;
138  void PrintSelf(std::ostream & os, Indent indent) const override;
139 
140  void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override;
141 
142  void GenerateOutputInformation() override;
143 
144 private:
145  SizeType m_Size; //size of the output image
147  PointType m_Origin; //origin
149 
150  typename TOutputImage::PixelType m_Min; //minimum possible value
151  typename TOutputImage::PixelType m_Max; //maximum possible value
152 
153  // The following variables are deprecated, and provided here just for
154  // backward compatibility. It use is discouraged.
155  mutable PointValueArrayType m_OriginArray;
156  mutable SpacingValueArrayType m_SpacingArray;
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkRandomImageSource.hxx"
162 #endif
163 
164 #endif
typename TOutputImage::IndexType IndexType
typename TOutputImage::PointValueType PointValueType
Define numeric traits for std::vector.
unsigned long SizeValueType
Definition: itkIntTypes.h:83
typename TOutputImage::PointType PointType
typename SizeType::SizeValueType SizeValueType
The base class for all process objects (source, filters, mappers) in the Insight data processing pipe...
Base class for all process objects that output image data.
TOutputImage::PixelType m_Max
typename OutputImageType::PixelType OutputImagePixelType
SpacingValueArrayType m_SpacingArray
typename OutputImageType::RegionType OutputImageRegionType
Represent a n-dimensional size (bounds) of a n-dimensional image.
Definition: itkSize.h:68
typename TOutputImage::DirectionType DirectionType
typename TOutputImage::SpacingType SpacingType
Generate an n-dimensional image of random pixel values.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutputImage::PixelType m_Min
PointValueArrayType m_OriginArray
typename TOutputImage::SizeType SizeType
typename TOutputImage::SpacingValueType SpacingValueType