예제 #1
0
def test_legacy():
    points, sign = test_module.internal_cut_detection(SIMPLE, 'y')
    assert_array_equal(points,
                       [[ 6., -4., 0.],
                        [-5., -4., 0.]])
    assert_equal(sign, -1)

    assert_raises(Exception, test_module.cut_detect, SIMPLE, 'z')
예제 #2
0
def test_legacy_compare_with_legacy_result():
    '''Comparing results with the old repair launch with the following commands:

    repair --dounravel 0 --inputdir /gpfs/bbp.cscs.ch/project/proj83/home/bcoste/release/out-new/01_ConvertMorphologies --input rp120430_P-2_idA --overlap=true --incremental=false --restrict=true --distmethod=mirror

    The arguments are the one used in the legacy morphology workflow.
    '''
    neuron = load_neuron(DATA_PATH / 'compare-bbpsdk/rp120430_P-2_idA.h5')
    points, sign = test_module.internal_cut_detection(neuron, 'z')
    assert_equal(sign, 1)
    cut_sections = {point_to_section_segment(neuron, point)[0]
                    for point in points}

    legacy_cut_sections = {13,14,17,18,38,39,40,45,58,67,68,69,73,75,76,93,94,101,102,103,105,106,109,110,111,120,124,125,148,149,150,156,157,158,162,163,164,166,167,168,169,192,201,202,203,205,206,208}
    assert_equal(cut_sections, legacy_cut_sections)
예제 #3
0
파일: detection.py 프로젝트: markovg/NeuroR
    def find_legacy(cls, neuron, axis):
        '''Find the cut points according to the legacy algorithm

        As implemented in:
        https://bbpcode.epfl.ch/source/xref/platform/BlueRepairSDK/BlueRepairSDK/src/repair.cpp#263
        '''
        if not isinstance(neuron, Neuron):
            neuron = load_neuron(neuron)

        cut_leaves, side = internal_cut_detection(neuron, axis)

        plane = cls([int(axis.upper() == 'X'), int(axis.upper() == 'Y'),
                     int(axis.upper() == 'Z'), 0],
                    upward=(side < 0),
                    morphology=None,
                    bin_width=0)
        plane.morphology = load_neuron(neuron)
        plane.cut_leaves_coordinates = cut_leaves
        return plane