MCPcopy Create free account
hub / github.com/Kitware/VTK / Update

Method Update

Rendering/Volume/vtkEncodedGradientEstimator.cxx:142–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void vtkEncodedGradientEstimator::Update()
143{
144 int scalarInputSize[3];
145 double scalarInputAspect[3];
146 double startSeconds, endSeconds;
147 double startCPUSeconds, endCPUSeconds;
148
149 if (!this->InputData)
150 {
151 vtkErrorMacro(<< "No input in gradient estimator.");
152 return;
153 }
154
155 if (this->GetMTime() > this->BuildTime || this->DirectionEncoder->GetMTime() > this->BuildTime ||
156 this->InputData->GetMTime() > this->BuildTime || !this->EncodedNormals)
157 {
158
159 startSeconds = vtkTimerLog::GetUniversalTime();
160 startCPUSeconds = vtkTimerLog::GetCPUTime();
161
162 // Get the dimensions of the data and its aspect ratio
163 this->InputData->GetDimensions(scalarInputSize);
164 this->InputData->GetSpacing(scalarInputAspect);
165
166 // If we previously have allocated space for the encoded normals,
167 // and this space is no longer the right size, delete it
168 if (this->EncodedNormalsSize[0] != scalarInputSize[0] ||
169 this->EncodedNormalsSize[1] != scalarInputSize[1] ||
170 this->EncodedNormalsSize[2] != scalarInputSize[2])
171 {
172 delete[] this->EncodedNormals;
173 this->EncodedNormals = nullptr;
174
175 delete[] this->GradientMagnitudes;
176 this->GradientMagnitudes = nullptr;
177 }
178
179 // Compute the number of encoded voxels
180 vtkIdType encodedSize = scalarInputSize[0];
181 encodedSize *= scalarInputSize[1];
182 encodedSize *= scalarInputSize[2];
183
184 // Allocate space for the encoded normals if necessary
185 if (!this->EncodedNormals)
186 {
187 this->EncodedNormals = new unsigned short[encodedSize];
188 this->EncodedNormalsSize[0] = scalarInputSize[0];
189 this->EncodedNormalsSize[1] = scalarInputSize[1];
190 this->EncodedNormalsSize[2] = scalarInputSize[2];
191 }
192
193 if (!this->GradientMagnitudes && this->ComputeGradientMagnitudes)
194 {
195 this->GradientMagnitudes = new unsigned char[encodedSize];
196 }
197
198 // Copy info that multi threaded function will need into temp variables
199 memcpy(this->InputSize, scalarInputSize, 3 * sizeof(int));

Calls 6

ComputeCircleLimitsMethod · 0.95
UpdateNormalsMethod · 0.80
GetMTimeMethod · 0.45
GetDimensionsMethod · 0.45
GetSpacingMethod · 0.45
ModifiedMethod · 0.45

Tested by

no test coverage detected