------------------------------------------------------------------------------
| 2083 | |
| 2084 | //------------------------------------------------------------------------------ |
| 2085 | int vtkImagePlaneWidget::UpdateContinuousCursor(double* q) |
| 2086 | { |
| 2087 | double tol2; |
| 2088 | vtkCell* cell; |
| 2089 | vtkPointData* pd; |
| 2090 | int subId; |
| 2091 | double pcoords[3], weights[8]; |
| 2092 | |
| 2093 | this->CurrentCursorPosition[0] = q[0]; |
| 2094 | this->CurrentCursorPosition[1] = q[1]; |
| 2095 | this->CurrentCursorPosition[2] = q[2]; |
| 2096 | |
| 2097 | pd = this->ImageData->GetPointData(); |
| 2098 | |
| 2099 | vtkPointData* outPD = vtkPointData::New(); |
| 2100 | outPD->InterpolateAllocate(pd, 1, 1); |
| 2101 | |
| 2102 | // Use tolerance as a function of size of source data |
| 2103 | // |
| 2104 | tol2 = this->ImageData->GetLength(); |
| 2105 | tol2 = tol2 ? tol2 * tol2 / 1000.0 : 0.001; |
| 2106 | |
| 2107 | // Find the cell that contains q and get it |
| 2108 | // |
| 2109 | cell = this->ImageData->FindAndGetCell(q, nullptr, -1, tol2, subId, pcoords, weights); |
| 2110 | int found = 0; |
| 2111 | if (cell) |
| 2112 | { |
| 2113 | // Interpolate the point data |
| 2114 | // |
| 2115 | outPD->InterpolatePoint(pd, 0, cell->PointIds, weights); |
| 2116 | this->CurrentImageValue = outPD->GetScalars()->GetTuple1(0); |
| 2117 | found = 1; |
| 2118 | } |
| 2119 | |
| 2120 | outPD->Delete(); |
| 2121 | return found; |
| 2122 | } |
| 2123 | |
| 2124 | //------------------------------------------------------------------------------ |
| 2125 | int vtkImagePlaneWidget::UpdateDiscreteCursor(double* q) |
no test coverage detected