Yes, that's the formula for it, but what I can'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'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 'x' component and gives me an "invalid array name" 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("x", 0, 1, 2)<br>
velcalc.AddVectorArrayName("y", 0, 1, 2)<br>velcalc.AddVectorArrayName("z", 0, 1, 2)<br>velcalc.SetResultArrayName("Velocity")<br>velcalc.SetFunction("x+y+z")<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"><<a href="mailto:dominik@itis.ethz.ch">dominik@itis.ethz.ch</a>></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 <<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a> <mailto:<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>>> 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 <<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a><br></div><div><div></div><div class="h5">
<mailto:<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a>>> wrote:<br>
<br>
Yes, I tried both that and AppendFilter, but I'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'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 "Invalid array name: z" if I<br>
remove all references to y, so I think this means that the<br>
calculator isn't seeing the 'y' and 'z' variables.<br>
<br>
Here's the part of the code that isn'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("x", 0, 1, 2)<br>
velcalc.AddVectorArrayName("y", 0, 1, 2)<br>
velcalc.AddVectorArrayName("z", 0, 1, 2)<br>
velcalc.SetResultArrayName("Velocity")<br>
velcalc.SetFunction("x+y+z")<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">
<<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a> <mailto:<a href="mailto:wes.turner@kitware.com" target="_blank">wes.turner@kitware.com</a>>> 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>
<<a href="http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkImageAppendComponents.html</a>>-<br>
Wes<br>
<br>
On Fri, Jul 31, 2009 at 12:16 PM, Adam Wiktor<br></div><div><div></div><div class="h5">
<<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a> <mailto:<a href="mailto:awiktor@emory.edu" target="_blank">awiktor@emory.edu</a>>> wrote:<br>
<br>
Hi All,<br>
<br>
I am fairly new to VTK, so please bear with me. I'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 'DICOMImage' 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'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'd like to know if there's an easier way<br>
of doing this.<br>
<br>
If there isn'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> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><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&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&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 ' 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>