def isbi12_multicut(ds_train_str, ds_test_str,
        seg_id_train, seg_id_test,
        local_feats_list, mc_params):

    meta.load()
    ds_train = meta.get_dataset(ds_train_str)
    ds_test = meta.get_dataset(ds_test_str)

    mc_node, mc_edges, mc_energy, t_inf = multicut_workflow(
            ds_train, ds_test,
            seg_id_train, seg_id_test,
            local_feats_list, mc_params)

    if ds_test_str == "isbi2012_train":
        return eval_lazy(mc_edges, ds_test._rag(seg_id_test) )

    else:
        assert ds_test_str == "isbi2012_test"
        res_folder = "/home/consti/Work/nature_experiments/results/isbi12"
        mc_seg = ds_test.project_mc_result( seg_id_test, mc_node )

        # save segmentation result
        seg_name = "_".join( ["mcresult", str(seg_id_test), "seg"] ) + ".h5"
        seg_path = os.path.join(res_folder, seg_name)
        vigra.writeHDF5(mc_seg, seg_path, "data")

        # save binary edges
        edge_name = "_".join( ["mcresult", str(seg_id_test), "edges"] ) + ".tif"
        edge_path = os.path.join(res_folder, edge_name)
        edge_vol = edges_to_binary(ds_test._rag(seg_id_test), mc_edges)
        vigra.impex.writeVolume(edge_vol, edge_path, '', dtype = np.uint8 )
        return 0, 0
Example #2
0
def snemi3d_mc(ds_train_str, ds_test_str, seg_id_train, seg_id_test,
               local_feats_list, mc_params):

    meta.load()

    ds_train = meta.get_dataset(ds_train_str)
    ds_test = meta.get_dataset(ds_test_str)

    mc_node, mc_edges, mc_energy, t_inf = multicut_workflow(
        ds_train, ds_test, seg_id_train, seg_id_test, local_feats_list,
        mc_params)

    mc_seg = ds_test.project_mc_result(seg_id_test, mc_node)

    print mc_energy, t_inf

    return mc_seg
def neuroproof_mc(ds_train_str, ds_test_str,
        seg_id_train, seg_id_test,
        local_feats_list, mc_params):

    meta.load()

    ds_train = meta.get_dataset(ds_train_str)
    ds_test = meta.get_dataset(ds_test_str)

    mc_node, mc_edges, mc_energy, t_inf = multicut_workflow(
            ds_train, ds_test,
            seg_id_train, seg_id_test,
            local_feats_list, mc_params)

    print np.unique(mc_node).shape

    mc_seg = ds_test.project_mc_result(seg_id_test, mc_node)

    return mc_seg
def run_and_eval_mc(sample):

    # Experiment settings
    exp_params = ExperimentSettings()
    exp_params.set_ntrees(300)
    exp_params.set_anisotropy(25.)
    exp_params.set_weighting_scheme("z")
    exp_params.set_solver("multicut_fusionmoves")

    local_feats_list  = ("prob", "reg")
    sample.make_filters(1, 25.)

    mc_node, mc_edges, mc_energy, t_inf = multicut_workflow(
        sample.get_cutout(0), sample.get_cutout(1),
        0,0,
        local_feats_list, exp_params)

    mc_seg = sample.get_cutout(1).project_mc_result(0, mc_node)
    print "MCSEG"