How to use the neuroglancer.LineAnnotation function in neuroglancer

To help you get started, we’ve selected a few neuroglancer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github google / neuroglancer / python / examples / synaptic_partners.py View on Github external
partner_counts = partner_counts & cur_counts
        if partner_counts is None:
            partner_counts = collections.Counter()
        top_partners = sorted(
            (x for x in partner_counts.keys() if x not in self.selected_segments),
            key=lambda x: -partner_counts[x])
        top_partners = top_partners[:self.num_top_partners]
        with self.viewer.txn() as s:
            s.layers['partners'].segments = top_partners
            annotations = s.layers['synapses'].annotations
            del annotations[:]
            for synapse in six.itervalues(synapses):
                tbar = synapse['T-bar']
                for partner in synapse['partners']:
                    annotations.append(
                        neuroglancer.LineAnnotation(
                            id='%d' % id(partner),
                            point_a=tbar['location'],
                            point_b=partner['location'],
                            segments=[tbar['body ID'], partner['body ID']],
                        ))