[vtkusers] Analyze reader

a.h.al-khalifah at reading.ac.uk a.h.al-khalifah at reading.ac.uk
Tue Apr 20 07:10:18 EDT 2004


Dear all
can any one tell me how to read and render an "Analyze" volumetric dataset
that is composed of a series of files (i.e a pair of an ".hdr" and an ".img"
for each slice), OR reading a single file (with one 'hdr' and one 'img'). I
have tried the following, but for some reason I don't get the expected image
(Brain). All I get is a cube shows transparent voxels which don't reseamble
the required image, I have tried to change the Opacity values, but there was
no change in the result.Here is the code that i have used..

vtkImageReader reader
reader SetFileName D:/VTKData/brain/brain_nsM00223/brain_nsM00223_002.img
reader SetDataExtent 0 64 0 64 1 64
     reader SetFileDimensionality 3
   reader SetHeaderSize 1
     reader SetDataByteOrderToBigEndian
   reader SetDataOrigin 0 0 0
   reader SetDataScalarTypeToUnsignedChar
# reader SetSwapBytes(2);
reader SetDataSpacing 1.0 1.0 1.0
[reader GetOutput] ReleaseDataFlagOn 
reader DebugOff
        reader Update

# Create transfer functions for opacity and color
vtkPiecewiseFunction opacityTransferFunction
     
        opacityTransferFunction AddPoint  10   0.0              
        opacityTransferFunction AddPoint  10000  1.0     

vtkColorTransferFunction colorTransferFunction
        colorTransferFunction AddRGBPoint  192.0 0.8 0.6 .2
==================================
your help is highly appreciated.
A.Al-khalifah



More information about the vtkusers mailing list