vtkAssignAttribute needs input array to have a name
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
vtkAssignAttribute needs input array to have a name. 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());
vtkNew tp; tp->SetOutput(imageData.GetPointer());
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 << "Scalars: " << output->GetPointData()->GetScalars() << std::endl;
It prints "Scalars: 0". However, if the tensors array has a name, then it prints the array address correctly.