public PythonAnnotatedNodeWrapper(AnnotatedNode node)
        {
            _node = node;

            data = new PythonDictionary();
            JObject jdata = node.Data;
            foreach (var item in jdata.Properties())
            {
                data[item.Name] = item.Value.ToString();
            }
            
           
        }
예제 #2
0
        private static List <AnnotatedNode> NodesFromImageAnnotations(List <LayerWrapper> layers,
                                                                      int precedingLayerIndex,
                                                                      Dictionary <string, InterpretationFromImage> interps)
        {
            LayerWrapper currentLayer = layers[precedingLayerIndex + 1];

            List <ImageAnnotation> annotations = new List <ImageAnnotation>();

            IEnumerable <string> layerlibs = currentLayer.Layer.AnnotationLibraries();

            if (layerlibs != null)
            {
                foreach (string lib in layerlibs)
                {
                    annotations.AddRange(AnnotationLibrary.GetAnnotations(lib));
                }
            }

            List <AnnotatedNode> nodesToProcess = new List <AnnotatedNode>();

            //for each one, interpret the observation
            foreach (ImageAnnotation annotation in annotations)
            {
                InterpretationFromImage interp = interps[annotation.ImageId];
                Interpret(layers, precedingLayerIndex, interp);
                Tree root         = interp.interpretation;
                Tree matchingnode = MatchingNode(root, annotation.Region);

                AnnotatedNode annoatednode = new AnnotatedNode(matchingnode, root, annotation.Data, annotation.Region, annotation.ImageId);
                nodesToProcess.Add(annoatednode);
            }

            //MergeNodesWithSameRegion(nodesToProcess);

            return(nodesToProcess);
        }
		private static List<AnnotatedNode> NodesFromImageAnnotations(List<LayerWrapper> layers, 
			int precedingLayerIndex,  
			Dictionary<string, InterpretationFromImage> interps)
		{
			LayerWrapper currentLayer = layers[precedingLayerIndex + 1];

			List<ImageAnnotation> annotations = new List<ImageAnnotation>();

            IEnumerable<string> layerlibs = currentLayer.Layer.AnnotationLibraries();
            if (layerlibs != null)
            {
                foreach (string lib in layerlibs)
                    annotations.AddRange(AnnotationLibrary.GetAnnotations(lib));
            }

			List<AnnotatedNode> nodesToProcess = new List<AnnotatedNode>();

			//for each one, interpret the observation
			foreach (ImageAnnotation annotation in annotations)
			{
				InterpretationFromImage interp = interps[annotation.ImageId];
				Interpret(layers, precedingLayerIndex, interp);
				Tree root = interp.interpretation;
				Tree matchingnode = MatchingNode(root, annotation.Region);

				AnnotatedNode annoatednode = new AnnotatedNode(matchingnode, root, annotation.Data, annotation.Region, annotation.ImageId);
				nodesToProcess.Add(annoatednode);
			}

			//MergeNodesWithSameRegion(nodesToProcess);

			return nodesToProcess;
		}