Ejemplo n.º 1
0
def segmentation_for_img(raw_xy, predictions_xyc, multicut_workflow):
    """

    Parameters
    ----------
    raw_xy : vigra.VigraArray
    predictions_xyc : vigra.VigraArray
    multicut_workflow

    Returns
    -------

    """
    assert are_same_xy(raw_xy, predictions_xyc)

    # move these into setup_multicut?
    #####
    opEdgeTrainingWithMulticut = multicut_workflow.edgeTrainingWithMulticutApplet.topLevelOperator
    assert isinstance(opEdgeTrainingWithMulticut, OpEdgeTrainingWithMulticut)

    opDataExport = multicut_workflow.dataExportApplet.topLevelOperator
    opDataExport.OutputAxisOrder.setValue('xy')
    #####

    role_data_dict = OrderedDict([
        ("Raw Data", [DatasetInfo(preloaded_array=raw_xy)]),
        ("Probabilities", [DatasetInfo(preloaded_array=predictions_xyc)])
    ])
    batch_results = multicut_workflow.batchProcessingApplet.run_export(
        role_data_dict, export_to_array=True)

    assert len(batch_results) == 1
    segmentation_xy = vigra.taggedView(batch_results[0], axistags='xy')
    assert are_same_xy(segmentation_xy, raw_xy, predictions_xyc)
    return segmentation_xy
Ejemplo n.º 2
0
def test_assert_same_xy_add_dim(vigra_arrs):
    vigra_arrs += [
        vigra.taggedView(np.random.random((5, 5, 3)), axistags='xyc'),
        vigra.taggedView(np.random.random((5, 5, 5)), axistags='xyz'),
    ]
    assert are_same_xy(*vigra_arrs)
Ejemplo n.º 3
0
def test_assert_same_xy_different_axistags(vigra_arrs):
    vigra_arrs += [vigra.taggedView(np.random.random((5, 6)), axistags='yx')]
    assert not are_same_xy(*vigra_arrs)
Ejemplo n.º 4
0
def test_assert_same_xy_same(vigra_arrs):
    assert are_same_xy(*vigra_arrs)