ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkNormalVariateGenerator.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 #ifndef itkNormalVariateGenerator_h
19 #define itkNormalVariateGenerator_h
20 
21 #include "itkObjectFactory.h"
23 #include "ITKStatisticsExport.h"
24 
25 namespace itk
26 {
27 namespace Statistics
28 {
98 class ITKStatistics_EXPORT NormalVariateGenerator:
100 {
101 public:
107 
109  itkTypeMacro(NormalVariateGenerator,
111 
113  itkNewMacro(Self);
114 
116  void Initialize(int randomSeed);
117 
119  virtual double GetVariate() ITK_OVERRIDE;
120 
121 protected:
123  virtual ~NormalVariateGenerator() ITK_OVERRIDE;
124  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
125 
127  double FastNorm();
128 
129 private:
130 
131  static inline int SignedShiftXOR( int irs )
132  {
133  // shifting of signed integer gives undefined results, explicitly
134  // cast to unsigned to get expected ( if two complement
135  // representation ) results.
136  unsigned int uirs = static_cast<unsigned int>(irs);
137  return static_cast<int>(( irs <= 0 ) ? ( ( uirs << 1 ) ^ 333556017 ) : ( uirs << 1 ));
138  }
139 
140  double m_Scale;
141  double m_Rscale;
142  double m_Rcons;
143  int m_ELEN;
144  int m_LEN;
145  int m_LMASK;
146  int m_TLEN;
147 
150 
151  double m_GScale;
152 
153  int * m_Vec1;
154  int m_Nslew;
155  int m_Irs;
156  int m_Lseed;
157  double m_Chic1;
158  double m_Chic2;
159  double m_ActualRSD;
160 }; // end of class
161 } // end of namespace Statistics
162 } // end of namespace itk
163 #endif
Light weight base class for most itk classes.
Defines common interfaces for random variate generators.
Control indentation during Print() invocation.
Definition: itkIndent.h:49