Ejemplo n.º 1
0
    def test_upload_skeletontreeneuron(self):
        """Check if skeleton upload works in a tree neuron."""
        # load some example neurons..
        swc_path = os.path.join(BASE_DIR, 'data/swc')
        # print('swc_path: ', swc_path)
        swc_files = glob.glob(os.path.join(swc_path, '*.swc'))
        # print('swc_file: ', swc_files)

        neuronlist = []
        neuronlist += [
            navis.read_swc(f,
                           units='8 nm',
                           connector_labels={
                               'presynapse': 7,
                               'postsynapse': 8
                           },
                           id=int(os.path.splitext(os.path.basename(f))[0]))
            for f in swc_files
        ]

        neuronlist = navis.core.NeuronList(neuronlist)
        treeneuron = neuronlist[0]

        layer_serverdir, layer_host = get_ngserver()

        skelsource, skelseglist, skelsegnamelist = to_ngskeletons(treeneuron)
        uploadskeletons(skelsource, skelseglist, skelsegnamelist,
                        layer_serverdir)

        skeleton_path = os.path.join(layer_serverdir, 'precomputed/skeletons/',
                                     str(treeneuron.id))

        status = os.path.isfile(skeleton_path)

        assert status
Ejemplo n.º 2
0
    def test_upload_skeletonexception(self):
        """Check if exception occurs."""
        neuronlist = (1, 2, 3)

        layer_serverdir, layer_host = get_ngserver()

        with pytest.raises(Exception):
            skelsource, skelseglist, skelsegnamelist = to_ngskeletons(
                neuronlist)
Ejemplo n.º 3
0
    def test_upload_skeletoncatmaidneuron(self):
        """Check if skeleton upload works in a catmaid neuron."""
        # load some example neurons..
        swc_path = os.path.join(BASE_DIR, 'data/swc')
        # print('swc_path: ', swc_path)
        swc_files = glob.glob(os.path.join(swc_path, '*.swc'))
        # print('swc_file: ', swc_files)

        neuronlist = []
        neuronlist += [
            navis.read_swc(f,
                           units='8 nm',
                           connector_labels={
                               'presynapse': 7,
                               'postsynapse': 8
                           },
                           id=int(os.path.splitext(os.path.basename(f))[0]))
            for f in swc_files
        ]

        catmaidneuron = pymaid.core.CatmaidNeuron(neuronlist[0])
        catmaidneuron.soma = None  # set this so you don't have to fetch from remote instance

        layer_serverdir, layer_host = get_ngserver()

        skelsource, skelseglist, skelsegnamelist = to_ngskeletons(
            catmaidneuron)
        uploadskeletons(skelsource, skelseglist, skelsegnamelist,
                        layer_serverdir)

        skeleton_path = os.path.join(layer_serverdir, 'precomputed/skeletons/',
                                     str(catmaidneuron.id))

        status = os.path.isfile(skeleton_path)

        assert status