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{
94class ITKStatistics_EXPORT NormalVariateGenerator : public RandomVariateGeneratorBase
95{
96public:
102
104 itkOverrideGetNameOfClassMacro(NormalVariateGenerator);
105
107 itkNewMacro(Self);
108
110 void
111 Initialize(int randomSeed);
112
114 double
115 GetVariate() override;
116
117protected:
120 void
121 PrintSelf(std::ostream & os, Indent indent) const override;
122
124 double
126
127private:
128 static inline int
130 {
131 // shifting of signed integer gives undefined results, explicitly
132 // cast to unsigned to get expected ( if two complement
133 // representation ) results.
134 auto uirs = static_cast<unsigned int>(irs);
135 return static_cast<int>((irs <= 0) ? ((uirs << 1) ^ 333556017) : (uirs << 1));
136 }
137
138 double m_Scale{};
139 double m_Rscale{};
140 double m_Rcons{};
141
142 static constexpr int m_ELEN{ 7 };
143 // LEN must be 2 ** ELEN
144 static constexpr int m_LEN{ 128 };
145 static constexpr int m_LMASK{ 4 * (m_LEN - 1) };
146 static constexpr int m_TLEN{ 8 * m_LEN };
147
149 int * m_Gausssave{};
150
151 double m_GScale{};
152
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} // namespace itk::Statistics
162#endif
Control indentation during Print() invocation.
Definition itkIndent.h:50
Implements transparent reference counting.
void PrintSelf(std::ostream &os, Indent indent) const override