[vtkusers] Volume rendering of vtkRectilinearGrid using vtkProbeFilter

Steven Koch SKoch at trinityconsultants.com
Tue Sep 26 19:10:47 EDT 2006


Help 

The following error pops up when I use vtkProbeFilter to create a 
vtkImageData grid from a vtkRectilinear grid:

ERROR: In ..\..\vtk\Filtering\vtkStreamingDemandDrivenPipeline.cxx, line 
628 
vtkStreamingDemandDrivenPipeline (061A8E28): The update extent specified 
in the information for output port 0 on algorithm 
vtkTrivialProducer(061AE298) is 0 31 0 31 0 31, which is outside the whole 
extent 0 32 0 27 0 9. 

Volume rendering of the resulting vtkImageData is working fine!  But this 
error message won't go away.  In this case, a 33x28x10 vtkRectilinearGrid 
is the "Source" and a 32x32x32 vtkImageData grid is the "Input" to the 
vtkProbeFilter (see code below).  Like I said, everything works great. The 
scalar values are generated correctly from the vtkProbeFilter.  The volume 
rendering appears and behaves very well.  The only problem is that this 
error message pops up with the VtkOutputWindow.  I looks like the 
vtkImageData object (32x32x32) has inherited the "whole extent" of the 
original vtkRectilinearGrid (33x28x10)?  This doesn't make sense.  Is 
there a better (i.e. more correct) way to create a volume rendering of 
Rectilinear Grid data?  Can I turn off the VtkOutputWindow as a temporary 
fix?  Somebody please help.... I'm going crazy on this one.


Note:  Code is in Visual Basic (We are using Andrew Dolgert's ".NET 
Wrappers for VTK 5" - works great!) 


    Private Sub LoadVolumeActor() 

        'Create a rectilinear grid (any resolution and spacing in X, Y, 
and Z) 
        Dim vtkGrid3D as vtk.vtkRectilinearGrid = Me.LoadRectilinearGrid() 


        'Create the image data grid 
        Dim ImageGrid As New vtk.vtkImageData 
        Dim nx As Integer = 32 
        ImageGrid.SetDimensions(nx, nx, nx) 
        ImageGrid.SetOrigin(m_sngGridMinX, m_sngGridMinY, m_sngGridMinZ) 
        ImageGrid.SetSpacing((m_sngGridMaxX - m_sngGridMinX) / (nx - 1), _ 

                             (m_sngGridMaxY - m_sngGridMinY) / (nx - 1), _ 

                             (m_sngGridMaxZ - m_sngGridMinZ) / (nx - 1)) 

        'Use probe filter to get scalar values for image data grid 
        Dim Probe As New vtk.vtkProbeFilter 
        Probe.SetInput(ImageGrid) 
        Probe.SetSource(m_vtkGrid3D) 

        'Convert the image data grid scalars from float to unsigned 
character 
        Dim ScalarMin, ScalarMax As Double 
        Me.GetScalarMinMax(vtkGrid3D, ScalarMin, ScalarMax) 
        Dim Shift As Double = -ScalarMin 
        Dim Scale As Double = 255.0 / (ScalarMax - ScalarMin) 
        Dim ShiftScale As New vtk.vtkImageShiftScale 
        ShiftScale.SetShift(Shift) 
        ShiftScale.SetScale(Scale) 
        ShiftScale.SetOutputScalarTypeToUnsignedChar() 
        ShiftScale.SetInput(Probe.GetImageDataOutput) 

        'Volume function 
        Dim VolumeFunction As New vtk.vtkVolumeRayCastMIPFunction 
        VolumeFunction.SetMaximizeMethodToScalarValue()  'Default method 
        'VolumeFunction.SetMaximizeMethodToOpacity()     'Alternate method 


        'Volume mapper 
        Dim VolumeMapper As New vtk.vtkVolumeRayCastMapper 
        VolumeMapper.SetVolumeRayCastFunction(VolumeFunction) 
        VolumeMapper.SetSampleDistance((m_sngGridMaxX - m_sngGridMinX) / 
((nx - 1) * 3)) 
        VolumeMapper.SetInput(ShiftScale.GetOutput) 

        'Opacity transfer function 
        Dim OpacityTransferFunction As New vtk.vtkPiecewiseFunction 
        OpacityTransferFunction.AddPoint(0.0, 0.7) 
        OpacityTransferFunction.AddPoint(255.0, 0.7) 

        'Volume property 
        Dim VolumeProperty As New vtk.vtkVolumeProperty 
        'VolumeProperty.SetInterpolationTypeToNearest()   'Default - 
faster, course image 
        VolumeProperty.SetInterpolationTypeToLinear()   'Smoother - 
slower, smooth image 
        VolumeProperty.SetScalarOpacity(OpacityTransferFunction) 
        VolumeProperty.SetColor(Me.CreateLookupTable(ActorIndex, 
SetLutOptions.NewLUT, Shift, Scale)) 

        'Volume actor 
        Dim Volume As New vtk.vtkVolume 
        Volume.SetMapper(VolumeMapper) 
        Volume.SetProperty(VolumeProperty) 

        m_vtkRen1.AddVolume(Volume) 
        m_vtkRenWin.Render() 

    End Sub 

Steve Koch
Applications Developer

Trinity Consultants, Inc.
skoch at trinityconsultants.com
phone: 972-661-8881 x1332
fax: +214-615-7425
breeze-software.com 
_________________________________________________________________________

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you
Received this in error, please contact the sender and delete the material 
from any computer.
_________________________________________________________________________
_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: 
http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers

_________________________________________________________________________

The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.   If you
Received this in error, please contact the sender and delete the material 
from any computer.
_________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20060926/9742d14b/attachment.htm>


More information about the vtkusers mailing list