def make_permutation_plot(figuresize):
    mesh_one = mesh.creation.generate_random_tesselation(9,9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )
    
    for element in mesh_one.elements:
        element.global_id = None
  
    for element in mesh_two.elements:
        element.global_id = None
 
    tracked_ids_all = tracking.track(mesh_one, mesh_two)        

    plotname = 'permutation'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all, plotname, figuresize)
def make_general_division_plot(figuresize):
    """We load a mesh where two maximum common subgraphs will be identified, and track the division event"""

    mesh_one = mesh.creation.generate_random_tesselation(9, 9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[
            element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    # pick the element closest to the centre
    most_central_element = mesh_two.find_most_central_element()

    mesh_two.divide_element_with_frame_id_in_direction(
        most_central_element.id_in_frame, [1.0, 1.0])

    tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

    for element in mesh_one.elements:
        element.global_id = None

    for element in mesh_two.elements:
        element.global_id = None

    tracked_ids_all = tracking.track(mesh_one, mesh_two)

    plotname = 'division_general'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all,
                         plotname, figuresize)
def make_permutation_plot(figuresize):
    mesh_one = mesh.creation.generate_random_tesselation(9, 9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[
            element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

    for element in mesh_one.elements:
        element.global_id = None

    for element in mesh_two.elements:
        element.global_id = None

    tracked_ids_all = tracking.track(mesh_one, mesh_two)

    plotname = 'permutation'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all,
                         plotname, figuresize)
    def test_plot_all_global_ids_same_color(self):
        """plot all global ids same color
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(8,8)
        
        mesh_two = copy.deepcopy(mesh_one)

        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # Perform T1 swap on mesh two 
        # First pick a node in the centre
        mesh_centre = mesh_two.calculate_centre()

        # pick the node closest to the centre
        most_central_node = mesh_two.find_most_central_node()
               
        # pick a node that shares an edge with this central node
        for local_index, element_node in enumerate(most_central_node.adjacent_elements[0].nodes):
            if element_node.id == most_central_node.id:
                num_nodes_this_element = most_central_node.adjacent_elements[0].get_num_nodes()
                one_edge_node = most_central_node.adjacent_elements[0].nodes[(local_index+1)%num_nodes_this_element]
                break
        
        mesh_two.perform_t1_swap( most_central_node.id, one_edge_node.id )
         
        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

        mesh_two.plot(path.join(dirname(__file__),'output','visualisation_in_green.pdf'), color_by_global_id = 'g', 
                      total_number_of_global_ids = mesh_one.get_num_elements())
def make_death_plots(figuresize):
    mesh_one = mesh.creation.generate_random_tesselation(9, 9)
    mesh_two = copy.deepcopy(mesh_one)

    # First pick a cell in the centre
    mesh_centre = mesh_two.calculate_centre()

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    most_central_element = mesh_two.find_most_central_element()

    mesh_two.kill_element_with_frame_id(most_central_element.id_in_frame)

    tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

    for element in mesh_one.elements:
        element.global_id = None

    for element in mesh_two.elements:
        element.global_id = None

    tracked_ids_all = tracking.track(mesh_one, mesh_two)

    plotname = 'cell_death'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all,
                         plotname, figuresize)
def make_general_division_plot(figuresize):
    """We load a mesh where two maximum common subgraphs will be identified, and track the division event"""

    mesh_one = mesh.creation.generate_random_tesselation(9,9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    # pick the element closest to the centre
    most_central_element = mesh_two.find_most_central_element()
            
    mesh_two.divide_element_with_frame_id_in_direction(most_central_element.id_in_frame, [1.0, 1.0])
     
    tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )
    
    for element in mesh_one.elements:
        element.global_id = None
  
    for element in mesh_two.elements:
        element.global_id = None
 
    tracked_ids_all = tracking.track(mesh_one, mesh_two)        

    plotname = 'division_general'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all, plotname, figuresize)
def make_death_plots(figuresize):
    mesh_one = mesh.creation.generate_random_tesselation(9,9)
    mesh_two = copy.deepcopy(mesh_one)

    # First pick a cell in the centre
    mesh_centre = mesh_two.calculate_centre()
        
    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    most_central_element = mesh_two.find_most_central_element()
               
    mesh_two.kill_element_with_frame_id(most_central_element.id_in_frame)

    tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )

    for element in mesh_one.elements:
        element.global_id = None
  
    for element in mesh_two.elements:
        element.global_id = None
  
    tracked_ids_all = tracking.track( mesh_one, mesh_two )
    
    plotname = 'cell_death'
    
    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all, plotname, figuresize)
    def test_maximum_common_subgraph_for_t1_swap(self):
        """generate a random mesh, copy it, perform a t1 swap on it, and track it.
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(8,8)
         
        mesh_two = copy.deepcopy(mesh_one)
 
        mesh_one.save(path.join(dirname(__file__),'output','subgraph_t1_mesh_one.mesh'))
        mesh_one.save(path.join(dirname(__file__),'output','subgraph_t1_mesh_two.mesh'))

#         mesh_one = mesh.load('mesh_t1_special_one.mesh')
#         mesh_two = mesh.load('mesh_t1_special_two.mesh')

        # Perform T1 swap on mesh two 
        # First pick a node in the centre
        mesh_centre = mesh_two.calculate_centre()
        
        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # pick the node closest to the centre
        min_distance = 3*mesh_two.calculate_height()

        for node in mesh_two.nodes:
            distance = np.linalg.norm(node.position - mesh_centre)
            if distance < min_distance:
               min_distance = distance
               most_central_node = node 
               
        for local_index, element_node in enumerate(most_central_node.adjacent_elements[0].nodes):
            if element_node.id == most_central_node.id:
                num_nodes_this_element = most_central_node.adjacent_elements[0].get_num_nodes()
                one_edge_node = most_central_node.adjacent_elements[0].nodes[(local_index+1)%num_nodes_this_element]
                break
        
        mesh_two.perform_t1_swap( most_central_node.id, one_edge_node.id )
         
        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)
 
        mesh_one.plot(path.join(dirname(__file__),'output','mesh_before_t1_swap.pdf'), color_by_global_id = True, 
                      total_number_of_global_ids = len( tracked_ids ) )
        mesh_two.plot(path.join(dirname(__file__),'output','mesh_after_t1_swap.pdf'), color_by_global_id = True, 
                      total_number_of_global_ids = len(tracked_ids) )
         
        for global_id in tracked_ids:
            element_one = mesh_one.get_element_with_global_id(global_id)
            element_two = mesh_two.get_element_with_global_id(global_id)
            self.assertEqual(element_one.get_num_nodes(), element_two.get_num_nodes())
            self.assertAlmostEqual(element_one.calculate_area(), element_two.calculate_area())

        plt.close('all')
def make_t1_plots(figuresize):

    mesh_one = mesh.creation.generate_random_tesselation(9, 9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[
            element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    # Perform T1 swap on mesh two
    # First pick a node in the centre
    mesh_centre = mesh_two.calculate_centre()

    # pick the node closest to the centre
    min_distance = 3 * mesh_two.calculate_height()
    for node in mesh_two.nodes:
        distance = np.linalg.norm(node.position - mesh_centre)
        if distance < min_distance:
            min_distance = distance
            most_central_node = node

    # pick a node that shares an edge with this central node
    for local_index, element_node in enumerate(
            most_central_node.adjacent_elements[0].nodes):
        if element_node.id == most_central_node.id:
            num_nodes_this_element = most_central_node.adjacent_elements[
                0].get_num_nodes()
            one_edge_node = most_central_node.adjacent_elements[0].nodes[
                (local_index + 1) % num_nodes_this_element]
            break

    mesh_two.perform_t1_swap(most_central_node.id, one_edge_node.id)

    tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

    for element in mesh_one.elements:
        element.global_id = None

    for element in mesh_two.elements:
        element.global_id = None

    tracked_ids_all = tracking.track(mesh_one, mesh_two)

    plotname = 't1_swap'

    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all,
                         plotname, figuresize)
Example #10
0
def make_t1_plots(figuresize):

    mesh_one = mesh.creation.generate_random_tesselation(9,9)
    mesh_two = copy.deepcopy(mesh_one)

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    # build ground truth for testing the mapping
    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        ground_truth[element.id_in_frame] = mesh_two.elements[element_index].id_in_frame

    # Perform T1 swap on mesh two 
    # First pick a node in the centre
    mesh_centre = mesh_two.calculate_centre()

    # pick the node closest to the centre
    min_distance = 3*mesh_two.calculate_height()
    for node in mesh_two.nodes:
        distance = np.linalg.norm(node.position - mesh_centre)
        if distance < min_distance:
           min_distance = distance
           most_central_node = node 
               
    # pick a node that shares an edge with this central node
    for local_index, element_node in enumerate(most_central_node.adjacent_elements[0].nodes):
        if element_node.id == most_central_node.id:
            num_nodes_this_element = most_central_node.adjacent_elements[0].get_num_nodes()
            one_edge_node = most_central_node.adjacent_elements[0].nodes[(local_index+1)%num_nodes_this_element]
            break
        
    mesh_two.perform_t1_swap( most_central_node.id, one_edge_node.id )
         
    tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )

    for element in mesh_one.elements:
        element.global_id = None
  
    for element in mesh_two.elements:
        element.global_id = None
  
    tracked_ids_all = tracking.track( mesh_one, mesh_two )
    
    plotname = 't1_swap'
    
    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all, plotname, figuresize)
Example #11
0
    def test_maximum_common_subgraph_for_cell_death(self):
        """generate a random mesh, copy it, perform a death event, and track it.
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(9, 9)
        mesh_one.save(
            path.join(dirname(__file__), 'output',
                      'subgraph_death_mesh_one.mesh'))
        mesh_two = copy.deepcopy(mesh_one)
        mesh_one.save(
            path.join(dirname(__file__), 'output',
                      'subgraph_death_mesh_two.mesh'))
        #         mesh_one = mesh.load('special_death_mesh_one.mesh')
        #         mesh_two = mesh.load('special_death_mesh_two.mesh')

        # First pick a cell in the centre
        mesh_centre = mesh_two.calculate_centre()

        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # pick the element closest to the centre

        most_central_element = mesh_two.find_most_central_element()

        mesh_two.kill_element_with_frame_id(most_central_element.id_in_frame)

        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

        mesh_one.plot(path.join(dirname(__file__), 'output',
                                'mesh_before_death.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))
        mesh_two.plot(path.join(dirname(__file__), 'output',
                                'mesh_after_death.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))

        for global_id in tracked_ids:
            element_one = mesh_one.get_element_with_global_id(global_id)
            element_two = mesh_two.get_element_with_global_id(global_id)
            self.assertEqual(element_one.get_num_nodes(),
                             element_two.get_num_nodes())
            self.assertAlmostEqual(element_one.calculate_area(),
                                   element_two.calculate_area())
    def test_maximum_common_subgraph_for_division(self):
        """generate a random mesh, copy it, perform a division event, and track it.
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(7, 7)

        mesh_two = copy.deepcopy(mesh_one)
        #         mesh_one = mesh.load('standard_ambiguous_division_one.mesh')
        #         mesh_two = mesh.load('standard_ambiguous_division_two.mesh')

        # Perform T1 swap on mesh two
        # First pick a cell in the centre
        mesh_centre = mesh_two.calculate_centre()

        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # pick the_central_element = element
        most_central_element = mesh_two.find_most_central_element()

        mesh_two.divide_element_with_frame_id(most_central_element.id_in_frame)

        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

        mesh_one.plot(path.join(dirname(__file__), 'output',
                                'mesh_before_division.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))
        mesh_two.plot(path.join(dirname(__file__), 'output',
                                'mesh_after_division.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))

        network_one = mesh_one.generate_network()
        network_two = mesh_two.generate_network()

        for global_id in tracked_ids:
            element_one = mesh_one.get_element_with_global_id(global_id)
            element_two = mesh_two.get_element_with_global_id(global_id)
            self.assertEqual(element_one.get_num_nodes(),
                             element_two.get_num_nodes())
            self.assertAlmostEqual(element_one.calculate_area(),
                                   element_two.calculate_area())

        plt.close('all')
def make_translation_plots(figuresize):
    sys.setrecursionlimit(40000)

    large_mesh = mesh.creation.generate_random_tesselation(15, 8)

    large_mesh.assign_frame_ids_in_order()

    mesh_one = large_mesh.copy_region_of_interest((3, 10), (-1, 9))

    mesh_two = large_mesh.copy_region_of_interest((5, 12), (-1, 9))

    ground_truth_indices = {}
    for element_index, element in enumerate(mesh_one.elements):
        if element.id_in_frame in mesh_two.frame_id_dictionary:
            ground_truth_indices[element_index] = mesh_two.frame_id_dictionary[
                element.id_in_frame]

    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        if element_index in ground_truth_indices:
            ground_truth[element.id_in_frame] = mesh_two.elements[
                ground_truth_indices[element_index]]

    tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

    for element in mesh_one.elements:
        element.global_id = None

    for element in mesh_two.elements:
        element.global_id = None

    mesh_one.index_global_ids()
    mesh_two.index_global_ids()

    tracked_ids_all = []
    tracked_ids_all = tracking.track(mesh_one, mesh_two)

    plotname = 'translation'
    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all,
                         plotname, figuresize)
Example #14
0
def make_translation_plots(figuresize):
    sys.setrecursionlimit(40000)

    large_mesh = mesh.creation.generate_random_tesselation(15,8)
    
    large_mesh.assign_frame_ids_in_order()

    mesh_one = large_mesh.copy_region_of_interest((3,10),(-1,9))
    
    mesh_two = large_mesh.copy_region_of_interest((5,12),(-1,9))
    
    ground_truth_indices = {}
    for element_index, element in enumerate(mesh_one.elements):
        if element.id_in_frame in mesh_two.frame_id_dictionary:
            ground_truth_indices[element_index] = mesh_two.frame_id_dictionary[element.id_in_frame]
            
    mesh_one.assign_frame_ids_in_order()
    mesh_two.assign_frame_ids_randomly()

    ground_truth = {}
    for element_index, element in enumerate(mesh_one.elements):
        if element_index in ground_truth_indices:
            ground_truth[element.id_in_frame] = mesh_two.elements[ground_truth_indices[element_index]]
    
    tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )
     
    for element in mesh_one.elements:
        element.global_id = None
   
    for element in mesh_two.elements:
        element.global_id = None
   
    mesh_one.index_global_ids()
    mesh_two.index_global_ids()

    tracked_ids_all = []
    tracked_ids_all = tracking.track( mesh_one, mesh_two )
    
    plotname = 'translation'
    make_difference_plot(mesh_one, mesh_two, tracked_ids, tracked_ids_all, plotname, figuresize)
Example #15
0
    def test_plot_all_global_ids_same_color(self):
        """plot all global ids same color
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(8, 8)

        mesh_two = copy.deepcopy(mesh_one)

        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # Perform T1 swap on mesh two
        # First pick a node in the centre
        mesh_centre = mesh_two.calculate_centre()

        # pick the node closest to the centre
        most_central_node = mesh_two.find_most_central_node()

        # pick a node that shares an edge with this central node
        for local_index, element_node in enumerate(
                most_central_node.adjacent_elements[0].nodes):
            if element_node.id == most_central_node.id:
                num_nodes_this_element = most_central_node.adjacent_elements[
                    0].get_num_nodes()
                one_edge_node = most_central_node.adjacent_elements[0].nodes[
                    (local_index + 1) % num_nodes_this_element]
                break

        mesh_two.perform_t1_swap(most_central_node.id, one_edge_node.id)

        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)

        mesh_two.plot(path.join(dirname(__file__), 'output',
                                'visualisation_in_green.pdf'),
                      color_by_global_id='g',
                      total_number_of_global_ids=mesh_one.get_num_elements())
    def test_maximum_common_subgraph_for_cell_death(self):
        """generate a random mesh, copy it, perform a death event, and track it.
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.creation.generate_random_tesselation(9,9)
        mesh_one.save(path.join(dirname(__file__),'output','subgraph_death_mesh_one.mesh'))
        mesh_two = copy.deepcopy(mesh_one)
        mesh_one.save(path.join(dirname(__file__),'output','subgraph_death_mesh_two.mesh'))
#         mesh_one = mesh.load('special_death_mesh_one.mesh')
#         mesh_two = mesh.load('special_death_mesh_two.mesh')

        # First pick a cell in the centre
        mesh_centre = mesh_two.calculate_centre()
        
        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_randomly()

        # pick the element closest to the centre
        
        most_central_element = mesh_two.find_most_central_element()
               
        mesh_two.kill_element_with_frame_id(most_central_element.id_in_frame)

        tracked_ids = tracking.find_maximum_common_subgraph( mesh_one, mesh_two )
 
        mesh_one.plot(path.join(dirname(__file__),'output','mesh_before_death.pdf'), color_by_global_id = True, 
                      total_number_of_global_ids = len( tracked_ids ) )
        mesh_two.plot(path.join(dirname(__file__),'output','mesh_after_death.pdf'), color_by_global_id = True, 
                      total_number_of_global_ids = len( tracked_ids ) )
         
        for global_id in tracked_ids:
            element_one = mesh_one.get_element_with_global_id(global_id)
            element_two = mesh_two.get_element_with_global_id(global_id)
            self.assertEqual(element_one.get_num_nodes(), element_two.get_num_nodes())
            self.assertAlmostEqual(element_one.calculate_area(), element_two.calculate_area())
    def test_track_special_division_seven(self):
        """read a special mesh, perform a division event, and track it.
           This mesh is too small to find an initial mapping.
        """
        sys.setrecursionlimit(40000)

        mesh_one = mesh.load(
            path.join(dirname(__file__), 'data',
                      'division_special_mesh_eight.mesh'))
        mesh_two = copy.deepcopy(mesh_one)

        mesh_one.assign_frame_ids_in_order()
        mesh_two.assign_frame_ids_in_reverse_order()

        # build ground truth for testing the mapping
        ground_truth = {}
        for element_index, element in enumerate(mesh_one.elements):
            ground_truth[element.id_in_frame] = mesh_two.elements[
                element_index].id_in_frame

        # pick the element closest to the centre
        most_central_element = mesh_two.find_most_central_element()

        file_to_read = open(
            path.join(dirname(__file__), 'data',
                      'division_special_direction_eight.pickle'), 'r')
        division_direction = pickle.load(file_to_read)
        file_to_read.close()

        mesh_two.divide_element_with_frame_id_in_direction(
            most_central_element.id_in_frame, division_direction)

        #         mesh_one.plot(path.join(dirname(__file__),'output','tracked_special_mesh_seven_before_division.pdf') )
        #         mesh_two.plot(path.join(dirname(__file__),'output','tracked_special_mesh_seven_after_division.pdf'))
        #         tracked_ids = tracking.track( mesh_one, mesh_two )
        tracked_ids = tracking.find_maximum_common_subgraph(mesh_one, mesh_two)
        #         subgraph_finder = tracking.ReducedBacktrackingSubgraphFinder(mesh_one, mesh_two)
        #         subgraph_finder.find_maximum_common_subgraph()
        #         largest_mappings = subgraph_finder.largest_mappings
        #
        #         for mapping_index, large_mapping in enumerate(largest_mappings):
        #
        #             tracked_ids = []
        #
        #             for element_one in mesh_one.elements:
        #                 element_one.global_id = None
        #
        #             for element_two in mesh_two.elements:
        #                 element_two.global_id = None
        #
        #             for global_id, frame_one_id in enumerate(large_mapping):
        #                 mesh_one.get_element_with_frame_id(frame_one_id).global_id = global_id
        #                 mesh_two.get_element_with_frame_id(large_mapping[frame_one_id]).global_id = global_id
        #                 tracked_ids.append(global_id)
        #
        #             mesh_one.index_global_ids()
        #             mesh_two.index_global_ids()
        #
        #             mesh_one.plot('debug_mesh_special_before_division_' + str(mapping_index) + '.pdf', color_by_global_id = True,
        #                           total_number_of_global_ids = len( tracked_ids ) )
        #             mesh_two.plot('debug_mesh_special_after_division_' + str(mapping_index) + '.pdf', color_by_global_id = True,
        #                           total_number_of_global_ids = len( tracked_ids ) )
        #
        mesh_one.plot(path.join(
            dirname(__file__), 'output',
            'tracked_special_mesh_seven_before_division.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))
        mesh_two.plot(path.join(
            dirname(__file__), 'output',
            'tracked_special_mesh_seven_after_division.pdf'),
                      color_by_global_id=True,
                      total_number_of_global_ids=len(tracked_ids))

        # make sure that the entire mesh was tracked (except for the dead cell)
        self.assertEqual(len(tracked_ids), mesh_one.get_num_elements() - 1)

        for global_id in tracked_ids:
            # and that the mapping coincides with the ground truth for all tracked ids
            element_one = mesh_one.get_element_with_global_id(global_id)
            element_two = mesh_two.get_element_with_global_id(global_id)
            self.assertEqual(ground_truth[element_one.id_in_frame],
                             element_two.id_in_frame)
#
        plt.close('all')