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

Method UpdateContinuousCursor

Interaction/Widgets/vtkImagePlaneWidget.cxx:2085–2122  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2083
2084//------------------------------------------------------------------------------
2085int 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//------------------------------------------------------------------------------
2125int vtkImagePlaneWidget::UpdateDiscreteCursor(double* q)

Callers 1

UpdateCursorMethod · 0.95

Calls 9

InterpolateAllocateMethod · 0.80
GetTuple1Method · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetPointDataMethod · 0.45
GetLengthMethod · 0.45
FindAndGetCellMethod · 0.45
InterpolatePointMethod · 0.45
GetScalarsMethod · 0.45

Tested by

no test coverage detected