Hi all,<br>I am trying to pass output of an image gradient to a streamline object.<br><br>&nbsp;vtkImageData *vol2 = vtkImageData::New();<br>&nbsp;vol2-&gt;SetDimensions(91, 81, 85);<br>&nbsp;vol2-&gt;SetOrigin(45, 40, 42);<br>&nbsp;vol2-&gt;SetSpacing(1, 1, 1);<br>
vol2-&gt;SetScalarTypeToFloat();<br>vol2-&gt;GetPointData()-&gt;SetScalars(scalars); //scalars is vtkFloatArray of single components<br><br>vtkImageGradient* grad = vtkImageGradient::New();<br>grad-&gt;SetDimensionality( 3 );<br>
grad-&gt;SetInput(vol2); <br>grad-&gt;Update();<br>&nbsp;&nbsp; <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-&gt;SetInputConnection(grad-&gt;GetOutputPort());<br>aa-&gt;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-&gt;GetOutput()-&gt;GetPointData()-&gt;GetScalars();<br>vtkImageData *gradVecs = vtkImageData::New();<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; gradVecs-&gt;GetPointData()-&gt;SetVectors(array);<br>
&nbsp;&nbsp;&nbsp; gradVecs-&gt;SetScalarTypeToDouble();<br><br>Then I get the &quot;Requesting a cell from an empty image&quot; error. Tried to assign original image scalars<br>to the to this gradVecs image but it&#39;s not working.<br>
<br>Anybody knows how to set up a right input file for streamline?<br>Thanks<br>
<br>