[vtkusers] Volume rendering problems

Massimo Ivani massimo.ivani at mlsw.com
Mon Sep 20 04:44:26 EDT 2004


Hello vtk users
 
I need your help. I use vtk and Activiz since about one year reading RX
images to create 3D model using vtkContourFilter. Now I would like to use
Volume Rendering but I have some problem. I have axials in BMP format (8 Bit
or 24 Bit) and I have to read them and show them using volume rendering
technique. If I read them and create a contour all is ok and I got picture1
if I read them and I use vtkOpenGLVolumeTextureMapper2D I got strange result
as you can see in picture2. If I use ironprot.vtk demo file, it works well.
Here the source code...
 
Dim VOI As New vtkBMPReader
 
DimPX! = AxialDimPixelX
DimPY! = AxialDimPixelY
DimPZ! = AxialDimPixelZ
DimZ& = AxialDimZ
Wd$ = AxialPathName
Rt$ = AxialFilePrefix
Fp$ = AxialFilePattern
 
With VOI
    .SetDataByteOrderToLittleEndian
    .SetDataSpacing DimPX!, DimPY!, DimPZ!
    .SetFilePrefix Wd$ + Rt$
    .SetFilePattern Fp$
    .SetDataExtent 0, 0, 0, 0, 1, DimZ&
    .SetDataOrigin 0, 0, 0
    .Update
End With
   
Dim Pws As New vtkPiecewiseFunction
    Pws.SetMaximumNumberOfPieces 2
    Pws.AddPoint 0, 0
    Pws.AddPoint 255, 0.2
    Pws.Update
 
Dim CTF As New vtkColorTransferFunction
    CTF.AddRGBPoint 0, 0, 0, 0
    CTF.AddRGBPoint 64, 1, 0, 0
    CTF.AddRGBPoint 128, 0, 0, 1
    CTF.AddRGBPoint 192, 0, 1, 1
    CTF.AddRGBPoint 255, 0, 0.2, 0
 
Dim VolPr As New vtkVolumeProperty
    VolPr.SetColor_2 CTF
    VolPr.SetScalarOpacity Pws
    VolPr.SetInterpolationTypeToLinear
 
Dim VolMapper As New vtkOpenGLVolumeTextureMapper2D
    VolMapper.SetInput VOI.GetOutput
 
Dim Volume As New vtkVolume
    Volume.SetMapper VolMapper
    Volume.SetProperty VolPr
 
Ren1.AddProp Volume
'*************************************
 
 
Thank you in advance for your help.
 
 
Dr. Massimo Ivani
Media Lab Software
Ph. (+39) 0187517775
Fax (+39) 0187511833
 <mailto:massimo.ivani at mlsw.com> massimo.ivani at mlsw.com
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040920/14e7cbd6/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture1.JPG
Type: image/jpeg
Size: 20757 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040920/14e7cbd6/attachment.jpeg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Picture2.JPG
Type: image/jpeg
Size: 12595 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20040920/14e7cbd6/attachment-0001.jpeg>


More information about the vtkusers mailing list