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

Method ThreadedRequestData

Imaging/Morphological/vtkImageSkeleton2D.cxx:314–364  ·  view source on GitHub ↗

------------------------------------------------------------------------------ This method contains the first switch statement that calls the correct templated function for the input and output region types.

Source from the content-addressed store, hash-verified

312// This method contains the first switch statement that calls the correct
313// templated function for the input and output region types.
314void vtkImageSkeleton2D::ThreadedRequestData(vtkInformation* vtkNotUsed(request),
315 vtkInformationVector** inputVector, vtkInformationVector* vtkNotUsed(outputVector),
316 vtkImageData*** inDataV, vtkImageData** outDataV, int outExt[6], int id)
317{
318 vtkImageData* inData = inDataV[0][0];
319 vtkImageData* outData = outDataV[0];
320 void* inPtr;
321 void* outPtr = outData->GetScalarPointerForExtent(outExt);
322 vtkImageData* tempData;
323 int inExt[6], wholeExt[6];
324
325 // this filter expects that input is the same type as output.
326 if (inData->GetScalarType() != outData->GetScalarType())
327 {
328 vtkErrorMacro(<< "Execute: input ScalarType, " << inData->GetScalarType()
329 << ", must match out ScalarType " << outData->GetScalarType());
330 return;
331 }
332
333 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
334 inInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), inExt);
335 inInfo->Get(vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), wholeExt);
336
337 vtkInformation* inScalarInfo = vtkDataObject::GetActiveFieldInformation(
338 inInfo, vtkDataObject::FIELD_ASSOCIATION_POINTS, vtkDataSetAttributes::SCALARS);
339 if (!inScalarInfo)
340 {
341 vtkErrorMacro("Missing ActiveScalar info in input information!");
342 return;
343 }
344
345 // Make a temporary copy of the input data
346 tempData = vtkImageData::New();
347 tempData->SetExtent(inExt);
348 tempData->AllocateScalars(inScalarInfo->Get(vtkImageData::FIELD_ARRAY_TYPE()),
349 inScalarInfo->Get(vtkImageData::FIELD_NUMBER_OF_COMPONENTS()));
350 tempData->CopyAndCastFrom(inData, inExt);
351
352 inPtr = tempData->GetScalarPointerForExtent(outExt);
353 switch (tempData->GetScalarType())
354 {
355 vtkTemplateMacro(vtkImageSkeleton2DExecute(this, tempData, static_cast<VTK_TT*>(inPtr), outData,
356 outExt, static_cast<VTK_TT*>(outPtr), id, wholeExt));
357 default:
358 vtkErrorMacro(<< "Execute: Unknown ScalarType");
359 tempData->Delete();
360 return;
361 }
362
363 tempData->Delete();
364}
365
366void vtkImageSkeleton2D::PrintSelf(ostream& os, vtkIndent indent)
367{

Callers

nothing calls this directly

Calls 10

GetInformationObjectMethod · 0.80
CopyAndCastFromMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetScalarTypeMethod · 0.45
GetMethod · 0.45
SetExtentMethod · 0.45
AllocateScalarsMethod · 0.45

Tested by

no test coverage detected