[vtkusers] (no subject)

Matthew Mendez maxxmad at yahoo.com
Thu Oct 24 17:22:17 EDT 2002


Hello, I need a little help.  I'm new to VTK and after
spending 1 month banging out a script to do a MRA MIP
reconstruction from MRA images I can't seem to get it
to look right.  Plus, I have a few other questions and
woul really appreciate help from anyone with a few
moments to spare.

My questions are as follows:
1. How do you figure out the proper opacity and color
transfer settings? I've tried a few different things
and it never looks quite right (I think this is at the
heart of why it doesn't look like an MRA).

2. How can I display the axes on my image?  With a
simple example the add axis works, but not when I do a
the full blown data set.

3. When I rotate the image it blurs.  How can I
control this?  Also, the first time I rotate it
rotates fine, but the second time (and every time
after that) it's terribly slow, any explanation for
this?

4. The MR scanner is going to give me coordinates and
I want to be able to put a cursor at those coordinates
and then move the cursor to different coordinates
based on updated input from the scanner.  I tried to
draw a sphere inside my volume, but I can't see it (I
know it's commented out in the code below, but I can't
see it even when it's not commented out).  I tried
show cursor which doesn't seem to work.

5. How do I convert coordinates from the scanner into
vtk "world coordinates"?  What do these coordinates
represent?

Thanks in advance for any help!
Matt Mendez
Cleveland, OH

P.S. If someone would like to access the files I am
using goto:
http://www.anytimenow.com/in_atnp/guest/
and login with the "maxxmad" as login and password
"files" (no quotes).  Then click on the files area on
the left and you will see the images.



Here's my script:

# MRAAPP TCL

package require vtk
package require vtkinteraction

# Create the Renderer, RenderWindow, and
RenderWindowInteractor.
vtkRenderer ren1
vtkRenderWindow renWin
    renWin AddRenderer ren1
    renWin SetSize 400 400

vtkRenderWindowInteractor iren
    iren SetRenderWindow renWin


# Create a sphere source in red
vtkSphereSource sphere
    sphere SetRadius 0.2
vtkPolyDataMapper   sphereMapper 
    sphereMapper SetInput [sphere GetOutput]
    sphereMapper GlobalImmediateModeRenderingOn
vtkLODActor sphereActor
    sphereActor SetMapper sphereMapper
    [sphereActor GetProperty] SetColor 1.0 0 0
    sphereActor SetPosition 1 1 1

# Create the axes and the associated mapper and actor.
vtkAxes axes
    axes SetOrigin 0 0 0
vtkPolyDataMapper axesMapper
    axesMapper SetInput [axes GetOutput]
vtkActor axesActor
    axesActor SetMapper axesMapper
    [axesActor GetProperty] SetColor 1 0 0

vtkVectorText atext
    atext SetText "Origin"
vtkPolyDataMapper textMapper
    textMapper SetInput [atext GetOutput]
vtkFollower textActor
    textActor SetMapper textMapper
    textActor SetScale 0.2 0.2 0.2
    textActor AddPosition 0 -0.1 0


vtkVolume16Reader reader
    reader SetFilePrefix
"C:/MR/vtk40/VTKData/Data/RConvMRI/MRSample"
    reader SetFilePattern %s%d.raw
    reader SetImageRange 1 70
    reader SetDataSpacing 0.25 0.25 2
    reader SetDataDimensions 512 384
 
# Create transfer mapping scalar value to opacity
 vtkPiecewiseFunction opacityTransferFunction
    opacityTransferFunction AddPoint  0   0.0
    opacityTransferFunction AddPoint  3   0.0
    opacityTransferFunction AddPoint  6   0.0
    opacityTransferFunction AddPoint  255  100

# Create transfer mapping scalar value to color
vtkColorTransferFunction colorTransferFunction
#    colorTransferFunction AddRGBPoint      0.0 0.0
0.0 0.0
#    colorTransferFunction AddRGBPoint     64.0 1.0
0.0 0.0
#    colorTransferFunction AddRGBPoint    128.0 0.0
0.0 1.0
#    colorTransferFunction AddRGBPoint    192.0 0.0
1.0 0.0
#    colorTransferFunction AddRGBPoint    255.0 0.0
0.2 0.0
    colorTransferFunction AddRGBPoint    0 0 0 0  
    colorTransferFunction AddRGBPoint    150 0 0 0
    colorTransferFunction AddRGBPoint    255 1 1 1

#    vtkPiecewiseFunc cFunc
#     CFunc AddPoint 0

# The property describes how the data will look
vtkVolumeProperty volumeProperty
   volumeProperty SetColor colorTransferFunction
   volumeProperty SetScalarOpacity
opacityTransferFunction
 
# The mapper / ray cast function know how to render
the data
vtkVolumeRayCastMIPFunction  compositeFunction
vtkVolumeRayCastMapper volumeMapper
     volumeMapper SetVolumeRayCastFunction
compositeFunction
     volumeMapper SetInput [reader GetOutput]

# The volume holds the mapper and the property and
# can be used to position/orient the volume
vtkVolume volume
    volume SetMapper volumeMapper
    volume SetProperty volumeProperty
    volume SetPosition 1 1 1

ren1 SetBackground 0.1 0.2 0.4
ren1 AddActor axesActor
ren1 AddVolume volume
#ren1 AddActor textActor
#ren1 AddActor sphereActor
#ren1 AddActor2D textActor
renWin Render

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/



More information about the vtkusers mailing list