Beispiel #1
0
        public static Options getOption()
        {
            if (singletonOptions == null)
            {
                Options tempOptions = createDefaultOption();
                try
                {
                    var s = new DataContractSerializer(typeof(Options));

                    FileStream fs = new FileStream(Options.FILENAME, FileMode.Open);
                    singletonOptions = (Options)s.ReadObject(fs);

                    if (singletonOptions.prototypeList == null)
                        singletonOptions.prototypeList = tempOptions.prototypeList;

                    if (singletonOptions.interpolationModes == null)
                        singletonOptions.interpolationModes = tempOptions.interpolationModes;

                    if (singletonOptions.objectLinkTypes == null)
                        singletonOptions.objectLinkTypes = tempOptions.objectLinkTypes;

                    fs.Close();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }

            return singletonOptions;
        }
Beispiel #2
0
 public RecordPanel(Options options)
 {
     this.options = options;
     InitializeComponent();
     InitializeObjectRecognizers();
     InitializeOptionsTable();
     InitializeButtons();
 }
Beispiel #3
0
        public Main()
        {
            InitializeComponent();

            // Load options from Options.FILENAME file
            // If the file doesn't exist, or broken, options will be Default
            options = Options.getOption();

            // Initialize some other controls might depends on options
            InitializeOtherControls();

            InitDrawingComponent();
            InitEventAnnoComponent();

            //Load images to imageList
            //loadImages();

            //comboBox1.SelectedIndex = 0;
            //Just for sample GUI test
            setMinimumFrameTrackBar(0);
            setMaximumFrameTrackBar(100);

            previousSize = this.Size;
            rowStyles = annotateTableLayoutPanel.RowStyles;
            columnStyles = annotateTableLayoutPanel.ColumnStyles;

            originalRowStyles = new RowStyle[rowStyles.Count];
            originalColumnStyles = new ColumnStyle[columnStyles.Count];

            for (int i = 0; i < rowStyles.Count; i++)
            {
                originalRowStyles[i] = new RowStyle(rowStyles[i].SizeType, rowStyles[i].Height);
            }

            for (int i = 0; i < columnStyles.Count; i++)
            {
                originalColumnStyles[i] = new ColumnStyle(columnStyles[i].SizeType, columnStyles[i].Width);
            }

            for (int i = 0; i < rowStyles.Count; i++)
            {
                Console.WriteLine("Row " + i + " " + annotateTableLayoutPanel.GetRowHeights()[i]);
            }

            for (int i = 0; i < columnStyles.Count; i++)
            {
                Console.WriteLine("Column " + i + " " + annotateTableLayoutPanel.GetColumnWidths()[i]);
            }

            Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
        }
Beispiel #4
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (options == null)
            {
                options = new Options();
            }

            saveDetection();
            saveView();

            options.save();

            this.Dispose();
        }
Beispiel #5
0
 public OptionsForm(Options options)
 {
     InitializeComponent();
     this.options = options;
     InitializeFromConfig();
 }
Beispiel #6
0
 /// <summary>
 /// Change the singleton options to default and return
 /// </summary>
 /// <returns></returns>
 public static Options makeDefaultOption()
 {
     singletonOptions = createDefaultOption();
     return singletonOptions;
 }
Beispiel #7
0
        /// <summary>
        /// CAUTIONS: This one create another Option object, so it should be private
        /// </summary>
        /// <returns></returns>
        private static Options createDefaultOption()
        {
            Options options = new Options();
            options.glyphPrototypePath = "";
            options.detectionMode = OverwriteMode.ADD_SEPARATE;
            options.prototypeList = new List<GlyphBoxPrototype> { GlyphBoxPrototype.prototype2, GlyphBoxPrototype.prototype3, GlyphBoxPrototype.prototype4 };
            options.showRigOption = ShowRig.SHOW_ALL;
            options.interpolationModes = new Dictionary<string, InterpolationMode>();
            options.interpolationModes[RIG] = InterpolationMode.LEFT_COPY;
            options.interpolationModes[RECTANGLE] = InterpolationMode.LEFT_COPY;
            options.interpolationModes[GLYPH] = InterpolationMode.LEFT_COPY;
            options.objectLinkTypes = new List<string> { "ON", "IN", "ATTACH_TO" };

            return options;
        }
Beispiel #8
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="startFrame"></param>
        /// <param name="skipLength"></param>
        /// <param name="duration"></param>
        /// <param name="templateDescription"></param>
        /// <param name="overwriteMode"></param>
        /// <returns></returns>
        internal List<Event> addEventTemplate(int startFrame, int skipLength, int duration, string templateDescription,
            Options.OverwriteMode overwriteMode)
        {
            var addedEvents = new List<Event>();
            int noOfEventTemplate = (this.sessionLength - startFrame - duration) / skipLength + 1;

            /// Process before looping through generated event templates
            /// 
            switch (overwriteMode)
            {
                case Options.OverwriteMode.REMOVE_EXISTING:
                    this.events = new List<Event>();
                    break;
            }

            for (int i = 0; i < noOfEventTemplate; i++)
            {
                int start = startFrame + skipLength * i;
                int end = startFrame + skipLength * i + duration;

                Event e = new Event(null, start, end, templateDescription);

                switch (overwriteMode)
                {
                    case Options.OverwriteMode.ADD_SEPARATE:
                        this.addEvent(e);
                        this.findObjectsByNames(e);
                        addedEvents.Add(e);
                        break;
                    case Options.OverwriteMode.REMOVE_EXISTING:
                        this.addEvent(e);
                        this.findObjectsByNames(e);
                        addedEvents.Add(e);
                        break;
                    case Options.OverwriteMode.OVERWRITE:
                        foreach (Event ev in this.events)
                        {
                            if (ev.startFrame == e.startFrame && ev.endFrame == e.endFrame)
                            {
                                this.removeEvent(ev);
                                break;
                            }
                        }

                        this.addEvent(e);
                        this.findObjectsByNames(e);
                        addedEvents.Add(e);
                        break;
                    case Options.OverwriteMode.NO_OVERWRITE:
                        foreach (Event ev in this.events)
                        {
                            if (ev.startFrame == e.startFrame && ev.endFrame == e.endFrame)
                                break;
                        }
                        break;
                }
            }

            return addedEvents;
        }