import vtk

def UseCurrentSurfaceAsDataProbe(frame_parent, the_surface, the_volume):
    print 'skjdfhs'
    LUT = the_volume.lookuptable
    
    #here we do now want null values to be transparent
    LUT.SetTableValue(0, (0.5,0.5,0.5,1.0))
    LUT.Build()
    
    a = the_surface.GetMapper()
    b = a.GetInput()
    
    # the really clever bit (thx VTK!) - wherever i have a datapoint on my
    # surface, go to thesame datapoint in the stat-volume and extract the
    # scalar value there- probe the data with spatial filter - ProbeFilter
    stat_probe = vtk.vtkProbeFilter()
    
    #stat_probe.SetInput(deci.GetOutput()) 
    stat_probe.SetInput(b) 
    stat_probe.SetSource(the_volume.volume_data.GetOutput())#.GetOutput())
    print 'here 234234234343234'
    stat_contourMapper = vtk.vtkPolyDataMapper()
    stat_contourMapper.SetInputConnection(stat_probe.GetOutputPort())
    #stat_contourMapper.SetScalarRange(frame_parent.stat_vol.GetOutput().GetScalarRange()) #e.g. dynamically set the scalarrange based on values in the data
    stat_contourMapper.SetScalarRange(LUT.GetTableRange())
    #stat_contourMapper.GetLookupTable().SetTableValue(0, (0.5,0.5,0.5,1.0))
    stat_contourMapper.SetLookupTable(LUT)
    stat_contourMapper.SetColorModeToMapScalars()
    
    # set a colour bar for reference of scalar value mapping
    pos_scalarBar =  vtk.vtkScalarBarActor()
    pos_scalarBar.SetLookupTable(the_volume.lookuptable)
    pos_scalarBar.SetTitle('')
    pos_scalarBar.GetTitleTextProperty().SetFontSize(24)
    pos_scalarBar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport()
    pos_scalarBar.GetPositionCoordinate().SetValue(0.05,0.75)
    pos_scalarBar.SetWidth(0.05)
    pos_scalarBar.SetHeight(0.2)
    frame_parent.ren.AddActor2D(pos_scalarBar)
    pos_scalarBar.SetNumberOfLabels(5)
    pos_scalarBar.SetOrientationToVertical()
    
    #now pass all our created and updated objects to the renderer
    frame_parent.stat_contourActor = vtk.vtkActor()
    frame_parent.stat_contourActor.SetMapper(stat_contourMapper)
    frame_parent.stat_contourActor.VisibilityOn()
    frame_parent.stat_contourActor.GetProperty().SetBackfaceCulling(0)
    frame_parent.ren.AddActor(frame_parent.stat_contourActor)
    frame_parent.widget.Render()
    align_all_planes(frame_parent)