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

Method GetCell

Common/DataModel/vtkImageData.cxx:190–246  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

188
189//------------------------------------------------------------------------------
190void vtkImageData::GetCell(vtkIdType cellId, vtkGenericCell* cell)
191{
192 // see whether the cell is blanked
193 if (!this->IsCellVisible(cellId))
194 {
195 cell->SetCellTypeToEmptyCell();
196 return;
197 }
198 // set cell type
199 cell->SetCellType(this->GetCellTypes()->GetValue(cellId));
200
201 // get min max ijk
202 int ijkMin[3], ijkMax[3];
203 vtkStructuredData::ComputeCellStructuredMinMaxCoords(
204 cellId, this->GetDimensions(), ijkMin, ijkMax, this->GetDataDescription());
205
206 // set cell point ids
207 vtkIdType cellSize;
208 this->GetCells()->GetCellAtId(ijkMin, cellSize, cell->PointIds->GetPointer(0));
209
210 // set cell points
211 vtkPoints* points = this->GetPoints();
212 const auto pointsBackend =
213 static_cast<vtkStructuredPointArray<double>*>(points->GetData())->GetBackend();
214 int loc[3], npts = 0;
215 double point[3];
216 if (this->DirectionMatrixIsIdentity)
217 {
218 for (loc[2] = ijkMin[2]; loc[2] <= ijkMax[2]; loc[2]++)
219 {
220 point[2] = pointsBackend->mapStructuredZComponent(loc[2]);
221 for (loc[1] = ijkMin[1]; loc[1] <= ijkMax[1]; loc[1]++)
222 {
223 point[1] = pointsBackend->mapStructuredYComponent(loc[1]);
224 for (loc[0] = ijkMin[0]; loc[0] <= ijkMax[0]; loc[0]++)
225 {
226 point[0] = pointsBackend->mapStructuredXComponent(loc[0]);
227 cell->Points->SetPoint(npts++, point);
228 }
229 }
230 }
231 }
232 else
233 {
234 for (loc[2] = ijkMin[2]; loc[2] <= ijkMax[2]; loc[2]++)
235 {
236 for (loc[1] = ijkMin[1]; loc[1] <= ijkMax[1]; loc[1]++)
237 {
238 for (loc[0] = ijkMin[0]; loc[0] <= ijkMax[0]; loc[0]++)
239 {
240 pointsBackend->mapStructuredTuple(loc, point);
241 cell->Points->SetPoint(npts++, point);
242 }
243 }
244 }
245 }
246}
247

Callers

nothing calls this directly

Calls 14

GetDataDescriptionMethod · 0.80
mapStructuredTupleMethod · 0.80
IsCellVisibleMethod · 0.45
SetCellTypeMethod · 0.45
GetValueMethod · 0.45
GetCellTypesMethod · 0.45
GetDimensionsMethod · 0.45
GetCellAtIdMethod · 0.45
GetCellsMethod · 0.45
GetPointerMethod · 0.45
GetPointsMethod · 0.45
GetBackendMethod · 0.45

Tested by

no test coverage detected