------------------------------------------------------------------------------
| 812 | |
| 813 | //------------------------------------------------------------------------------ |
| 814 | void vtkImageResize::ThreadedRequestData(vtkInformation*, vtkInformationVector**, |
| 815 | vtkInformationVector*, vtkImageData***, vtkImageData** outData, int extent[6], int threadId) |
| 816 | { |
| 817 | vtkDebugMacro("Execute: outData = " << outData); |
| 818 | |
| 819 | // get the pointer and increments |
| 820 | vtkIdType outInc[3]; |
| 821 | outData[0]->GetIncrements(outInc); |
| 822 | void* outPtr = outData[0]->GetScalarPointerForExtent(extent); |
| 823 | int outScalarType = outData[0]->GetScalarType(); |
| 824 | |
| 825 | // create a matrix to map output to input indices |
| 826 | double newmat[4][4]; |
| 827 | for (int i = 0; i < 3; i++) |
| 828 | { |
| 829 | newmat[i][0] = newmat[i][1] = newmat[i][2] = 0; |
| 830 | newmat[i][i] = this->IndexStretch[i]; |
| 831 | newmat[i][3] = this->IndexTranslate[i]; |
| 832 | newmat[3][i] = 0; |
| 833 | } |
| 834 | newmat[3][3] = 1; |
| 835 | |
| 836 | // fill in the interpolation tables |
| 837 | vtkAbstractImageInterpolator* interpolator = this->GetInternalInterpolator(); |
| 838 | int clipExt[6]; |
| 839 | vtkInterpolationWeights* weights; |
| 840 | interpolator->PrecomputeWeightsForExtent(*newmat, extent, clipExt, weights); |
| 841 | |
| 842 | // prepare table for use by this filter |
| 843 | int kernelSizeX = weights->KernelSize[0]; |
| 844 | vtkIdType* aX = weights->Positions[0]; |
| 845 | const double* fX = static_cast<double*>(weights->Weights[0]); |
| 846 | int kernelSizeY = weights->KernelSize[1]; |
| 847 | vtkIdType* aY = weights->Positions[1]; |
| 848 | const double* fY = static_cast<double*>(weights->Weights[1]); |
| 849 | int kernelSizeZ = weights->KernelSize[2]; |
| 850 | vtkIdType* aZ = weights->Positions[2]; |
| 851 | const double* fZ = static_cast<double*>(weights->Weights[2]); |
| 852 | |
| 853 | // get the pointer and scalar type |
| 854 | const void* inPtr = weights->Pointer; |
| 855 | int inScalarType = weights->ScalarType; |
| 856 | |
| 857 | // progress object if main thread |
| 858 | vtkAlgorithm* progress = ((threadId == 0) ? this : nullptr); |
| 859 | |
| 860 | // call the execute method |
| 861 | if (outScalarType == inScalarType) |
| 862 | { |
| 863 | switch (inScalarType) |
| 864 | { |
| 865 | vtkTemplateAliasMacro( |
| 866 | vtkImageResizeFilter3D(static_cast<const VTK_TT*>(inPtr), static_cast<VTK_TT*>(outPtr), |
| 867 | outInc, extent, aX, fX, kernelSizeX, aY, fY, kernelSizeY, aZ, fZ, kernelSizeZ, progress)); |
| 868 | default: |
| 869 | vtkErrorMacro("Execute: Unknown ScalarType"); |
| 870 | } |
| 871 | } |
nothing calls this directly
no test coverage detected