/// <summary>
        /// Process an ordinary sketch by first creating a feature sketch for it.
        /// This method calls process using the created feature sketch, then
        /// returns the feature sketch, in case you want to use it. The given
        /// ordinary sketch is modified in the process.
        /// </summary>
        /// <param name="sketch">the ordinary sketch to use</param>
        /// <returns>the featureSketch used during processing</returns>
        public FeatureSketch process(Sketch.Sketch sketch)
        {
            FeatureSketch featureSketch = FeatureSketch.MakeFeatureSketch(new Sketch.Project(sketch));

            process(featureSketch);
            return(featureSketch);
        }
        /// <summary>
        /// Process an ordinary sketch by first creating a feature sketch for it.
        /// This method calls process using the created feature sketch, then
        /// returns the feature sketch, in case you want to use it. The given
        /// ordinary sketch is modified in the process.
        /// </summary>
        /// <param name="project">the sketch project to use</param>
        /// <returns>the featureSketch used during processing</returns>
        public FeatureSketch process(Sketch.Project project)
        {
            FeatureSketch featureSketch = FeatureSketch.MakeFeatureSketch(project);

            process(featureSketch);
            return(featureSketch);
        }
示例#3
0
        public override void run(Sketch.Sketch sketch, string filename)
        {
            FeatureSketch fsketch = FeatureSketch.MakeFeatureSketch(new Sketch.Project(sketch));

            Dictionary <Substroke, string> classifications = new Dictionary <Substroke, string>();

            foreach (Substroke substroke in sketch.Substrokes)
            {
                classifications.Add(substroke, substroke.Classification);
            }

            Dictionary <string, Dictionary <FeatureStrokePair, double[]> > pair2values;

            pair2values = fsketch.GetValuesPairwise(classifications);

            foreach (KeyValuePair <string, Dictionary <FeatureStrokePair, double[]> > pair in pair2values)
            {
                string classification = pair.Key;
                Dictionary <FeatureStrokePair, double[]> features = pair.Value;

                Console.WriteLine(classification + ":");

                foreach (KeyValuePair <FeatureStrokePair, double[]> pair2 in features)
                {
                    Substroke stroke1       = pair2.Key.Item1;
                    Substroke stroke2       = pair2.Key.Item2;
                    double[]  featureValues = pair2.Value;

                    _resultsPairs.addResult(featureValues);
                }
            }
        }
        /// <summary>
        /// Process an ordinary sketch by first creating a feature sketch for it.
        /// This method calls process using the created feature sketch, then
        /// returns the feature sketch, in case you want to use it. The given
        /// ordinary sketch is modified in the process.
        /// </summary>
        /// <param name="sketch">the ordinary sketch to use</param>
        /// <returns>the featureSketch used during processing</returns>
        public FeatureSketch process(Sketch.Sketch sketch)
        {
            FeatureSketch featureSketch = FeatureSketch.MakeFeatureSketch(sketch);

            process(featureSketch);
            return(featureSketch);
        }
示例#5
0
        /// <summary>
        /// Loads a Sketch into the InkSketch
        /// </summary>
        /// <param name="sketch">The sketch to load</param>
        /// Precondition: The InkSketch is clean (all dictionaries cleared etc)
        /// Postcondition: The InkSketch has the proper data members
        public StrokeCollection LoadSketch(Sketch.Sketch sketch)
        {
            project.sketch = sketch;
            featureSketch  = FeatureSketch.MakeFeatureSketch(project);
            setUserSpecified();

            return(CreateInkStrokesFromSketch());
        }
示例#6
0
        /// <summary>
        /// Clears out the internal data structures for loading
        /// </summary>
        public void Clear()
        {
            mSketch        = new Sketch.Sketch();
            mFeatureSketch = FeatureSketch.MakeFeatureSketch(mSketch);

            ink2sketchStr.Clear();
            sketchStr2ink.Clear();
            substrokeIdMap.Clear();
        }
示例#7
0
        /// <summary>
        /// Clears out the internal data structures for loading
        /// </summary>
        public void Clear()
        {
            createEmptySketch();
            featureSketch = FeatureSketch.MakeFeatureSketch(project);

            ink2sketchStr.Clear();
            sketchStr2ink.Clear();
            substrokeIdMap.Clear();
        }
示例#8
0
        /// <summary>
        /// Loads a Sketch into the InkSketch
        /// </summary>
        /// <param name="sketch">The sketch to load</param>
        /// Precondition: The InkSketch is clean (all dictionaries cleared etc)
        /// Postcondition: The InkSketch has the proper data members
        public StrokeCollection LoadSketch(Sketch.Sketch sketch)
        {
            unsubscribeToInk();

            foreach (Shape shape in sketch.Shapes)
            {
                if (shape.Type != new Domain.ShapeType())
                {
                    shape.AlreadyGrouped = true;
                    shape.AlreadyLabeled = true;
                }
            }

            mSketch        = sketch;
            mFeatureSketch = FeatureSketch.MakeFeatureSketch(sketch);

            subscribeToInk();

            return(CreateInkStrokesFromSketch());;
        }
示例#9
0
        public FeatureSketchStage()
        {
            name           = "Feature Sketch Stage";
            shortname      = "fsk";
            outputFiletype = ".csv";

            Sketch.Sketch sketch  = new Sketch.Sketch();
            FeatureSketch fsketch = FeatureSketch.MakeFeatureSketch(new Sketch.Project(sketch));

            Dictionary <string, bool> featuresSingleEnabled = fsketch.FeatureListSingle;

            _featuresSingle = Data.Utils.filter(featuresSingleEnabled.Keys, delegate(string s) { return(featuresSingleEnabled[s]); });

            Dictionary <string, bool> featuresPairEnabled = fsketch.FeatureListPair;

            _featuresPair = Data.Utils.filter(featuresPairEnabled.Keys, delegate(string s) { return(featuresPairEnabled[s]); });

            _resultsSingle = new Table(_featuresSingle);
            _resultsPairs  = new Table(_featuresPair);
        }
示例#10
0
 /// <summary>
 /// Constructor.  Creates an empty FeatureSketch and Sketch.
 /// </summary>
 /// <param name="inkPic">The InkCanvas with which to synchronize</param>
 public InkCanvasSketch(InkCanvas inkCanvas)
     : this(inkCanvas, FeatureSketch.MakeFeatureSketch(new Sketch.Sketch()))
 {
 }