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

Method ComputeGradients

Rendering/Volume/vtkFixedPointVolumeRayCastMapper.cxx:2540–2696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2538}
2539
2540void vtkFixedPointVolumeRayCastMapper::ComputeGradients(vtkVolume* vol)
2541{
2542 vtkImageData* input = vtkImageData::SafeDownCast(this->GetInput());
2543
2544 auto* dataArray = this->CurrentScalars;
2545
2546 int scalarType = this->CurrentScalars->GetDataType();
2547 int components = this->CurrentScalars->GetNumberOfComponents();
2548 int independent = vol->GetProperty()->GetIndependentComponents();
2549
2550 int dim[3];
2551 double spacing[3];
2552 input->GetDimensions(dim);
2553 input->GetSpacing(spacing);
2554
2555 // Find the scalar range
2556 double scalarRange[4][2];
2557 int c;
2558 for (c = 0; c < components; c++)
2559 {
2560 this->CurrentScalars->GetRange(scalarRange[c], c);
2561 }
2562
2563 vtkIdType sliceSize = (static_cast<vtkIdType>(dim[0]) * static_cast<vtkIdType>(dim[1]) *
2564 ((independent) ? (components) : (1)));
2565 vtkIdType numSlices = dim[2];
2566
2567 int i;
2568
2569 // Delete the prior gradient normal information
2570 if (this->GradientNormal)
2571 {
2572 // Contiguous? Delete in one chunk otherwise delete slice by slice
2573 if (this->ContiguousGradientNormal)
2574 {
2575 delete[] this->ContiguousGradientNormal;
2576 this->ContiguousGradientNormal = nullptr;
2577 }
2578 else
2579 {
2580 for (i = 0; i < this->NumberOfGradientSlices; i++)
2581 {
2582 delete[] this->GradientNormal[i];
2583 }
2584 }
2585 delete[] this->GradientNormal;
2586 this->GradientNormal = nullptr;
2587 }
2588
2589 // Delete the prior gradient magnitude information
2590 if (this->GradientMagnitude)
2591 {
2592 // Contiguous? Delete in one chunk otherwise delete slice by slice
2593 if (this->ContiguousGradientMagnitude)
2594 {
2595 delete[] this->ContiguousGradientMagnitude;
2596 this->ContiguousGradientMagnitude = nullptr;
2597 }

Callers 1

UpdateGradientsMethod · 0.95

Calls 14

DeleteMethod · 0.65
NewFunction · 0.50
ExecuteFunction · 0.50
GetInputMethod · 0.45
GetDataTypeMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetPropertyMethod · 0.45
GetDimensionsMethod · 0.45
GetSpacingMethod · 0.45
GetRangeMethod · 0.45
StartTimerMethod · 0.45
SetSingleMethodMethod · 0.45

Tested by

no test coverage detected