------------------------------------------------------------------------------
| 712 | |
| 713 | //------------------------------------------------------------------------------ |
| 714 | void vtkAbstractImageInterpolator::Update() |
| 715 | { |
| 716 | vtkDataArray* scalars = this->Scalars; |
| 717 | |
| 718 | // check for scalars |
| 719 | if (!scalars) |
| 720 | { |
| 721 | this->InterpolationInfo->Pointer = nullptr; |
| 722 | this->InterpolationInfo->NumberOfComponents = 1; |
| 723 | |
| 724 | this->InterpolationInfo->Array = nullptr; |
| 725 | this->InterpolationInfo->Index = 0; |
| 726 | |
| 727 | this->InterpolationFuncDouble = &(vtkInterpolateNOP<double>::InterpolationFunc); |
| 728 | this->InterpolationFuncFloat = &(vtkInterpolateNOP<float>::InterpolationFunc); |
| 729 | this->RowInterpolationFuncDouble = &(vtkInterpolateNOP<double>::RowInterpolationFunc); |
| 730 | this->RowInterpolationFuncFloat = &(vtkInterpolateNOP<float>::RowInterpolationFunc); |
| 731 | |
| 732 | return; |
| 733 | } |
| 734 | |
| 735 | // set the InterpolationInfo object |
| 736 | vtkInterpolationInfo* info = this->InterpolationInfo; |
| 737 | vtkIdType* inc = info->Increments; |
| 738 | int* extent = info->Extent; |
| 739 | extent[0] = this->Extent[0]; |
| 740 | extent[1] = this->Extent[1]; |
| 741 | extent[2] = this->Extent[2]; |
| 742 | extent[3] = this->Extent[3]; |
| 743 | extent[4] = this->Extent[4]; |
| 744 | extent[5] = this->Extent[5]; |
| 745 | |
| 746 | // use the Extent and Tolerance to set the bounds |
| 747 | double* bounds = this->StructuredBoundsDouble; |
| 748 | float* fbounds = this->StructuredBoundsFloat; |
| 749 | double tol = this->Tolerance; |
| 750 | // always restrict the bounds to the limits of int |
| 751 | int supportSize[3]; |
| 752 | this->ComputeSupportSize(nullptr, supportSize); |
| 753 | // use the max of the three support size values |
| 754 | int kernelSize = supportSize[0]; |
| 755 | kernelSize = ((supportSize[1] < kernelSize) ? kernelSize : supportSize[1]); |
| 756 | kernelSize = ((supportSize[2] < kernelSize) ? kernelSize : supportSize[2]); |
| 757 | double minbound = VTK_INT_MIN + kernelSize / 2; |
| 758 | double maxbound = VTK_INT_MAX - kernelSize / 2; |
| 759 | |
| 760 | for (int i = 0; i < 3; i++) |
| 761 | { |
| 762 | double newtol = tol; // tolerance for this dimension |
| 763 | if (extent[2 * i] == extent[2 * i + 1]) |
| 764 | { |
| 765 | // if there is only one slice, use minimum tolerance of 0.5, |
| 766 | // plus a bit of extra tolerance for rounding error |
| 767 | newtol = std::max(newtol, 0.5 + VTK_INTERPOLATE_FLOOR_TOL); |
| 768 | } |
| 769 | double bound = extent[2 * i] - newtol; |
| 770 | bound = std::max(bound, minbound); |
| 771 | fbounds[2 * i] = bounds[2 * i] = bound; |
no test coverage detected