Ejemplo n.º 1
0
 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(
         self, module_manager,
         vtk.vtkImageToStructuredPoints(), 'Processing.',
         ('vtkImageData', 'vtkImageData'), ('vtkStructuredPoints',),
         replaceDoc=True,
         inputFunctions=None, outputFunctions=None)
 def __init__(self, module_manager):
     SimpleVTKClassModuleBase.__init__(self,
                                       module_manager,
                                       vtk.vtkImageToStructuredPoints(),
                                       'Processing.',
                                       ('vtkImageData', 'vtkImageData'),
                                       ('vtkStructuredPoints', ),
                                       replaceDoc=True,
                                       inputFunctions=None,
                                       outputFunctions=None)
Ejemplo n.º 3
0
imgGradient.SetInputConnection(gs.GetOutputPort())
imgGradient.SetDimensionality(2)
imgMagnitude = vtk.vtkImageMagnitude()
imgMagnitude.SetInputConnection(imgGradient.GetOutputPort())
imgMagnitude.Update()
# non maximum suppression
nonMax = vtk.vtkImageNonMaximumSuppression()
nonMax.SetMagnitudeInputData(imgMagnitude.GetOutput())
nonMax.SetVectorInputData(imgGradient.GetOutput())
nonMax.SetDimensionality(2)
pad = vtk.vtkImageConstantPad()
pad.SetInputConnection(imgGradient.GetOutputPort())
pad.SetOutputNumberOfScalarComponents(3)
pad.SetConstant(0)
pad.Update()
i2sp1 = vtk.vtkImageToStructuredPoints()
i2sp1.SetInputConnection(nonMax.GetOutputPort())
i2sp1.SetVectorInputData(pad.GetOutput())
# link edgles
imgLink = vtk.vtkLinkEdgels()
imgLink.SetInputConnection(i2sp1.GetOutputPort())
imgLink.SetGradientThreshold(2)
# threshold links
thresholdEdgels = vtk.vtkThreshold()
thresholdEdgels.SetInputConnection(imgLink.GetOutputPort())
thresholdEdgels.SetThresholdFunction(vtk.vtkThreshold.THRESHOLD_UPPER)
thresholdEdgels.SetUpperThreshold(10.0)
thresholdEdgels.AllScalarsOff()
gf = vtk.vtkGeometryFilter()
gf.SetInputConnection(thresholdEdgels.GetOutputPort())
i2sp = vtk.vtkImageToStructuredPoints()
Ejemplo n.º 4
0
    def __init__(self):
        ActorFactory.ActorFactory.__init__(self)

        # whether to display the volume
        self._ShowVolume = 1
        self._StatusChange = 0

        # create a clipping cube to go with the volume
        self._ClippingCube = ClippingCubeFactory.ClippingCubeFactory()
        self.AddChild(self._ClippingCube)
        self._CubeClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CubeClippingPlanes.AddItem(vtk.vtkPlane())

        # for if we clip in with OrthoPlanes
        self._OrthoPlanes = None
        self._ShowOrthoPlanes = 1
        self._OrthoPlanesLookupTables = {}
        self._OrthoPickThreshold = 0.0025

        # corner clipping planes, in pairs with opposite normals
        self._CornerClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CornerClippingPlanes.AddItem(vtk.vtkPlane())

        # clipping planes for the volume, sorted for the
        # three chunks that will make up the final volume
        self._ClippingPlanes = [
            vtk.vtkPlaneCollection(),
            vtk.vtkPlaneCollection(),
            vtk.vtkPlaneCollection()
        ]

        for i in range(3):
            planes = self._ClippingPlanes[i]
            cplanes = self._CornerClippingPlanes
            bplanes = self._CubeClippingPlanes
            if i == 0:
                planes.AddItem(cplanes.GetItemAsObject(0))
                planes.AddItem(bplanes.GetItemAsObject(1))
                planes.AddItem(bplanes.GetItemAsObject(2))
                planes.AddItem(bplanes.GetItemAsObject(3))
                planes.AddItem(bplanes.GetItemAsObject(4))
                planes.AddItem(bplanes.GetItemAsObject(5))
            else:
                planes.AddItem(bplanes.GetItemAsObject(0))
                planes.AddItem(cplanes.GetItemAsObject(1))
                if i == 1:
                    planes.AddItem(cplanes.GetItemAsObject(2))
                    planes.AddItem(bplanes.GetItemAsObject(3))
                    planes.AddItem(bplanes.GetItemAsObject(4))
                    planes.AddItem(bplanes.GetItemAsObject(5))
                else:
                    planes.AddItem(bplanes.GetItemAsObject(2))
                    planes.AddItem(cplanes.GetItemAsObject(3))
                    if i == 2:
                        planes.AddItem(cplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))
                    else:
                        planes.AddItem(bplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))

        self._Input = None

        # generate the pipeline
        self._ImagePrefilter = vtk.vtkImageShrink3D()

        self._ImageReslice = vtk.vtkImageReslice()
        self._ImageReslice.SetInterpolationModeToLinear()

        self._ImageMapToColors = vtk.vtkImageMapToColors()
        self._ImageMapToColors.SetOutputFormatToRGBA()

        self._ImageToStructuredPoints = vtk.vtkImageToStructuredPoints()

        self._ImageClipsXY = []
        self._PlanesXY = []
        self._ActorsXY = []
        self._PropertyXY = vtk.vtkProperty()
        self._PropertyXY.SetDiffuse(0)
        self._PropertyXY.SetAmbient(1)

        self._ImageClipsYZ = []
        self._PlanesYZ = []
        self._ActorsYZ = []
        self._PropertyYZ = vtk.vtkProperty()
        self._PropertyYZ.SetDiffuse(0)
        self._PropertyYZ.SetAmbient(1)

        self._ImageClipsZX = []
        self._PlanesZX = []
        self._ActorsZX = []
        self._PropertyZX = vtk.vtkProperty()
        self._PropertyZX.SetDiffuse(0)
        self._PropertyZX.SetAmbient(1)

        # a list of the renderer info
        self._RendererCurrentIndex = {}
        self._RendererActorList = {}
        self._RendererObserverList = {}

        # a transform to apply to the image
        self._ImageTransform = None
        self._TransformToGrid = vtk.vtkTransformToGrid()

        # the alpha pick threshold for the volume
        self._PickThreshold = 0.25
        # the implicit volume for finding the gradient
        self._ImplicitVolume = vtk.vtkImplicitVolume()

        # the extent of the texture maps
        self._VolumeResolution = (64, 64, 64)

        # the bounds of the volume
        self._VolumeBounds = None
Ejemplo n.º 5
0
sample.Update()
threshold1 = vtk.vtkThreshold()
threshold1.SetInputConnection(sample.GetOutputPort())
threshold1.SetThresholdFunction(vtk.vtkThreshold.THRESHOLD_LOWER)
threshold1.SetLowerThreshold(0.001)
geometry = vtk.vtkGeometryFilter()
geometry.SetInputConnection(threshold1.GetOutputPort())
grad = vtk.vtkImageGradient()
grad.SetDimensionality(3)
grad.SetInputConnection(sample.GetOutputPort())
grad.Update()
mult = vtk.vtkImageMathematics()
mult.SetOperationToMultiply()
mult.SetInput1Data(sample.GetOutput())
mult.SetInput2Data(sample.GetOutput())
itosp = vtk.vtkImageToStructuredPoints()
itosp.SetInputConnection(mult.GetOutputPort())
itosp.SetVectorInputData(grad.GetOutput())
itosp.Update()
sub = vtk.vtkSubPixelPositionEdgels()
sub.SetInputConnection(geometry.GetOutputPort())
sub.SetGradMapsData(itosp.GetOutput())
mapper = vtk.vtkDataSetMapper()
mapper.SetInputConnection(sub.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Create renderer stuff
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
Ejemplo n.º 6
0
sample.ComputeNormalsOff()
sample.Update()
threshold1 = vtk.vtkThreshold()
threshold1.SetInputConnection(sample.GetOutputPort())
threshold1.ThresholdByLower(0.001)
geometry = vtk.vtkGeometryFilter()
geometry.SetInputConnection(threshold1.GetOutputPort())
grad = vtk.vtkImageGradient()
grad.SetDimensionality(3)
grad.SetInputConnection(sample.GetOutputPort())
grad.Update()
mult = vtk.vtkImageMathematics()
mult.SetOperationToMultiply()
mult.SetInput1Data(sample.GetOutput())
mult.SetInput2Data(sample.GetOutput())
itosp = vtk.vtkImageToStructuredPoints()
itosp.SetInputConnection(mult.GetOutputPort())
itosp.SetVectorInputData(grad.GetOutput())
itosp.Update()
sub = vtk.vtkSubPixelPositionEdgels()
sub.SetInputConnection(geometry.GetOutputPort())
sub.SetGradMapsData(itosp.GetOutput())
mapper = vtk.vtkDataSetMapper()
mapper.SetInputConnection(sub.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Create renderer stuff
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
    def __init__(self):
        ActorFactory.ActorFactory.__init__(self)

        # whether to display the volume
        self._ShowVolume = 1
        self._StatusChange = 0

        # create a clipping cube to go with the volume
        self._ClippingCube = ClippingCubeFactory.ClippingCubeFactory()
        self.AddChild(self._ClippingCube)
        self._CubeClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CubeClippingPlanes.AddItem(vtk.vtkPlane())

        # for if we clip in with OrthoPlanes
        self._OrthoPlanes = None
        self._ShowOrthoPlanes = 1
        self._OrthoPlanesLookupTables = {}
        self._OrthoPickThreshold = 0.0025

        # corner clipping planes, in pairs with opposite normals
        self._CornerClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CornerClippingPlanes.AddItem(vtk.vtkPlane())

        # clipping planes for the volume, sorted for the
        # three chunks that will make up the final volume
        self._ClippingPlanes = [vtk.vtkPlaneCollection(),
                                vtk.vtkPlaneCollection(),
                                vtk.vtkPlaneCollection()]

        for i in range(3):
            planes = self._ClippingPlanes[i]
            cplanes = self._CornerClippingPlanes
            bplanes = self._CubeClippingPlanes
            if i == 0:
                planes.AddItem(cplanes.GetItemAsObject(0))
                planes.AddItem(bplanes.GetItemAsObject(1))
                planes.AddItem(bplanes.GetItemAsObject(2))
                planes.AddItem(bplanes.GetItemAsObject(3))
                planes.AddItem(bplanes.GetItemAsObject(4))
                planes.AddItem(bplanes.GetItemAsObject(5))
            else:
                planes.AddItem(bplanes.GetItemAsObject(0))
                planes.AddItem(cplanes.GetItemAsObject(1))
                if i == 1:
                    planes.AddItem(cplanes.GetItemAsObject(2))
                    planes.AddItem(bplanes.GetItemAsObject(3))
                    planes.AddItem(bplanes.GetItemAsObject(4))
                    planes.AddItem(bplanes.GetItemAsObject(5))
                else:
                    planes.AddItem(bplanes.GetItemAsObject(2))
                    planes.AddItem(cplanes.GetItemAsObject(3))
                    if i == 2:
                        planes.AddItem(cplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))
                    else:
                        planes.AddItem(bplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))

        self._Input = None

        # generate the pipeline
        self._ImagePrefilter = vtk.vtkImageShrink3D()

        self._ImageReslice = vtk.vtkImageReslice()
        self._ImageReslice.SetInterpolationModeToLinear()

        self._ImageMapToColors = vtk.vtkImageMapToColors()
        self._ImageMapToColors.SetOutputFormatToRGBA()

        self._ImageToStructuredPoints = vtk.vtkImageToStructuredPoints()

        self._ImageClipsXY = []
        self._PlanesXY = []
        self._ActorsXY = []
        self._PropertyXY = vtk.vtkProperty()
        self._PropertyXY.SetDiffuse(0)
        self._PropertyXY.SetAmbient(1)

        self._ImageClipsYZ = []
        self._PlanesYZ = []
        self._ActorsYZ = []
        self._PropertyYZ = vtk.vtkProperty()
        self._PropertyYZ.SetDiffuse(0)
        self._PropertyYZ.SetAmbient(1)

        self._ImageClipsZX = []
        self._PlanesZX = []
        self._ActorsZX = []
        self._PropertyZX = vtk.vtkProperty()
        self._PropertyZX.SetDiffuse(0)
        self._PropertyZX.SetAmbient(1)

        # a list of the renderer info
        self._RendererCurrentIndex = {}
        self._RendererActorList = {}
        self._RendererObserverList = {}

        # a transform to apply to the image
        self._ImageTransform = None
        self._TransformToGrid = vtk.vtkTransformToGrid()

        # the alpha pick threshold for the volume
        self._PickThreshold = 0.25
        # the implicit volume for finding the gradient
        self._ImplicitVolume = vtk.vtkImplicitVolume()

        # the extent of the texture maps
        self._VolumeResolution = (64, 64, 64)

        # the bounds of the volume
        self._VolumeBounds = None
Ejemplo n.º 8
0
imgGradient.SetInputConnection(gs.GetOutputPort())
imgGradient.SetDimensionality(2)
imgMagnitude = vtk.vtkImageMagnitude()
imgMagnitude.SetInputConnection(imgGradient.GetOutputPort())
imgMagnitude.Update()
# non maximum suppression
nonMax = vtk.vtkImageNonMaximumSuppression()
nonMax.SetMagnitudeInputData(imgMagnitude.GetOutput())
nonMax.SetVectorInputData(imgGradient.GetOutput())
nonMax.SetDimensionality(2)
pad = vtk.vtkImageConstantPad()
pad.SetInputConnection(imgGradient.GetOutputPort())
pad.SetOutputNumberOfScalarComponents(3)
pad.SetConstant(0)
pad.Update()
i2sp1 = vtk.vtkImageToStructuredPoints()
i2sp1.SetInputConnection(nonMax.GetOutputPort())
i2sp1.SetVectorInputData(pad.GetOutput())
# link edgles
imgLink = vtk.vtkLinkEdgels()
imgLink.SetInputConnection(i2sp1.GetOutputPort())
imgLink.SetGradientThreshold(2)
# threshold links
thresholdEdgels = vtk.vtkThreshold()
thresholdEdgels.SetInputConnection(imgLink.GetOutputPort())
thresholdEdgels.ThresholdByUpper(10)
thresholdEdgels.AllScalarsOff()
gf = vtk.vtkGeometryFilter()
gf.SetInputConnection(thresholdEdgels.GetOutputPort())
i2sp = vtk.vtkImageToStructuredPoints()
i2sp.SetInputConnection(imgMagnitude.GetOutputPort())
Ejemplo n.º 9
0
def setupPipeline():
    #read file
    global reader
    reader = vtk.vtkOBJReader()
    reader.SetFileName(filename)

    #map 3d model
    global mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(reader.GetOutputPort())

    #set actor
    global actor
    actor = vtk.vtkActor()
    actor.SetMapper(mapper)

    # Create a rendering window and renderer
    global ren
    ren = vtk.vtkRenderer()
    ren.SetBackground(0, 0, 0)
    ren.AddActor(actor)

    global intermediateWindow
    intermediateWindow = vtk.vtkRenderWindow()
    intermediateWindow.AddRenderer(ren)

    #render image
    global renImage
    renImage = vtk.vtkRenderLargeImage()
    renImage.SetInput(ren)
    renImage.SetMagnification(magnificationFactor)

    #Canny edge detector inspired by
    #https://vtk.org/Wiki/VTK/Examples/Cxx/Images/CannyEdgeDetector

    #to grayscale
    global lumImage
    lumImage = vtk.vtkImageLuminance()
    lumImage.SetInputConnection(renImage.GetOutputPort())

    #to float
    global floatImage
    floatImage = vtk.vtkImageCast()
    floatImage.SetOutputScalarTypeToFloat()
    floatImage.SetInputConnection(lumImage.GetOutputPort())

    #gaussian convolution
    global smoothImage
    smoothImage = vtk.vtkImageGaussianSmooth()
    smoothImage.SetInputConnection(floatImage.GetOutputPort())
    smoothImage.SetDimensionality(2)
    smoothImage.SetRadiusFactors(1, 1, 0)

    #gradient
    global gradientImage
    gradientImage = vtk.vtkImageGradient()
    gradientImage.SetInputConnection(smoothImage.GetOutputPort())
    gradientImage.SetDimensionality(2)

    #gradient magnitude
    global magnitudeImage
    magnitudeImage = vtk.vtkImageMagnitude()
    magnitudeImage.SetInputConnection(gradientImage.GetOutputPort())

    #non max suppression
    global nonmaxSuppr
    nonmaxSuppr = vtk.vtkImageNonMaximumSuppression()
    nonmaxSuppr.SetDimensionality(2)

    #padding
    global padImage
    padImage = vtk.vtkImageConstantPad()
    padImage.SetInputConnection(gradientImage.GetOutputPort())
    padImage.SetOutputNumberOfScalarComponents(3)
    padImage.SetConstant(0)

    #to structured points
    global i2sp1
    i2sp1 = vtk.vtkImageToStructuredPoints()
    i2sp1.SetInputConnection(nonmaxSuppr.GetOutputPort())

    #link edges
    global linkImage
    linkImage = vtk.vtkLinkEdgels()
    linkImage.SetInputConnection(i2sp1.GetOutputPort())
    linkImage.SetGradientThreshold(2)

    #thresholds links
    global thresholdEdgels
    thresholdEdgels = vtk.vtkThreshold()
    thresholdEdgels.SetInputConnection(linkImage.GetOutputPort())
    thresholdEdgels.ThresholdByUpper(10)
    thresholdEdgels.AllScalarsOff()

    #filter
    global gf
    gf = vtk.vtkGeometryFilter()
    gf.SetInputConnection(thresholdEdgels.GetOutputPort())

    #to structured points
    global i2sp
    i2sp = vtk.vtkImageToStructuredPoints()
    i2sp.SetInputConnection(magnitudeImage.GetOutputPort())

    #subpixel
    global spe
    spe = vtk.vtkSubPixelPositionEdgels()
    spe.SetInputConnection(gf.GetOutputPort())

    #stripper
    global strip
    strip = vtk.vtkStripper()
    strip.SetInputConnection(spe.GetOutputPort())

    global dsm
    dsm = vtk.vtkPolyDataMapper()
    dsm.SetInputConnection(strip.GetOutputPort())
    dsm.ScalarVisibilityOff()

    global planeActor
    planeActor = vtk.vtkActor()
    planeActor.SetMapper(dsm)
    planeActor.GetProperty().SetAmbient(1.0)
    planeActor.GetProperty().SetDiffuse(0.0)

    global edgeRender
    edgeRender = vtk.vtkRenderer()
    edgeRender.AddActor(planeActor)
    global renderWindow
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(edgeRender)

    global finalImage
    finalImage = vtk.vtkRenderLargeImage()
    finalImage.SetMagnification(magnificationFactor)
    finalImage.SetInput(edgeRender)

    global revImage
    revImage = vtk.vtkImageThreshold()
    revImage.SetInputConnection(finalImage.GetOutputPort())
    revImage.ThresholdByUpper(127)
    revImage.ReplaceInOn()
    revImage.ReplaceOutOn()
    revImage.SetOutValue(255)
    revImage.SetInValue(0)

    #write image
    global imgWriter
    imgWriter = vtk.vtkPNGWriter()
    imgWriter.SetInputConnection(revImage.GetOutputPort())
    imgWriter.SetFileName("test.png")
Ejemplo n.º 10
0
    def __init__(self):
        ActorFactory.ActorFactory.__init__(self)

        self._LookupTable = None  # lookup table is currently not used
        self._ColorTransferFunction = None
        self._OpacityTransferFunction = None
        self._RendererObserverList = {}

        # create a clipping cube to go with the volume
        self._ClippingCube = ClippingCubeFactory.ClippingCubeFactory()
        self.AddChild(self._ClippingCube)
        self._CubeClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CubeClippingPlanes.AddItem(vtk.vtkPlane())

        # corner clipping planes, in pairs with opposite normals
        self._CornerClippingPlanes = vtk.vtkPlaneCollection()
        for i in range(6):
            self._CornerClippingPlanes.AddItem(vtk.vtkPlane())

        # clipping planes for the volume, sorted for the
        # three chunks that will make up the final volume
        # (these are currently unused)
        self._ClippingPlanes = [vtk.vtkPlaneCollection(),
                                vtk.vtkPlaneCollection(),
                                vtk.vtkPlaneCollection()]

        for i in range(3):
            planes = self._ClippingPlanes[i]
            cplanes = self._CornerClippingPlanes
            bplanes = self._CubeClippingPlanes
            if i == 0:
                planes.AddItem(cplanes.GetItemAsObject(0))
                planes.AddItem(bplanes.GetItemAsObject(1))
                planes.AddItem(bplanes.GetItemAsObject(2))
                planes.AddItem(bplanes.GetItemAsObject(3))
                planes.AddItem(bplanes.GetItemAsObject(4))
                planes.AddItem(bplanes.GetItemAsObject(5))
            else:
                planes.AddItem(bplanes.GetItemAsObject(0))
                planes.AddItem(cplanes.GetItemAsObject(1))
                if i == 1:
                    planes.AddItem(cplanes.GetItemAsObject(2))
                    planes.AddItem(bplanes.GetItemAsObject(3))
                    planes.AddItem(bplanes.GetItemAsObject(4))
                    planes.AddItem(bplanes.GetItemAsObject(5))
                else:
                    planes.AddItem(bplanes.GetItemAsObject(2))
                    planes.AddItem(cplanes.GetItemAsObject(3))
                    if i == 2:
                        planes.AddItem(cplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))
                    else:
                        planes.AddItem(bplanes.GetItemAsObject(4))
                        planes.AddItem(bplanes.GetItemAsObject(5))

        # generate the pipeline pieces
        self._Input = None

        # transform the full-resolution volume
        self._RayCastReslice = vtk.vtkImageReslice()
        self._RayCastReslice.SetInterpolationModeToLinear()

        # subsample the volume for low-res rendering
        self._ImagePrefilter1 = vtk.vtkImageShrink3D()

        self._ImagePrefilter2 = vtk.vtkImageShrink3D()

        # transform the subsampled volume
        self._ImageReslice1 = vtk.vtkImageReslice()
        self._ImageReslice1.SetInterpolationModeToLinear()

        self._ImageReslice2 = vtk.vtkImageReslice()
        self._ImageReslice2.SetInterpolationModeToLinear()

        # convert to RGBA for rendering (unused)
        self._ImageMapToColors = vtk.vtkImageMapToColors()
        self._ImageMapToColors.SetOutputFormatToRGBA()

        # strictly for VTK 3.2 compatibility
        self._ImageToStructuredPoints = vtk.vtkImageToStructuredPoints()

        # a transform to apply to the image
        self._ImageTransform = None
        self._TransformToGrid = vtk.vtkTransformToGrid()

        # the opacity pick threshold for the volume
        self._PickThreshold = 0.99
        # the implicit volume for finding the gradient
        self._ImplicitVolume = vtk.vtkImplicitVolume()

        # the texture dimensions (later this will be set automatically
        #    to provide the desired interactive rendering time)
        self._TextureSize = 128

        # the bounds of the volume
        self._VolumeBounds = None

        # vtkVolume specific stuff
        self._VolumeProperty = vtk.vtkVolumeProperty()
        self._VolumeProperty.SetInterpolationTypeToLinear()

        rayCastFunction = vtk.vtkVolumeRayCastCompositeFunction()
        self._VolumeRayCastMapper = vtk.vtkVolumeRayCastMapper()
        self._VolumeRayCastMapper.SetVolumeRayCastFunction(rayCastFunction)
        self._VolumeRayCastMapper.SetClippingPlanes(
            self._ClippingCube.GetClippingPlanes())
        try:  # vtk 3.2 does not contain this function call:
            self._VolumeRayCastMapper.AutoAdjustSampleDistancesOff()
        except:
            pass

        self._VolumeTextureMapper1 = vtk.vtkVolumeTextureMapper2D()
        self._VolumeTextureMapper1.SetTargetTextureSize(old_div(self._TextureSize, 4),
                                                        old_div(self._TextureSize, 4))
        self._VolumeTextureMapper1.SetMaximumNumberOfPlanes(
            old_div(self._TextureSize, 2))
        self._VolumeTextureMapper1.SetClippingPlanes(
            self._ClippingCube.GetClippingPlanes())
        try:  # vtk 3.2 does not contain this function call:
            # set to the amount of available texture memory (24MB is a good
            # start)
            self._VolumeTextureMapper1.SetMaximumStorageSize(24 * 1024 * 1024)
        except:
            pass

        self._VolumeTextureMapper2 = vtk.vtkVolumeTextureMapper2D()
        self._VolumeTextureMapper2.SetTargetTextureSize(self._TextureSize,
                                                        self._TextureSize)
        self._VolumeTextureMapper2.SetMaximumNumberOfPlanes(self._TextureSize)
        self._VolumeTextureMapper2.SetClippingPlanes(
            self._ClippingCube.GetClippingPlanes())

        try:  # vtk 3.2 does not contain this function call:
            # set to the amount of available texture memory (24MB is a good
            # start)
            self._VolumeTextureMapper2.SetMaximumStorageSize(24 * 1024 * 1024)
        except:
            pass

        # set two levels of detail: texture and ray-casting
        self._Volume = vtk.vtkLODProp3D()
        self._Volume.PickableOff()
        idT1 = self._Volume.AddLOD(self._VolumeTextureMapper1,
                                   self._VolumeProperty,
                                   0.02)
        idT2 = self._Volume.AddLOD(self._VolumeTextureMapper2,
                                   self._VolumeProperty,
                                   0.1)

        # remember these LOD id numbers
        self._lod = [idT1, idT2]

#        idRC = self._Volume.AddLOD(self._VolumeRayCastMapper,
#                                   self._VolumeProperty,
#                                   2.0)
        self._Volume.SetLODLevel(idT1, 2.0)
        self._Volume.SetLODLevel(idT2, 1.0)