Пример #1
0
        public StructureSWCView(StructureGraph graph)
        {
            Stack<LocationNode> segmentStack = new Stack<LocationNode>();
            MasterKnownLocationList = new List<long>(graph.Nodes.Count);
            LocationNode somaNode = StructureSWCView.LargestNode(graph);

            queue.Enqueue(new SWCStackData(somaNode, SWCType.SOMA, -1));
            ProcessSWCStack(graph, queue);
        }
Пример #2
0
        private static Structures.LocationNode LargestNode(StructureGraph graph)
        {
            double maxradius = 0.0;
            LocationNode largestNode = null;
            foreach (LocationNode node in graph.Nodes.Values)
            {
                if(node.Location.Radius > maxradius)
                {
                    maxradius = node.Location.Radius;
                    largestNode = node;
                }
            }

            return largestNode;
        }
Пример #3
0
        private void ProcessSWCStack(StructureGraph graph, Queue<SWCStackData> queue)
        {
            while(queue.Count > 0)
            {
                SWCStackData entry = queue.Dequeue();

                TraceLocation(graph, entry.node, entry.Type, entry.ParentID);
            }
        }
Пример #4
0
        private void TraceLocation(StructureGraph graph, LocationNode loc, SWCType Type, long ParentID)
        {
            MasterKnownLocationList.Add(loc.Location.ID);

            int SWCID;

            if (loc.Edges.Count == 1)
            {
                SWCID = WriteLocationEntry(sb, loc, SWCType.END_POINT, ParentID);
            }
            else if (loc.Edges.Count == 2)
            {
                SWCID = WriteLocationEntry(sb, loc, Type, ParentID);
                AddLinks(graph, loc, Type, SWCID);
            }
            else
            {
                SWCID = WriteLocationEntry(sb, loc, SWCType.FORK_POINT, ParentID);

                List<long> NewAddedLocations = AddKnownBranchesToList(loc);
                AddLinks(graph, loc, SWCType.AXON, SWCID);
            }
        }
Пример #5
0
        private void AddLinks(StructureGraph graph, LocationNode loc, SWCType Type, long SWCID)
        {
            foreach(long locID in loc.Location.Links)
            {
                if (MasterKnownLocationList.Contains(locID))
                    continue;

                LocationNode node = graph.Nodes[locID];

                queue.Enqueue(new SWCStackData(node, Type, SWCID));
            }
        }