Image of rat pyramidal cell layer 2/3 for comapeing to the NETMORPH


In [1]:
import numpy as np
import McNeuron
import matplotlib.pyplot as plt
from copy import deepcopy
%matplotlib inline
#np.random.seed(0)
L_neuron = McNeuron.visualize.get_all_path("/Volumes/Arch/Projects/Computational Anatomy/pyramidal/de koninck/")
#L_neuron = McNeuron.visualize.get_all_path("/Volumes/Arch/Projects/Computational Anatomy/badea, ganglia cell, retina mouse/")

In [90]:
i = 45
n = McNeuron.Neuron(file_format = 'swc', input_file=L_neuron[i])
#inter2 = Inter2.subsample_given_n_node(400)
McNeuron.visualize.plot_2D(n, dpi = 120, size = 5, show_width= False,  background = .01,line_width=2)



In [91]:
McNeuron.visualize.plot_dedrite_tree(n)



In [54]:
#n.show_features()

In [ ]:
McNeuron.visualize.plot_2D(n.subsample_given_n_node(100),size = 5)

In [ ]:
L_neuron = McNeuron.visualize.get_all_path("/Volumes/Arch/Projects/Computational Anatomy/pyramidal/de koninck/")
B = np.zeros(len(L_neuron))
for i in range(len(L_neuron)):
    n = McNeuron.Neuron(file_format = 'swc', input_file=L_neuron[i])
    B[i] = sum(n.branch_order[1:]==2)
    print i

In [92]:
B = McNeuron.visualize.important_node_full_matrix(n)
I = np.sort(B.sum(axis=1))
(F,G) = np.unique(I, return_counts=True)
plt.plot(G)


Out[92]:
[<matplotlib.lines.Line2D at 0x10b8b2dd0>]

In [93]:
plt.imshow(B)


Out[93]:
<matplotlib.image.AxesImage at 0x10da64310>

In [94]:
from numpy.linalg import inv
P = np.eye(B.shape[0]) - inv(B)
plt.imshow(P)


Out[94]:
<matplotlib.image.AxesImage at 0x1092f2150>

In [96]:
P.sum(axis=0)


Out[96]:
array([ 2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,  2.,
        2.,  2.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,
        0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])

In [100]:
(ends,) = np.where(P.sum(axis=0)==2)
I = B[np.ix_(ends,ends)].sum(axis=1)
(F,G) = np.unique(I, return_counts=True)
plt.plot(G)


Out[100]:
[<matplotlib.lines.Line2D at 0x10d86d050>]

In [66]:
B[np.ix_(ends,ends)]


Out[66]:
array([[ 1.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  1.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  1., ...,  0.,  0.,  0.],
       ..., 
       [ 0.,  0.,  0., ...,  1.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  1.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  1.]])

In [ ]: