import vtk
import wx
from numpy import *
from stc_io import *
from dv3dFreeSurferLoad import *
import time
from dv3dObjectsToRender import *
from dv3dPropertyFrames import *
from dv3dFreeSurferLoad import *
from common_functions import align_all_planes

import dv3d_tmp_SurfaceIntersectsVolumeData 


def animate(the_parent_frame):
	frame_parent = the_parent_frame
	frame_parent.point_picker = vtk.vtkPointPicker()
	frame_parent.widget.SetPicker(frame_parent.point_picker)
	
	def annotatePick(object, event):
		frame_parent.selPt = frame_parent.point_picker.GetSelectionPoint()
		frame_parent.pickPos = frame_parent.point_picker.GetPickPosition()
		frame_parent.pickPointID = frame_parent.point_picker.GetPointId()
		print 'index of point picked: '+ str(frame_parent.pickPointID)
		print 'position of point picked: '+str(frame_parent.pickPos)
		#to test whether the coords match as expected
		print frame_parent.point_picker.GetActor().GetMapper().GetInput().GetPointData().GetScalars().GetTuple1(frame_parent.pickPointID)
			
	# Now at the end of the pick event call the ppabove function.
	frame_parent.point_picker.AddObserver("EndPickEvent", annotatePick)
