image color representing a vector... [message #15852] |
Tue, 15 June 1999 00:00 |
John Stanly Videen
Messages: 2 Registered: June 1999
|
Junior Member |
|
|
Help,
I have a need to develop images where color (rgb) represents orthogonal
directions.
An analogy would be a 2D flow image that represents 3D flow velocity and
direction.
So, a bright red pixel would indicate high flow in the x direction;
bright blue would
indicate high flow in z; bright purple, high flow in the xz axis.
Black is no flow.
This would be just like making three images of the red, green and blue
vectors on
transparent film and then stacking them up on a light box.....
In actuality, the raw data is a 128x128 slice in which each pixel
represents
a tensor. Pixel by pixel, each tensor is diagonalized to yield 3
eigenvalues and
an eigenvector matrix. I'm interested in portraying the major (largest)
eigenvalue with it's
associated eigenvector on one image.
Here's what I've got in mind, but I'm not sure if this is the way to go,
; for a 128 x 128 image
; ei = largest eigenvalue (128,128)
; ev = corresponding eigenvector (128,128,3) where 3rd dimension is the
unit vector x,y,z.
; out = resulting image (128,128)
for x=0,127 do begin
for y=0,127 do begin
red = ei(x,y) * ev(x,y,0) ; x direction
green = ei(x,y) * ev(x,y,1) ; y
blue = ei(x,y) * ev(x,y,2) ; z
out(x,y) = new_function(red, green, blue)
endfor
endfor
tv, out
;
Whether, there is some nuance of TV that can do this, or whether
"new_function" exists
and I don't know what it is, I need help.....
Thanks,
john "color-blind" videen,
|
|
|