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

Method Initialize

Imaging/Core/vtkAbstractImageInterpolator.cxx:261–303  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

259
260//------------------------------------------------------------------------------
261void vtkAbstractImageInterpolator::Initialize(vtkDataObject* o)
262{
263 // free any previous scalars
264 this->ReleaseData();
265
266 // check for valid data
267 vtkImageData* data = vtkImageData::SafeDownCast(o);
268 vtkDataArray* scalars = nullptr;
269 if (data)
270 {
271 scalars = data->GetPointData()->GetScalars();
272 }
273
274 if (data == nullptr || scalars == nullptr)
275 {
276 vtkErrorMacro("Initialize(): no image data to interpolate!");
277 return;
278 }
279
280 // claim the scalars
281 scalars->Register(this);
282 this->Scalars = scalars;
283
284 // get the image information
285 data->GetSpacing(this->Spacing);
286 vtkMatrix3x3* matrix = data->GetDirectionMatrix();
287 if (matrix->IsIdentity())
288 {
289 this->UseDirection = false;
290 vtkMatrix3x3::Identity(this->Direction);
291 }
292 else
293 {
294 this->UseDirection = true;
295 vtkMatrix3x3::DeepCopy(this->Direction, data->GetDirectionMatrix());
296 vtkMatrix3x3::Invert(this->Direction, this->InverseDirection);
297 }
298 data->GetOrigin(this->Origin);
299 data->GetExtent(this->Extent);
300
301 // call update
302 this->Update();
303}
304
305//------------------------------------------------------------------------------
306void vtkAbstractImageInterpolator::ReleaseData()

Callers

nothing calls this directly

Calls 12

ReleaseDataMethod · 0.95
UpdateMethod · 0.95
IdentityFunction · 0.50
DeepCopyFunction · 0.50
InvertFunction · 0.50
GetScalarsMethod · 0.45
GetPointDataMethod · 0.45
RegisterMethod · 0.45
GetSpacingMethod · 0.45
IsIdentityMethod · 0.45
GetOriginMethod · 0.45
GetExtentMethod · 0.45

Tested by

no test coverage detected