[vtkusers] Combining three velocity components

Dominik Szczerba dominik at itis.ethz.ch
Fri Jul 31 16:53:34 EDT 2009


u*iHat+v*jHat+w*kHat

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


-- 
d o m i n i k   s z c z e r b a ,   p h d . . . . . . . . . . .
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
. . . . . . . i t ' i s   r e s e a r c h   f o u n d a t i o n
. . . . . . . . . . . . . . . . . . . . http://www.itis.ethz.ch




More information about the vtkusers mailing list