[vtkusers] (no subject) -> MRA rendering

anast.jm at pg.com anast.jm at pg.com
Thu Oct 24 19:46:12 EDT 2002


Matthew..as to

question 1, you are treating the data as 8 bit in your transfer functions,
typically you would scale everything up to 4095  instead of max 255, BUT your
data is only in the low part of the 16 bit range so 0-255 opacity function is
okay, now you just have to remember that opacity is 0 to 1.0 not 100.

I was able to render your sample images okay but the slices don't seem to be a
contiguous dataset (looks like maybe 3 sets back to back???)...maybe I just
don't understand what the slices are.

The easiest way to figure out the proper opacity and color functions is to load
the slices up in VolView and use the interactive tools to sort it out
(unfortunately this approach involves $$) You can download a trial version of
VolView from Kitwares web site. Its really quite a nice tool to have on hand.
The cheap way is trial and error.  Examining the histogram can help with initial
estimates however. You could always build your own interactive tools...I'm still
looking for a tcl snippet to do this but no one's posted any yet ... hint hint
(-;

try this
 vtkPiecewiseFunction opacityTransferFunction
    opacityTransferFunction AddPoint  0   0.0
    opacityTransferFunction AddPoint  75  0.5
    opacityTransferFunction AddPoint  190  1.0

vtkColorTransferFunction colorTransferFunction
    colorTransferFunction AddRGBPoint    0 0 0 0
    colorTransferFunction AddRGBPoint    75 0.8 0.8 0.8
    colorTransferFunction AddRGBPoint    190 1 1 1

question 3....the blurring is a lower level of detail so the intereaction stays
real time. When you stop interacting it should do a full render. On my system,
this works as expected and I don't notice any slow downs on subsequent
interactions.

Have to look to others to figure out the rest ...john




                                                                
 Internet Mail Message                                          
 Received from host:      public.kitware.com                    
 [24.97.130.19]                                                 
                                                                


From: Matthew Mendez <maxxmad at yahoo.com>@public.kitware.com on 10/24/2002 02:22
PM MST
                                                                                             
     Matthew Mendez <maxxmad at yahoo.com>           To:   vtkusers at public.kitware.com          
                    @public.kitware.com           Cc:    (bcc: John Anast-JM/PGI)            
                                          Subject:      [vtkusers] (no subject)              
                                                                                             
                               Sent by:                                                      
      vtkusers-admin at public.kitware.com                                                      
                    10/24/2002 05:22 PM                                                      
                                                                                             
                                                                                             




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/
_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers






More information about the vtkusers mailing list