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

Method PrepareImageData

Common/ExecutionModel/vtkThreadedImageAlgorithm.cxx:435–492  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

433
434//------------------------------------------------------------------------------
435void vtkThreadedImageAlgorithm::PrepareImageData(vtkInformationVector** inputVector,
436 vtkInformationVector* outputVector, vtkImageData*** inDataObjects, vtkImageData** outDataObjects)
437{
438 vtkImageData* firstInput = nullptr;
439 vtkImageData* firstOutput = nullptr;
440
441 // now we must create the output array
442 int numOutputPorts = this->GetNumberOfOutputPorts();
443 for (int i = 0; i < numOutputPorts; i++)
444 {
445 vtkInformation* info = outputVector->GetInformationObject(i);
446 vtkImageData* outData = vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
447 if (i == 0)
448 {
449 firstOutput = outData;
450 }
451 if (outDataObjects)
452 {
453 outDataObjects[i] = outData;
454 }
455 if (outData)
456 {
457 int updateExtent[6];
458 info->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), updateExtent);
459
460 // unlike geometry filters, for image filters data is pre-allocated
461 // in the superclass (which means, in this class)
462 this->AllocateOutputData(outData, info, updateExtent);
463 }
464 }
465
466 // now create the inputs array
467 int numInputPorts = this->GetNumberOfInputPorts();
468 for (int i = 0; i < numInputPorts; i++)
469 {
470 vtkInformationVector* portInfo = inputVector[i];
471 int numConnections = portInfo->GetNumberOfInformationObjects();
472 for (int j = 0; j < numConnections; j++)
473 {
474 vtkInformation* info = portInfo->GetInformationObject(j);
475 vtkImageData* inData = vtkImageData::SafeDownCast(info->Get(vtkDataObject::DATA_OBJECT()));
476 if (i == 0 && j == 0)
477 {
478 firstInput = inData;
479 }
480 if (inDataObjects && inDataObjects[i])
481 {
482 inDataObjects[i][j] = inData;
483 }
484 }
485 }
486
487 // copy other arrays
488 if (firstInput && firstOutput)
489 {
490 this->CopyAttributeData(firstInput, firstOutput, inputVector);
491 }
492}

Callers 1

RequestDataMethod · 0.95

Calls 6

GetInformationObjectMethod · 0.80
GetMethod · 0.45
AllocateOutputDataMethod · 0.45
GetNumberOfInputPortsMethod · 0.45
CopyAttributeDataMethod · 0.45

Tested by

no test coverage detected