Yes, that&#39;s the formula for it, but what I can&#39;t figure out is the actual code for the calculator. After doing the ImageAppendComponents, I need to find a way for the calculator to do that operation on all three variables. Right now, it isn&#39;t recognizing the y and z components. How do I pass those two variables to the calculator so that it will recognize all three? <br>
<br>This is what I have right now, but as I said, it only accepts the &#39;x&#39; component and gives me an &quot;invalid array name&quot; error for the other two.<br><br>append=vtk.vtkImageAppendComponents()<br>append.AddInput(xcalc.GetOutput())<br>
append.AddInput(ycalc.GetOutput())<br>append.AddInput(zcalc.GetOutput())<br>append.Update()<br><br>velcalc = vtk.vtkArrayCalculator()<br>velcalc.SetInput(append.GetOutput())<br>velcalc.AddVectorArrayName(&quot;x&quot;, 0, 1, 2)<br>
velcalc.AddVectorArrayName(&quot;y&quot;, 0, 1, 2)<br>velcalc.AddVectorArrayName(&quot;z&quot;, 0, 1, 2)<br>velcalc.SetResultArrayName(&quot;Velocity&quot;)<br>velcalc.SetFunction(&quot;x+y+z&quot;)<br>velcalc.Update()<br>
<br>Thanks,<br><br>Adam<br><br><div class="gmail_quote">On Fri, Jul 31, 2009 at 4:53 PM, Dominik Szczerba <span dir="ltr">&lt;<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
u*iHat+v*jHat+w*kHat<br>
<br>
Adam Wiktor wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">
Wes,<br>
<br>
The problem is that I need the overall velocity as a single vector, not the components. I think I still need the calculator to sum the three components to give the velocity. How would I do that?<br>
<br>
Thanks,<br>
<br>
Adam<br>
<br></div><div class="im">
On Fri, Jul 31, 2009 at 3:58 PM, Wes Turner &lt;<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a> &lt;mailto:<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>&gt;&gt; wrote:<br>

<br>
    If you are just trying to get an image with three components<br>
    corresponding to the x, y, and z, then that is what you should have<br>
    as the output of the append filter.  The data at that point is not<br>
    stored in separate x, y, and z vectors, but is instead a single<br>
    multicomponent image.  You should have no need of the image<br>
    calculator at that point.<br>
<br>
    - Wes<br>
<br>
<br>
    On Fri, Jul 31, 2009 at 3:24 PM, Adam Wiktor &lt;<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a><br></div><div><div></div><div class="h5">
    &lt;mailto:<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a>&gt;&gt; wrote:<br>
<br>
        Yes, I tried both that and AppendFilter, but I&#39;m still having<br>
        problems. I may not be using the append correctly, but the<br>
        calculator is only recognizing one of the three components, and<br>
        I get this error message (it&#39;s the same for both<br>
        ImageAppendComponents and AppendFilter):<br>
<br>
        ERROR: In<br>
        /home/awiktor/Desktop/VTK/Graphics/vtkArrayCalculator.cxx, line 338<br>
        vtkArrayCalculator (0x763d70): Invalid array name: y<br>
<br>
        I get the same message except with &quot;Invalid array name: z&quot; if I<br>
        remove all references to y, so I think this means that the<br>
        calculator isn&#39;t seeing the &#39;y&#39; and &#39;z&#39; variables.<br>
<br>
        Here&#39;s the part of the code that isn&#39;t working:<br>
<br>
        append=vtk.vtkImageAppendComponents()<br>
        append.AddInput(xcalc.GetOutput())<br>
        append.AddInput(ycalc.GetOutput())<br>
        append.AddInput(zcalc.GetOutput())<br>
        append.Update()<br>
<br>
        velcalc = vtk.vtkArrayCalculator()<br>
        velcalc.SetInput(append.GetOutput())<br>
        velcalc.AddVectorArrayName(&quot;x&quot;, 0, 1, 2)<br>
        velcalc.AddVectorArrayName(&quot;y&quot;, 0, 1, 2)<br>
        velcalc.AddVectorArrayName(&quot;z&quot;, 0, 1, 2)<br>
        velcalc.SetResultArrayName(&quot;Velocity&quot;)<br>
        velcalc.SetFunction(&quot;x+y+z&quot;)<br>
        velcalc.Update()<br>
<br>
        Any idea what the problem is?<br>
<br>
        Thanks,<br>
<br>
        Adam<br>
<br>
<br>
        On Fri, Jul 31, 2009 at 12:54 PM, Wes Turner<br></div></div><div class="im">
        &lt;<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a> &lt;mailto:<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>&gt;&gt; wrote:<br>
<br>
            Did you try ImageAppendComponents?<br>
<br>
            <a href="http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html</a><br>
<br>
            &lt;<a href="http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html</a>&gt;-<br>
            Wes<br>
<br>
            On Fri, Jul 31, 2009 at 12:16 PM, Adam Wiktor<br></div><div><div></div><div class="h5">
            &lt;<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a> &lt;mailto:<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a>&gt;&gt; wrote:<br>
<br>
                Hi All,<br>
<br>
                I am fairly new to VTK, so please bear with me. I&#39;m<br>
                trying to visualize blood flow in the aorta from MRI<br>
                scans. The velocity data is stored in three separate vti<br>
                images, for the x-, y- and z- components. Each image has<br>
                a scalar variable &#39;DICOMImage&#39; which is the speed in<br>
                that direction. I need to combine the components into<br>
                the overall velocity, which I will then import into<br>
                paraview to add streamlines and other things.<br>
<br>
                My original thought was to use the vtkArrayCalculator to<br>
                multiply each image by the unit vector (for the x<br>
                component, for example, it would be DICOMImage*iHat). I<br>
                would then need to combine these vectors into the<br>
                velocity with another calculator, just doing x+y+z. I<br>
                might be able to simplify this by just using one<br>
                calculator that did x*iHat + y*jHat + z*kHat, but I<br>
                don&#39;t know how to change the variable names from<br>
                DICOMImage to x, y, and z so that the calculator can<br>
                distinguish between them.<br>
<br>
                First of all, I&#39;d like to know if there&#39;s an easier way<br>
                of doing this.<br>
<br>
                If there isn&#39;t a more straight-forward way, then the<br>
                main thing I need to figure out is how to get the final<br>
                calculator to use the three different inputs. What would<br>
                be the best way to do that?<br>
<br>
                Thanks for any help you can give!<br>
<br>
                - Adam<br>
                _______________________________________________<br></div></div>
                Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="im"><br>
<br>
                Visit other Kitware open-source projects at<br>
                <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
                Please keep messages on-topic and check the VTK FAQ at:<br>
                <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
                Follow this link to subscribe/unsubscribe:<br>
                <a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
<br>
<br>
            --             Wesley D. Turner, Ph.D.<br>
            Kitware, Inc.<br>
            R&amp;D Engineer<br>
            28 Corporate Drive<br>
            Clifton Park, NY 12065-8662<br>
            Phone: 518-371-3971 x120<br>
<br>
<br>
<br>
<br>
<br>
    --     Wesley D. Turner, Ph.D.<br>
    Kitware, Inc.<br>
    R&amp;D Engineer<br>
    28 Corporate Drive<br>
    Clifton Park, NY 12065-8662<br>
    Phone: 518-371-3971 x120<br>
<br>
<br>
<br></div>
------------------------------------------------------------------------<div class="im"><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</div></blockquote><font color="#888888">
<br>
<br>
-- <br>
d o m i n i k   s z c z e r b a ,   p h d . . . . . . . . . . .<br>
c o m p u t a t i o n a l   l i f e   s c i e n c e   g r o u p<br>
. . . . . . . i t &#39; i s   r e s e a r c h   f o u n d a t i o n<br>
. . . . . . . . . . . . . . . . . . . . <a href="http://www.itis.ethz.ch" target="_blank">http://www.itis.ethz.ch</a><br>
<br>
</font></blockquote></div><br>