def test_walk_through_graph_shortest_path():
    """Test the routine to go through the graph using shortest path."""

    # Load the data with only a single serie
    currdir = os.path.dirname(os.path.abspath(__file__))
    path_data = os.path.join(currdir, 'data', 'dce')
    # Create an object to handle the data
    dce_mod = DCEModality()

    # Read the data
    dce_mod.read_data_from_path(path_data)

    # Load the GT data
    path_gt = [os.path.join(currdir, 'data', 'gt_folders', 'prostate')]
    label_gt = ['prostate']
    gt_mod = GTModality()
    gt_mod.read_data_from_path(label_gt, path_gt)

    # Build a heatmap from the dce data
    # Reduce the number of bins to enforce low memory consumption
    nb_bins = [10] * dce_mod.n_serie_
    heatmap, bins_heatmap = dce_mod.build_heatmap(gt_mod.extract_gt_data(
        label_gt[0]), nb_bins=nb_bins)

    # Build the graph by taking the inverse exponential of the heatmap
    heatmap_inv_exp = np.exp(img_as_float(1. - (heatmap / np.max(heatmap))))
    graph = StandardTimeNormalization._build_graph(heatmap_inv_exp, .99)

    start_end_tuple = ((0, 6), (3, 6))

    # Call the algorithm to walk through the graph
    path = StandardTimeNormalization._walk_through_graph(graph,
                                                         heatmap_inv_exp,
                                                         start_end_tuple,
                                                         'shortest-path')

    gt_path = np.array([[0, 6], [1, 6], [2, 6], [3, 6]])
    assert_array_equal(path, gt_path)