def setUp(self):
     self.ref_pop = Population([load_pt_neuron(f, mt.set_tree_type) for f in NRN_PATHS])
     self.fst_pop = Population([nm.load_neuron(f) for f in NRN_PATHS])
     self.ref_types = [t.type for t in self.ref_pop.neurites]
 def setUp(self):
     self.ref_nrn = load_pt_neuron(os.path.join(SWC_DATA_PATH, SWC_MORPH_FILENAME),
                                mt.set_tree_type)
     self.sec_nrn = nm.load_neuron(os.path.join(SWC_DATA_PATH, SWC_MORPH_FILENAME))
     self.sec_nrn_trees = [n.root_node for n in self.sec_nrn.neurites]
     self.ref_types = [n.type for n in self.ref_nrn.neurites]
Beispiel #3
0
import os
import numpy as np
from nose import tools as nt
from neurom.view import _compat
from neurom.view._dendrogram import Dendrogram
from neurom.point_neurite.io.utils import load_neuron as load_pt_neuron
from neurom.point_neurite.dendrogram import Dendrogram as PointDendrogram
from neurom.core.types import NeuriteType
from neurom import load_neuron
from neurom.morphmath import segment_radius as segrad


_PWD = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.join(_PWD, '../../../test_data/h5/v1/Neuron.h5')

NRN0 = load_pt_neuron(DATA_PATH)
NRN1 = load_neuron(DATA_PATH)


def _close(a, b, debug=False):
    if debug:
        print '\na.shape: %s\nb.shape: %s\n' % (a.shape, b.shape)
        print '\na: %s\nb:%s\n' % (a, b)
        print '\na - b:%s\n' % (a - b)
    nt.assert_equal(len(a), len(b))
    nt.assert_true(np.allclose(a, b))


def _equal(a, b, debug=False):
    if debug:
        print '\na.shape: %s\nb.shape: %s\n' % (a.shape, b.shape)
from neurom.core.tree import i_chain2
from neurom.point_neurite.io.utils import load_neuron as load_pt_neuron
from neurom.point_neurite.features import get
from neurom.point_neurite import treefunc as mt



_PWD = os.path.dirname(os.path.abspath(__file__))
SWC_DATA_PATH = os.path.join(_PWD, '../../../test_data/swc')
H5V1_DATA_PATH = os.path.join(_PWD, '../../../test_data/h5/v1')
H5V2_DATA_PATH = os.path.join(_PWD, '../../../test_data/h5/v2')
MORPH_FILENAME = 'Neuron.h5'
SWC_MORPH_FILENAME = 'Neuron.swc'

# Arbitrarily use h5 v1 as reference always
REF_NRN = load_pt_neuron(os.path.join(H5V1_DATA_PATH, MORPH_FILENAME),
                         mt.set_tree_type)

REF_NEURITE_TYPES = [NeuriteType.apical_dendrite, NeuriteType.basal_dendrite,
                     NeuriteType.basal_dendrite, NeuriteType.axon]

def _close(a, b, debug=False):
    if debug:
        print 'a: %s\nb:%s\n' % (a, b)
    nt.assert_equal(len(a), len(b))
    nt.assert_true(np.allclose(a, b))


def _equal(a, b, debug=False):
    if debug:
        print 'a: %s\nb:%s\n' % (a, b)
    nt.assert_equal(len(a), len(b))
Beispiel #5
0
from neurom import viewer
from neurom.point_neurite.io.utils import load_neuron as load_pt_neuron
import os
from matplotlib import pyplot as plt


class Dummy(object):
    pass


_PWD = os.path.dirname(os.path.abspath(__file__))
DATA_PATH = os.path.join(_PWD, '../../test_data/swc')
MORPH_FILENAME = os.path.join(DATA_PATH, 'Neuron.swc')

nrn = load_neuron(MORPH_FILENAME)
pt_nrn = load_pt_neuron(MORPH_FILENAME)


def test_draw_neuron():
    viewer.draw(pt_nrn)
    viewer.draw(nrn)
    plt.close('all')


def test_draw_neuron3d():
    viewer.draw(pt_nrn, mode='3d')
    viewer.draw(nrn, mode='3d')
    plt.close('all')


def test_draw_tree():