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

Method BuildPoints

Common/DataModel/vtkImageData.cxx:150–187  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

148
149//------------------------------------------------------------------------------
150void vtkImageData::BuildPoints()
151{
152 vtkNew<vtkDoubleArray> xCoords;
153 vtkNew<vtkDoubleArray> yCoords;
154 vtkNew<vtkDoubleArray> zCoords;
155 vtkDoubleArray* axisCoords[3] = { xCoords.Get(), yCoords.Get(), zCoords.Get() };
156
157 int dims[3];
158 this->GetDimensions(dims);
159
160 int extent[6];
161 this->GetExtent(extent);
162
163 int loc[3];
164 int ijk[3];
165 double point[3];
166 for (int i = 0; i < 3; ++i)
167 {
168 if (this->DirectionMatrixIsIdentity)
169 {
170 axisCoords[i]->SetNumberOfValues(dims[i]);
171 for (loc[i] = 0, ijk[i] = extent[2 * i]; loc[i] < dims[i]; ++loc[i], ++ijk[i])
172 {
173 point[i] = this->Origin[i] + this->Spacing[i] * ijk[i];
174 axisCoords[i]->SetValue(loc[i], point[i]);
175 }
176 }
177 else
178 {
179 // axis coords will be used to extract spacing and origin, so we use loc instead of ijk
180 axisCoords[i]->SetNumberOfValues(2);
181 axisCoords[i]->SetValue(0, this->Origin[i]);
182 axisCoords[i]->SetValue(1, this->Origin[i] + this->Spacing[i]);
183 }
184 }
185 this->SetStructuredPoints(vtkStructuredData::GetPoints(
186 xCoords, yCoords, zCoords, extent, this->DirectionMatrix->GetData()));
187}
188
189//------------------------------------------------------------------------------
190void vtkImageData::GetCell(vtkIdType cellId, vtkGenericCell* cell)

Callers 6

SetSpacingMethod · 0.95
SetOriginMethod · 0.95
SetDirectionMatrixMethod · 0.95
GetPointsMethod · 0.45

Calls 7

GetPointsFunction · 0.70
GetMethod · 0.45
GetDimensionsMethod · 0.45
GetExtentMethod · 0.45
SetNumberOfValuesMethod · 0.45
SetValueMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected