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

Method CopyInputArrayAttributesToOutput

Common/ExecutionModel/vtkImageAlgorithm.cxx:127–155  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

125
126//------------------------------------------------------------------------------
127void vtkImageAlgorithm::CopyInputArrayAttributesToOutput(vtkInformation* vtkNotUsed(request),
128 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
129{
130 // for image data to image data
131 if (this->GetNumberOfInputPorts() && this->GetNumberOfOutputPorts())
132 {
133 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
134 // if the input is image data
135 if (vtkImageData::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT())))
136 {
137 vtkInformation* info = this->GetInputArrayFieldInformation(0, inputVector);
138 if (info)
139 {
140 int scalarType = info->Get(vtkDataObject::FIELD_ARRAY_TYPE());
141 int numComp = info->Get(vtkDataObject::FIELD_NUMBER_OF_COMPONENTS());
142 for (int i = 0; i < this->GetNumberOfOutputPorts(); ++i)
143 {
144 vtkInformation* outInfo = outputVector->GetInformationObject(i);
145 // if the output is image data
146 if (vtkImageData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())))
147 {
148 // copy scalar type and scalar number of components
149 vtkDataObject::SetPointDataActiveScalarInfo(outInfo, scalarType, numComp);
150 }
151 }
152 }
153 }
154 }
155}
156
157//------------------------------------------------------------------------------
158int vtkImageAlgorithm::RequestInformation(

Callers 1

RequestInformationMethod · 0.95

Calls 5

GetInformationObjectMethod · 0.80
GetNumberOfInputPortsMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected