import vtk


# track the mouse interaction with gthe planes and ouput the slice number, mm and ref details if loaded
def MouseTracker(self, frame_parent):
    self.frame_parent = frame_parent
    for i in range(1,len(self.frame_parent.PWG)+1):
        self.frame_parent.PWG[i][0].setlocation(self.frame_parent.PWG[0][0])
        for j in range(3):
            #TODO - dont do this here
            y = vtk.vtkLookupTable()
            y.SetNumberOfTableValues(256)
            y.SetTableRange(0,20)
            y.Build()
            if i == 1:
                self.PWG[i][0].planewidgets[j].GetColorMap().SetLookupTable(y)
                self.PWG[i][0].planewidgets[j].GetColorMap().GetLookupTable().SetTableValue(0, (0.0,0.0,0.0,0.0))
                self.PWG[i][0].planewidgets[j].GetColorMap().SetOutputFormatToRGBA()
            elif i == 2:
                self.PWG[i][0].planewidgets[j].GetColorMap().SetLookupTable(y)
                self.PWG[i][0].planewidgets[j].GetColorMap().GetLookupTable().SetTableValue(0, (0.0,0.0,0.0,0.0))
                self.PWG[i][0].planewidgets[j].GetColorMap().SetOutputFormatToRGBA()                   
            else:
                self.PWG[i][0].planewidgets[j].GetColorMap().SetLookupTable(y)
                self.PWG[i][0].planewidgets[j].GetColorMap().SetOutputFormatToRGBA()
                self.PWG[i][0].planewidgets[j].GetColorMap().GetLookupTable().SetTableValue(0, (0.0,0.0,0.0,0.0))
                
    if self.PWG[0][0].planewidgets[0].GetCursorDataStatus() == 1:
        self.cursor_curr_slice_num = self.PWG[0][0].planewidgets[0].GetCurrentCursorPosition()
        display_coords(self, self)

    elif self.PWG[0][0].planewidgets[1].GetCursorDataStatus() == 1:
        self.cursor_curr_slice_num = self.PWG[0][0].planewidgets[1].GetCurrentCursorPosition()
        display_coords(self, self)

    elif self.PWG[0][0].planewidgets[2].GetCursorDataStatus() == 1:
        self.cursor_curr_slice_num = self.PWG[0][0].planewidgets[2].GetCurrentCursorPosition()
        display_coords(self, self)

    else:
        return
