def check_tree(self): if not self.morph.is_dummy_section_set(): return dummy_section = self.morph.get_dummy_section() self.check_dummy_section(dummy_section) # Check nothing changed in the tree: morphmd5 = _get_md5_of_morphology(self.morph) if self.morphmd5cache: if morphmd5 != self.morphmd5cache: raise Exception('MD5 of tree has changed!') else: return self.morphmd5cache = morphmd5 # Check the tree is sensible: self.check_section(self.morph._dummysection, self.morph, dummysection=True, recurse=True) # Check that there are not duplications of idTags in the tree: idtags = SeqUtils.flatten([section.idtag for section in self.morph if section.idtag]) #print idtags assert len(idtags) == len(list(set(idtags))) # Check the regions for rgn in self.morph.get_regions(): self.check_region(rgn, self.morph)
def _showSimple(): max_interpol_pts = 10 def interpolate_section(section): sec_start = section.get_distal_npa4() sec_end = section.get_proximal_npa4() length = section.get_length() rad = min(section.d_r, section.p_r) n = min(max(int(lToRRatio * length / rad), 1), max_interpol_pts) j_vec_steps = (sec_end - sec_start) / n int_pts = [sec_start + k * j_vec_steps for k in range(0, n)] return int_pts lbs = [] for morph in self.morphs: lb = SeqUtils.flatten(ListBuilderSectionVisitor(functor=interpolate_section, morph=morph) ()) lbs.extend(lb) pts = numpy.array(lbs) x = pts[:, 0] y = pts[:, 1] z = pts[:, 2] s = pts[:, 3] mlab.points3d(x, y, z, s, colormap=self.colormap, scale_factor=self.scale_factor) mlab.outline()
def check_tree(self): if not self.morph.is_dummy_section_set(): return dummy_section = self.morph.get_dummy_section() self.check_dummy_section(dummy_section) # Check nothing changed in the tree: morphmd5 = _get_md5_of_morphology(self.morph) if self.morphmd5cache: if morphmd5 != self.morphmd5cache: raise Exception('MD5 of tree has changed!') else: return self.morphmd5cache = morphmd5 # Check the tree is sensible: self.check_section(self.morph._dummysection, self.morph, dummysection=True, recurse=True) # Check that there are not duplications of idTags in the tree: idtags = SeqUtils.flatten( [section.idtag for section in self.morph if section.idtag]) #print idtags assert len(idtags) == len(list(set(idtags))) # Check the regions for rgn in self.morph.get_regions(): self.check_region(rgn, self.morph)
def _showSimple(): max_interpol_pts = 10 def interpolate_section(section): sec_start = section.get_distal_npa4() sec_end = section.get_proximal_npa4() length = section.get_length() rad = min(section.d_r, section.p_r) n = min(max(int(lToRRatio * length / rad), 1), max_interpol_pts) j_vec_steps = (sec_end - sec_start) / n int_pts = [sec_start + k * j_vec_steps for k in range(0, n)] return int_pts lbs = [] for morph in self.morphs: lb = SeqUtils.flatten( ListBuilderSectionVisitor(functor=interpolate_section, morph=morph)()) lbs.extend(lb) pts = numpy.array(lbs) x = pts[:, 0] y = pts[:, 1] z = pts[:, 2] s = pts[:, 3] mlab.points3d(x, y, z, s, colormap=self.colormap, scale_factor=self.scale_factor) mlab.outline()