MantisBT - VTK
View Issue Details
0014692VTK(No Category)public2014-04-15 13:322014-10-02 11:12
Julien Finet 
Utkarsh Ayachit 
normalminorhave not tried
closedno change required 
6.2.0 
 
TBD
incorrect functionality
0014692: vtkAssignAttribute does not pass scalar type
vtkAssignAttribute does not pass the scalar type of the input array to the output array.

E.g.
  vtkNew<vtkImageData> imageData;
  imageData->SetDimensions(2,2,2);
  vtkNew<vtkFloatArray> tensors;
  tensors->SetName("tensors");
  tensors->SetNumberOfComponents(9);
  tensors->SetNumberOfTuples(2*2*2);
  for (int i = 0; i < 2*2*2;++i)
    {
    tensors->SetTuple9(i,1.,0.,0.,0.,1.,0.,0.,0.,1.);
    }
  imageData->GetPointData()->SetTensors(tensors.GetPointer());
  //imageData->GetPointData()->SetActiveTensors("tensors");

  vtkNew<vtkTrivialProducer> tp;
  tp->SetOutput(imageData.GetPointer());
  //tp->UpdateInformation();
  //vtkDataObject::SetPointDataActiveScalarInfo(
  // tp->GetOutputInformation(0), VTK_FLOAT, 9);

  vtkNew<vtkAssignAttribute> 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".
hackaton
related to 0014693closed Utkarsh Ayachit vtkAssignAttribute needs input array to have a name 
Issue History
2014-04-15 13:32Julien FinetNew Issue
2014-04-15 13:36Julien FinetRelationship addedrelated to 0014693
2014-10-01 12:52Berk GeveciTag Attached: hackaton
2014-10-02 09:31Utkarsh AyachitAssigned To => Utkarsh Ayachit
2014-10-02 11:11Utkarsh AyachitStatusbacklog => active development
2014-10-02 11:12Utkarsh AyachitNote Added: 0033463
2014-10-02 11:12Utkarsh AyachitStatusactive development => closed
2014-10-02 11:12Utkarsh AyachitResolutionopen => no change required

Notes
(0033463)
Utkarsh Ayachit   
2014-10-02 11:12   
Following the related bug fix, this issue no longer happens. The exact code prints out "Scalar Type: 10"