public override ICData Run()
        {
            Size StartingCommonSize = new Size(Math.Max(m_Image1.Width, m_Image2.Width), Math.Max(m_Image1.Height, m_Image2.Height));
            //Preparing structures
            List<Point> sourcePoints = Utilities.ExtractPoints(m_Image1, TresholdColor);
            List<Point> targetPoints = Utilities.ExtractPoints(m_Image2, TresholdColor);

            DoubleMatrix source = Utilities.ListToMatrix(sourcePoints);
            DoubleMatrix target = Utilities.ListToMatrix(targetPoints);

            //1st station, PCA alignment
            ////////////////////////////
            PCAMatching pcaMatching = new PCAMatching(source, target);
            pcaMatching.Calculate();

            target = pcaMatching.Result;

            //In between stages
            DoubleMatrix minMax = PCA.Utils.ShiftToPositives(ref target, source);
            minMax              = PCA.Utils.ShiftToPositives(ref source, target);

            sourcePoints = Utilities.MatrixToList(source);
            targetPoints = Utilities.MatrixToList(target);

            m_sourcePtArray = sourcePoints.ToArray();
            m_targetPtArray = targetPoints.ToArray();

            Size meshSize = new Size(
                Math.Max((int)Math.Ceiling(minMax[sr_X, sr_MaxCol] + 2), StartingCommonSize.Width),
                Math.Max((int)Math.Ceiling(minMax[sr_Y, sr_MaxCol] + 2), StartingCommonSize.Height));

            //2nd station,Hausdorff Matching Points insertion
            //////////////////////////////////////////////////
            IntMatrix sourceBinaryMap = Utilities.ToBinaryMap(source,meshSize);
            IntMatrix targetBinaryMap = Utilities.ToBinaryMap(target,meshSize);

            HausdorffMatching hausdorffMatching = new HausdorffMatching(sourceBinaryMap, targetBinaryMap);
            IntMatrix diffSource = hausdorffMatching.Calculate1on2();
            IntMatrix diffTarget = hausdorffMatching.Calculate2on1();

            //Preparing a logic for point selection bank
            List<Point> currList = null;
            Func<int, int, int, int> pointInsertionLogic = (row, col, value) =>
                {
                    for (int i = 2; i < value; ++i)
                    {
                        currList.Add(new Point(col, row));
                    }
                    return value;
                };

            //Applying this logic
            m_SourceBank = new List<Point>();
            currList = m_SourceBank;
            diffSource.Iterate(pointInsertionLogic);
            m_TargetBank = new List<Point>();
            currList = m_TargetBank;
            diffTarget.Iterate(pointInsertionLogic);

            //3rd station ShapeContext Matching
            ///////////////////////////////////
            ShapeContextMatching shapeContextMatching = new ShapeContextMatching(m_sourcePtArray, m_targetPtArray, meshSize, SelectSamplesLogic);

            shapeContextMatching.AlignmentLogic = shapeContextMatching.StandardAlignmentLogic;
            if (ShapeContextWarpDistanceTreshold > 0)
            {
                shapeContextMatching.DistanceTreshold = ShapeContextWarpDistanceTreshold;
            }
            shapeContextMatching.Calculate();

            CShapeContextResultData retResult =
                new CShapeContextResultData(
                    m_sourcePtArray,
                    m_targetPtArray,
                    meshSize,
                    shapeContextMatching.LastSourceSamples,
                    shapeContextMatching.LastTargetSamples);

            return retResult;
        }
        public override void Create(Image i_SourceImage, Image i_TargetImage)
        {
            m_Image1 = i_SourceImage;
            m_Image2 = i_TargetImage;

            List<Point> source = Utilities.ExtractPoints(m_Image1, TresholdColor);
            List<Point> target = Utilities.ExtractPoints(m_Image2, TresholdColor);

            m_sourcePoints = Utilities.ListToArray(source);
            m_targetPoints = Utilities.ListToArray(target);

            m_commonSize = new Size(Math.Max(m_Image1.Width, m_Image2.Width), Math.Max(m_Image1.Height, m_Image2.Height));

            m_matching = new ShapeContextMatching(m_sourcePoints, m_targetPoints, m_commonSize, new SelectSamplesDelegate(SamplePoints));
        }