vtkAssignAttribute does not pass scalar type
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
vtkAssignAttribute does not pass the scalar type of the input array to the output array.
E.g. vtkNew imageData; imageData->SetDimensions(2,2,2); vtkNew tensors; tensors->SetName("tensors"); tensors->SetNumberOfComponents(9); tensors->SetNumberOfTuples(222); for (int i = 0; i < 222;++i) { tensors->SetTuple9(i,1.,0.,0.,0.,1.,0.,0.,0.,1.); } imageData->GetPointData()->SetTensors(tensors.GetPointer()); //imageData->GetPointData()->SetActiveTensors("tensors");
vtkNew tp; tp->SetOutput(imageData.GetPointer()); //tp->UpdateInformation(); //vtkDataObject::SetPointDataActiveScalarInfo( // tp->GetOutputInformation(0), VTK_FLOAT, 9);
vtkNew tensorsToScalars; tensorsToScalars->Assign(vtkDataSetAttributes::TENSORS, vtkDataSetAttributes::SCALARS, vtkAssignAttribute::POINT_DATA); tensorsToScalars->SetInputConnection(tp->GetOutputPort()); tensorsToScalars->Update(); vtkImageData* output = vtkImageData::SafeDownCast(tensorsToScalars->GetOutputDataObject(0)); std::cout << "Scalar type: " << output->GetScalarType() << std::endl;
It prints "Scalar type: 11" instead of "Scalar type:10".