comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: VECTOR_FIELD trouble
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: VECTOR_FIELD trouble [message #49854 is a reply to message #49843] Tue, 22 August 2006 10:28 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Jo Klein wrote:
> Dear IDL wizards,
> Has anyone got experience with the use of VECTOR_FIELD? The data I have
> is quite simple: It's a volume of vectors, where for each spatial
> position of a 3D regular grid I've got x, y and z as the projections of
> a unit-length vector centred on those grid locations. It's volume data
> from diffusion tensor MRI, and the vectors describe apparent diffusion
> directions at any given point in the object studied (a brain, in this
> case). So, to visualise the vectors, I browsed the docs and thought
> VECTOR_FIELD should do the job, but I can't figure out how to use it.
> One slice extracted from the data looks like this (z dimension of the
> vectors dropped):
> IDL> help,myslice
> MYSLICE FLOAT = Array[2, 128, 104]
> IDL> print,myslice[*,60:62,50]
> -0.393992 0.305778
> -0.353878 0.368543
> -0.505301 0.394556
> I set up my vectors like this:
> IDL> vector_field,myslice,outverts,outconn
> IDL> plots,outverts
> .. and the result is a window with just a wobbly looking vertical line,
> instead of lots of little vectors on a rectangular region.
> IDL> print,outverts[*,10000:10002]
> 8.00000 39.0000
> 8.00000 39.0000
> 9.00000 39.0000
>
> I suppose I'm misinterpreting how IDL would like my input data to be
> formatted, but as there are no examples in the VECTOR_FIELD docs, I'm a
> bit at a loss here.
> I'd appreciate any help you can give.
> Thanks a lot everyone,

What's probably happening here is that some of the vectors you're
displaying are much longer than the spacing between the elements of
your array, probably in the vertical direction. For example, I put
together a test case as follows:

IDL> x = indgen(20)#replicate(1,30)
IDL> y = replicate(1,20)#indgen(30)
IDL> field = fltarr(2,20,30)
IDL> field[0,*,*] = (x+y)*(x-y)
IDL> field[1,*,*] = (x*x+y*y)
IDL> VECTOR_FIELD,field,outverts,outconn
% Compiled module: VECTOR_FIELD.
IDL> plots,outverts[0,*],outverts[1,*],psym=3

The results looked pretty wierd. However, if you restrict the range, it
gets clearer:

IDL> plot,outverts[0,*],outverts[1,*],psym=3,xrange=[-10,40]

The problem was the following:
IDL> print,max(field),min(field)
361.000 -841.000

The solution is scale the vectors to make them fit between the grid
points:

IDL> VECTOR_FIELD,field,outverts,outconn,SCALE=0.0005
IDL> plot,outverts[0,*],outverts[1,*],psym=3
[Message index]
 
Read Message
Read Message
Previous Topic: Re: jpeg text field
Next Topic: Re: reduce the size of eps

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 09:19:31 PDT 2025

Total time taken to generate the page: 0.08374 seconds