vtkAssignAttribute Assign problem
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
When I tried to assign the scalar attributes to the vector using the Assign methods as follows:
vtkSmartPointer<vtkReassignAttribute> imgComp2Atrrib; imgComp2Atrrib = vtkSmartPointer<vtkReassignAttribute>::New(); imgComp2Atrrib->SetInput(<and image with 3 scalar component>); imgComp2Atrrib->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkReassignAttribute::POINT_DATA);
It did not work out.
I fixed the problem by changing the RequestData procedure.
if (this->FieldType == vtkReassignAttribute::NAME && this->FieldName)
{
ods->SetActiveAttribute(this->FieldName, this->AttributeType);
}
else if (this->FieldType == vtkReassignAttribute::ATTRIBUTE &&
(this->InputAttributeType != -1))
{
// If labeling an attribute as another attribute, we
// need to get it's index and call SetActiveAttribute()
// with that index
int attributeIndices[vtkDataSetAttributes::NUM_ATTRIBUTES];
ods->GetAttributeIndices(attributeIndices);
ods->SetActiveAttribute(attributeIndices[this->InputAttributeType],this->AttributeType);
//vtkDataArray *oda = ods->GetAttribute(this->InputAttributeType);
//if (oda)
// {
// ods->SetActiveAttribute(oda->GetName(),this->AttributeType);
// }
}