ITK  4.6.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 RandomImageSource:public ImageSource< TOutputImage >
55 {
56 public:
62 
64  typedef typename TOutputImage::PixelType OutputImagePixelType;
65 
67  typedef typename TOutputImage::RegionType OutputImageRegionType;
68 
70  itkTypeMacro(RandomImageSource, ImageSource);
71 
73  itkNewMacro(Self);
74 
76  typedef typename TOutputImage::SizeType SizeType;
77  typedef typename TOutputImage::IndexType IndexType;
78  typedef typename TOutputImage::SpacingType SpacingType;
79  typedef typename TOutputImage::DirectionType DirectionType;
80  typedef typename TOutputImage::PointType PointType;
82  typedef SizeValueType SizeValueArrayType[TOutputImage::ImageDimension];
83  typedef typename TOutputImage::SpacingValueType SpacingValueType;
84  typedef SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension];
85  typedef typename TOutputImage::PointValueType PointValueType;
86  typedef PointValueType PointValueArrayType[TOutputImage::ImageDimension];
87 
89  itkSetMacro(Size, SizeType);
90  virtual void SetSize(SizeValueArrayType sizeArray);
92 
93  virtual const SizeValueType * GetSize() const;
94 
96  itkSetMacro(Spacing, SpacingType);
97  virtual void SetSpacing(SpacingValueArrayType spacingArray);
99 
100  virtual const SpacingValueType * GetSpacing() const;
101 
103  itkSetMacro(Origin, PointType);
104  virtual void SetOrigin(PointValueArrayType originArray);
106 
107  virtual const PointValueType * GetOrigin() const;
108 
109  itkSetMacro(Direction, DirectionType);
110  itkGetMacro(Direction, DirectionType);
111 
114  itkSetClampMacro( Min, OutputImagePixelType,
117 
119  itkGetConstMacro(Min, OutputImagePixelType);
120 
123  itkSetClampMacro( Max, OutputImagePixelType,
126 
128  itkGetConstMacro(Max, OutputImagePixelType);
129 
130 protected:
133  void PrintSelf(std::ostream & os, Indent indent) const;
134 
135  virtual void
137  outputRegionForThread, ThreadIdType threadId);
138 
139  virtual void GenerateOutputInformation();
140 
141 private:
142  RandomImageSource(const RandomImageSource &); //purposely not implemented
143  void operator=(const RandomImageSource &); //purposely not implemented
144 
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.
157 };
158 } // end namespace itk
159 
160 #ifndef ITK_MANUAL_INSTANTIATION
161 #include "itkRandomImageSource.hxx"
162 #endif
163 
164 #endif
virtual void SetSize(SizeType _arg)
virtual void SetSpacing(SpacingType _arg)
SizeType::SizeValueType SizeValueType
PointValueType PointValueArrayType[TOutputImage::ImageDimension]
Represent the size (bounds) of a n-dimensional image.
Definition: itkSize.h:52
SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension]
TOutputImage::PointValueType PointValueType
void operator=(const RandomImageSource &)
virtual const SpacingValueType * GetSpacing() const
SmartPointer< const Self > ConstPointer
Base class for all process objects that output image data.
unsigned long SizeValueType
Definition: itkIntTypes.h:143
TOutputImage::PixelType m_Max
TOutputImage::PixelType OutputImagePixelType
virtual const PointValueType * GetOrigin() const
SizeValueType SizeValueArrayType[TOutputImage::ImageDimension]
SpacingValueArrayType m_SpacingArray
TOutputImage::SizeType SizeType
TOutputImage::IndexType IndexType
OutputImageType::PixelType OutputImagePixelType
void PrintSelf(std::ostream &os, Indent indent) const
virtual void ThreadedGenerateData(const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId)
Generate an n-dimensional image of random pixel values.
virtual void SetOrigin(PointType _arg)
OutputImageType::RegionType OutputImageRegionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
TOutputImage::PixelType m_Min
ImageSource< TOutputImage > Superclass
virtual const SizeValueType * GetSize() const
TOutputImage::PointType PointType
TOutputImage::SpacingType SpacingType
PointValueArrayType m_OriginArray
Define additional traits for native types such as int or float.
TOutputImage::RegionType OutputImageRegionType
TOutputImage::DirectionType DirectionType
SmartPointer< Self > Pointer
virtual void GenerateOutputInformation()
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
TOutputImage::SpacingValueType SpacingValueType