コード例 #1
0
ファイル: AddRigFileForm.cs プロジェクト: tuandnvn/ecat
 public AddRigFileForm(Main main, Session currentSession, string videoFile)
 {
     this.main = main;
     this.currentSession = currentSession;
     this.videoFile = videoFile;
     InitializeComponent();
 }
コード例 #2
0
ファイル: ObjectLinkForm.cs プロジェクト: tuandnvn/ecat
        public ObjectLinkForm(Main main, Project project, Session session, Object obj, int frameNo)
        {
            InitializeComponent();

            this.main = main;
            this.project = project;
            this.session = session;
            this.obj = obj;
            this.frameNo = frameNo;
            this.sessionIndex = project.sessions.IndexOf(session);
            if (sessionIndex == -1)
            {
                MessageBox.Show("Cross session only works inside one project!");
                this.Dispose();
                return;
            }
            this.infoLbl.Text = "Link from object " + obj.id + " of session " + session.sessionName + " at frame " + frameNo;
            this.sessionSelectComboBox.Items.AddRange(project.sessions.Select(s => (s.sessionName.Equals(session.sessionName) ? "(current session)" : s.sessionName)).ToArray());
            this.sessionSelectComboBox.SelectedIndex = sessionIndex;
            this.objectSelectComboBox.Items.AddRange(session.getObjects().Select(o => o.id + (o.name.Equals("") ? "" : (" (\"" + o.name + "\")"))).ToArray());
            this.objectSelectComboBox.SelectedIndex = 0;
            this.qualifiedSelectComboBox.Items.AddRange(new object[] { true, false });
            this.qualifiedSelectComboBox.SelectedIndex = 0;
            this.linkComboBox.Items.AddRange(Options.getOption().objectLinkTypes.ToArray());
            this.linkComboBox.SelectedIndex = 0;
            renderPredicateList();
        }
コード例 #3
0
ファイル: Project.cs プロジェクト: tuandnvn/ecat
        ///// <summary>
        ///// Create a session inside project
        ///// </summary>
        ///// <param name="sessionName"> Session name </param>
        ///// <returns> Created session </returns>
        //public Session addSession(string sessionName)
        //{
        //    Session newSession = new Session(main, sessionName, getProjectName(), getLocation());
        //    sessions.Add(newSession);
        //    saveProjectFile(newSession.sessionName);

        //    return newSession;
        //}

        //Add session to sessions list
        public void addSession(Session session)
        {
            if (session != null)
            {
                sessions.Add(session);
                //MessageBox.Show(session.sessionName);
                //Update project file
                saveProjectFile(session.sessionName);
            }
            else {

            }
        }
コード例 #4
0
ファイル: Object.cs プロジェクト: tuandnvn/ecat
 /// <summary>
 /// Create an object that is manually drawn on the paintBoard
 /// </summary>
 /// <param name="id"></param>
 /// <param name="color"></param>
 /// <param name="borderSize"></param>
 /// <param name="videoFile"></param>
 public Object(Session session, String id, Color color, int borderSize, string videoFile)
 {
     this.session = session;
     this.id = id;
     this.color = color;
     this.borderSize = borderSize;
     this.videoFile = videoFile;
     this.genType = GenType.MANUAL;
     this.objectType = ObjectType._2D;
     this.otherProperties = new Dictionary<string, string>();
     this.objectMarks = new SortedList<int, LocationMark2D>();
     this.object3DMarks = null;
     this.linkMarks = new SortedList<int, LinkMark>();
 }
コード例 #5
0
        public GlyphBoxObjectRecognition(Session currentSession, List<GlyphBoxPrototype> boxPrototypes, int glyphSize)
        {
            this.currentSession = currentSession;
            this.boxPrototypes = boxPrototypes;
            this.glyphSize = glyphSize;

            foreach (var boxPrototype in boxPrototypes)
            {
                if (boxPrototype.glyphSize != glyphSize)
                {
                    throw new ArgumentException("Glyph size of all box prototype should be the same as 'glyphSize' ");
                }
            }
        }
コード例 #6
0
ファイル: RectangleObject.cs プロジェクト: tuandnvn/ecat
 public RectangleObject(Session session, String id, Color color, int borderSize, string videoFile) : base(session, id, color, borderSize, videoFile)
 {
 }
コード例 #7
0
ファイル: Event.cs プロジェクト: tuandnvn/ecat
        public static List<Event> readFromXml( Session session, XmlNode xmlNode)
        {
            List<Event> annotations = new List<Event>();
            foreach (XmlNode node in xmlNode.SelectNodes(ANNOTATION))
            {
                String id = node.Attributes[ID].Value;
                int start = Int32.Parse(node.SelectSingleNode(DURATION).Attributes[START_FRAME].Value);
                int end = Int32.Parse(node.SelectSingleNode(DURATION).Attributes[END_FRAME].Value);
                String text = node.SelectSingleNode(TEXT).InnerText;

                Event a = new Event(id, start, end, text);
                XmlNode refs = node.SelectSingleNode(REFS);
                foreach (XmlNode _ref in refs.SelectNodes(REF))
                {
                    int refStart = Int32.Parse(_ref.Attributes[START].Value);
                    int refEnd = Int32.Parse(_ref.Attributes[END].Value);
                    String refObjectId = _ref.Attributes[REF_TO].Value;

                    Reference reference = new Reference(a, refObjectId, refStart, refEnd);
                    a.addReference(reference);
                }

                XmlNode events = node.SelectSingleNode(EVENTS);
                foreach (XmlNode _event in events.SelectNodes(EVENT))
                {
                    int eventStart = Int32.Parse(_event.Attributes[START].Value);
                    int eventEnd = Int32.Parse(_event.Attributes[END].Value);
                    String semType = _event.Attributes[SEMANTIC_TYPE].Value;

                    Action e = new Action(a, semType, eventStart, eventEnd);
                    a.addAction(e);
                }

                XmlNode links = node.SelectSingleNode(LINK);
                foreach (XmlNode link in events.SelectNodes(LINKTO))
                {
                    string linkId = link.Attributes[ID].Value;
                    var linkType = (EventLinkType) Enum.Parse( typeof(EventLinkType), link.Attributes[TYPE].Value);

                    a.addLinkTo(linkId, linkType);
                }

                annotations.Add(a);
            }
            return annotations;
        }
コード例 #8
0
ファイル: GlyphBoxObject.cs プロジェクト: tuandnvn/ecat
 public GlyphBoxObject(Session currentSession, String id, Color color, int borderSize, string videoFile) : base(currentSession, id, color, borderSize, videoFile)
 {
     this.object3DMarks = new SortedList<int, LocationMark3D>();
     this.objectType = ObjectType._3D;
     this.genType = GenType.TRACKED;
 }
コード例 #9
0
ファイル: RigObject.cs プロジェクト: tuandnvn/ecat
 public RigObject(Session currentSession, String id, Color color, int borderSize, string videoFile) : base(currentSession, id, color, borderSize, videoFile)
 {
     this.objectType = ObjectType._3D;
 }
コード例 #10
0
ファイル: Object.cs プロジェクト: tuandnvn/ecat
        public static List<Object> readFromXml(Session currentSession, XmlNode xmlNode)
        {
            List<Object> objects = new List<Object>();
            foreach (XmlNode objectNode in xmlNode.SelectNodes(OBJECT))
            {
                string id = objectNode.Attributes[ID].Value;
                string name = objectNode.Attributes[NAME].Value;
                string videoFile = objectNode.Attributes[FILENAME].Value;
                string objectType = objectNode.Attributes[OBJECT_TYPE].Value;
                string generate = objectNode.Attributes[GENERATE].Value;
                int borderSize = Int32.Parse(objectNode.Attributes[BORDER_SIZE].Value);
                Color color = Color.FromArgb(Int32.Parse(objectNode.Attributes[COLOR].Value));
                string shape = objectNode.Attributes[SHAPE].Value;
                String semanticType = objectNode.Attributes[SEMANTIC_TYPE].Value;

                Object o = null;

                try
                {
                    Type t = Type.GetType(shape);
                    if (t.IsSubclassOf(typeof(Object)))
                    {
                        o = (Object)Activator.CreateInstance(t, currentSession, id, color, borderSize, videoFile);
                    }
                    else
                    {
                        Console.WriteLine("One object could not be parsed. Id = " + id);
                        continue;
                    }
                }
                catch (Exception e)
                {
                    if (shape == "Rectangle")
                    {
                        o = new RectangleObject(currentSession, id, color, borderSize, videoFile);
                    }
                    else if (shape == "Polygon")
                    {
                        o = new PolygonObject(currentSession, id, color, borderSize, videoFile);
                    }
                }



                o.name = name;
                o.semanticType = semanticType;
                o.genType = (GenType)Enum.Parse(typeof(GenType), generate.ToUpper());
                o.objectType = (ObjectType)Enum.Parse(typeof(ObjectType), "_" + objectType.ToUpper());

                foreach (XmlAttribute attr in objectNode.Attributes)
                {
                    if (!(new List<String> { ID, NAME, FILENAME, OBJECT_TYPE, GENERATE, BORDER_SIZE, COLOR, SEMANTIC_TYPE, SHAPE }).Contains(attr.Name))
                    {
                        o.addProperty(attr.Name, attr.Value);
                    }
                }

                readMarkers(objectNode, o);
                o.readLinks(objectNode);

                objects.Add(o);
            }

            int performerCount = 1;
            // Add performer names to RigObject
            foreach (var o in objects)
            {
                if (o is RigObject)
                {
                    o.name = "Performer " + performerCount++;
                }
            }

            return objects;
        }
コード例 #11
0
ファイル: Main.cs プロジェクト: tuandnvn/ecat
        /// <summary>
        /// Add new session to workspace
        /// </summary>
        /// <param name="projectName"></param>
        /// <param name="sessionName"></param>
        /// <returns></returns>
        public Session addNewSessionToWorkspace(String projectName, String sessionName)
        {
            treeView.BeginUpdate();
            TreeNodeCollection nodes = getTreeViewNodes();
            //MessageBox.Show(projectName);

            TreeNode newSessionNode = new TreeNode(sessionName);
            newSessionNode.ImageIndex = 1;
            newSessionNode.SelectedImageIndex = newSessionNode.ImageIndex;
            newSessionNode.Name = sessionName;

            //1) Update workspace project by adding new session
            Project project = workspace.getProject(projectName);
            Session newSession = new Session(sessionName, project.name, project.locationFolder);

            project.addSession(newSession);

            this.currentSession = newSession;
            //this.currentSession.loadIfNotLoaded();
            this.currentSessionNode = newSessionNode;
            this.treeView.SelectedNode = this.currentSessionNode;

            //2) Update treeView
            currentProjectNode.Nodes.Add(newSessionNode);
            currentProjectNode.Expand();
            treeView.EndUpdate();

            return newSession;
        }