AW: [vtkusers] reading amira data with vtk

Patrick Schuska schuska at dbi.udel.edu
Mon Oct 13 15:47:28 EDT 2003


Hi guys,
I have a little big problem. What I`m going to do can you read below.

Now I have written some lines. I had really not much idea what I`m there
was doing. I guessed and played a little bit with the examples.
All the documentations are crap,  I think. However, I don`t understand
them.
Can anybody please check my program and correct some mistakes and what
also important for me is, explain me, what there is happening.

And if somebody has a better documentations as the vtk.org, please let
me know :o)..

Here is my program..



package require vtk
package require vtkinteraction


# Create the renderer, the render window, and the interactor. The
renderer
# draws into the render window, the interactor enables mouse- and 
# keyboard-based interaction with the scene.
#
vtkRenderer aRenderer
vtkRenderWindow renWin
  renWin AddRenderer aRenderer
vtkRenderWindowInteractor iren
  iren SetRenderWindow renWin

# Create the reader for the data
vtkStructuredPointsReader Preader
    Preader SetFileName "D:/amira/ear2.am"

# Create transfer mapping scalar value to opacity
vtkPiecewiseFunction opacityTransferFunction
   # opacityTransferFunction AddPoint  20   0.0
  #  opacityTransferFunction AddPoint  255  0.2

# 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

# The property describes how the data will look
vtkVolumeProperty volumeProperty
  #  volumeProperty SetColor colorTransferFunction
   # volumeProperty SetScalarOpacity opacityTransferFunction
    volumeProperty ShadeOn
    volumeProperty SetInterpolationTypeToLinear


# The mapper / ray cast function know how to render the data
vtkVolumeRayCastCompositeFunction  compositeFunction
vtkVolumeRayCastMapper volumeMapper
    volumeMapper SetVolumeRayCastFunction compositeFunction
    volumeMapper SetInput [Preader 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

aRenderer AddVolume volume
aRenderer SetBackground 1 1 1

renWin SetSize 600 600
renWin Render


# Interact with data. The Tcl/Tk event loop is started automatically.
iren Initialize
wm withdraw .





-----Ursprüngliche Nachricht-----
Von: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] Im Auftrag
von Seema Jaisinghani
Gesendet: Donnerstag, 9. Oktober 2003 12:03
An: Patrick Schuska; vtkusers at vtk.org
Betreff: Re: [vtkusers] reading amira data with vtk


Hi Patrick,

I don't know how you are loading images in Amira. Are
your ct images uniformly spaced or vary in z? Anyway,
you will be able to get them as a stack if uniformly
spaced by just selecting all the single files when
loading. Amira loads them as a single object. If not
spaced uniformly, you can still get them as a
multichannel field by specifying the distance between
every image in a text file channel.info. 
Now save this single object as an amira mesh object
i.e. stackname.am
this is a binary file with amira mesh header. It is
simply volume data. Remove this header and replace
with vtk files header.Your header will be something
like-
# vtk DataFile Version 3.0
Raw Volume Data
BINARY
DATASET STRUCTURED_POINTS
DIMENSIONS  101  101  101 (these areth dimensions of
your stack)
ORIGIN 0 0 0
SPACING 0.5 0.5 0.5 (this is the voxel size in your
original stack)
POINT_DATA 1030301
SCALARS atomId unsigned_char 1
LOOKUP_TABLE default
.
...data

use vtkStructuredPointsReader to read this file and
send the output to vtkStructuredPoints

Hope this helps,
Seema
--- Patrick Schuska <schuska at dbi.udel.edu> wrote:
> Hi,
> I have to represent amira objects, which I created
> in amira out of
> ct-slices with vtk. How can I read the images out of
> amira into vtk.Is
> it possible at all?
> Thanks, Patrick
> 


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.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://www.vtk.org/mailman/listinfo/vtkusers





More information about the vtkusers mailing list