Hi all,<br>I am trying to pass output of an image gradient to a streamline object.<br><br> vtkImageData *vol2 = vtkImageData::New();<br> vol2->SetDimensions(91, 81, 85);<br> vol2->SetOrigin(45, 40, 42);<br> vol2->SetSpacing(1, 1, 1);<br>
vol2->SetScalarTypeToFloat();<br>vol2->GetPointData()->SetScalars(scalars); //scalars is vtkFloatArray of single components<br><br>vtkImageGradient* grad = vtkImageGradient::New();<br>grad->SetDimensionality( 3 );<br>
grad->SetInput(vol2); <br>grad->Update();<br> <br>//I tried below code sent its output to the streamline, but I got no vector defined error from vtkStreamline. <br>vtkAssignAttribute* aa = vtkAssignAttribute::New();<br>
aa->SetInputConnection(grad->GetOutputPort());<br>aa->Assign(vtkDataSetAttributes::SCALARS, vtkDataSetAttributes::VECTORS, vtkAssignAttribute::POINT_DATA);<br><br>What I am trying to do a <br>1. create a data structure taht holds both scalar and vector information and pass it to the imageGradient.<br>
I tried to set vector field of an image data set manually like this. <br><br>vtkDataArray * array = grad->GetOutput()->GetPointData()->GetScalars();<br>vtkImageData *gradVecs = vtkImageData::New();<br> <br> gradVecs->GetPointData()->SetVectors(array);<br>
gradVecs->SetScalarTypeToDouble();<br><br>Then I get the "Requesting a cell from an empty image" error. Tried to assign original image scalars<br>to the to this gradVecs image but it's not working.<br>
<br>Anybody knows how to set up a right input file for streamline?<br>Thanks<br>
<br>