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

Method ThreadedRequestData

Imaging/Math/vtkImageMathematics.cxx:441–525  ·  view source on GitHub ↗

------------------------------------------------------------------------------ This method is passed a input and output datas, and executes the filter algorithm to fill the output from the inputs. It just executes a switch statement to call the correct function for the datas data types.

Source from the content-addressed store, hash-verified

439// It just executes a switch statement to call the correct function for
440// the datas data types.
441void vtkImageMathematics::ThreadedRequestData(vtkInformation* vtkNotUsed(request),
442 vtkInformationVector** vtkNotUsed(inputVector), vtkInformationVector* vtkNotUsed(outputVector),
443 vtkImageData*** inData, vtkImageData** outData, int outExt[6], int id)
444{
445 void* outPtr = outData[0]->GetScalarPointerForExtent(outExt);
446
447 if (this->Operation == VTK_ADD || this->Operation == VTK_SUBTRACT ||
448 this->Operation == VTK_MULTIPLY || this->Operation == VTK_DIVIDE ||
449 this->Operation == VTK_MIN || this->Operation == VTK_MAX || this->Operation == VTK_ATAN2 ||
450 this->Operation == VTK_COMPLEX_MULTIPLY)
451 {
452 for (int i = 0; i < this->GetNumberOfInputConnections(0); ++i)
453 {
454 void* inPtrI = inData[0][i]->GetScalarPointerForExtent(outExt);
455 {
456 if (this->Operation == VTK_COMPLEX_MULTIPLY)
457 {
458 if (inData[0][i]->GetNumberOfScalarComponents() != 2 ||
459 inData[0][i]->GetNumberOfScalarComponents() != 2)
460 {
461 vtkErrorMacro("Complex inputs must have two components.");
462 return;
463 }
464 // this filter expects that input is the same type as output.
465 if (inData[0][i]->GetScalarType() != outData[0]->GetScalarType())
466 {
467 vtkErrorMacro(<< "Execute: input1 ScalarType, " << inData[0][i]->GetScalarType()
468 << ", must match output ScalarType " << outData[0]->GetScalarType());
469 return;
470 }
471 }
472 if (i == 0)
473 {
474 switch (inData[0][i]->GetScalarType())
475 {
476 vtkTemplateMacro(vtkImageMathematicsInitOutput(inData[0][i],
477 static_cast<VTK_TT*>(inPtrI), outData[0], static_cast<VTK_TT*>(outPtr), outExt));
478 default:
479 vtkErrorMacro(<< "InitOutput: Unknown ScalarType");
480 return;
481 }
482 }
483 else
484 {
485 switch (inData[0][i]->GetScalarType())
486 {
487 vtkTemplateMacro(vtkImageMathematicsExecute2(this, inData[0][i],
488 static_cast<VTK_TT*>(inPtrI), outData[0], static_cast<VTK_TT*>(outPtr), outExt, id));
489 default:
490 vtkErrorMacro(<< "Execute: Unknown ScalarType");
491 return;
492 }
493 }
494 }
495 }
496 }
497 else
498 {

Callers

nothing calls this directly

Tested by

no test coverage detected