ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkNormalVariateGenerator.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#ifndef itkNormalVariateGenerator_h
19#define itkNormalVariateGenerator_h
20
21#include "itkObjectFactory.h"
23#include "ITKStatisticsExport.h"
24
25namespace itk::Statistics
26{
93class ITKStatistics_EXPORT NormalVariateGenerator : public RandomVariateGeneratorBase
94{
95public:
101
103 itkOverrideGetNameOfClassMacro(NormalVariateGenerator);
104
106 itkNewMacro(Self);
107
109 void
110 Initialize(int randomSeed);
111
113 double
114 GetVariate() override;
115
116protected:
119 void
120 PrintSelf(std::ostream & os, Indent indent) const override;
121
123 double
125
126private:
127 static inline int
129 {
130 // shifting of signed integer gives undefined results, explicitly
131 // cast to unsigned to get expected ( if two complement
132 // representation ) results.
133 auto uirs = static_cast<unsigned int>(irs);
134 return static_cast<int>((irs <= 0) ? ((uirs << 1) ^ 333556017) : (uirs << 1));
135 }
136
137 double m_Scale{};
138 double m_Rscale{};
139 double m_Rcons{};
140
141 static constexpr int m_ELEN{ 7 };
142 // LEN must be 2 ** ELEN
143 static constexpr int m_LEN{ 128 };
144 static constexpr int m_LMASK{ 4 * (m_LEN - 1) };
145 static constexpr int m_TLEN{ 8 * m_LEN };
146
148 int * m_Gausssave{};
149
150 double m_GScale{};
151
153 int m_Nslew{};
154 int m_Irs{};
155 int m_Lseed{};
156 double m_Chic1{};
157 double m_Chic2{};
158 double m_ActualRSD{};
159}; // end of class
160} // namespace itk::Statistics
161#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
void PrintSelf(std::ostream &os, Indent indent) const override