# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with DeNSE. If not, see <http://www.gnu.org/licenses/>. import btmorph2 import numpy import matplotlib.pyplot as plt from matplotlib.pyplot import ion ion() #Import morphology from swc file neuron1 = btmorph2.NeuronMorphology("lateral/retina1.swc") # """ get the total length, a scalar morphometric feature """ total_length = neuron1.total_length() print('Total neurite length=%f', total_length) # """ get the topological measure of leaf node in the tree""" no_terminals = neuron1.no_terminals() print('Number of terminals=%f', no_terminals) bif_nodes = neuron1._bif_points term_nodes = neuron1._end_points all_nodes = bif_nodes + term_nodes total_length = 0 all_segment_lengths = [] for node in all_nodes:
print(swc_file) # ds.reset_kernel() return swc_file if __name__ == '__main__': kernel = { "seeds": [33, 345, 17, 193, 177], "num_local_threads": 5, "environment_required": False } swc_file = run_dense(neuron_params) import btmorph2 import matplotlib.pyplot as plt neuron1 = btmorph2.NeuronMorphology( os.path.join(swc_file, "morphology.swc")) total_length = neuron1.total_length() print('Total neurite length=%f', total_length) no_terminals = neuron1.no_terminals() # plt.figure() # neuron1.plot_dendrogram() # plt.savefig("dendrogram_low.pdf", format="pdf", dpi=300) # plt.show() # plt.figure() neuron1.plot_2D() plt.savefig("neuron2.pdf", format="pdf", dpi=300) plt.show(block=True)
# (at your option) any later version. # # DeNSE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with DeNSE. If not, see <http://www.gnu.org/licenses/>. import btmorph2 import numpy import sys import matplotlib.pyplot as plt neuron1 = btmorph2.NeuronMorphology(sys.argv[1]) """ get the total length, a scalar morphometric feature """ total_length = neuron1.total_length() print('Total neurite length=%f' % total_length) """ get the topological measure of leaf node in the tree""" no_terminals = neuron1.no_terminals() print('Number of terminals=%f' % no_terminals) bif_nodes = neuron1._bif_points term_nodes = neuron1._end_points all_nodes = bif_nodes + term_nodes total_length = 0 all_segment_lengths = [] for node in all_nodes: all_segment_lengths.append(neuron1.get_segment_pathlength(node)) total_length = total_length + all_segment_lengths[-1] print('total_length=', total_length)