Пример #1
0
        /// <summary>
        /// This implementation is based on the following articles:
        /// 1.  Gómez-Lopera, Juan Francisco, et al. (2000)
        ///     An analysis of edge detection by using the Jensen-Shannon divergence.
        ///     Journal of Mathematical Imaging and Vision 13.1: 35-56.
        ///     
        /// 2.  Katatbeh, Qutaibeh D., et al. (2015)
        ///     An Optimal Segmentation Method Using Jensen–Shannon Divergence via a Multi-Size Sliding Window Technique.
        ///     Entropy 17.12: 7996-8006.
        /// </summary>
        static void Main(string[] args)
        {
            IndexTransformator transformator = new IndexTransformator();
            InputParser inputParser = new InputParser(transformator);
            HeftArrayCreator heftArrayCreator = new HeftArrayCreator(transformator);
            int serverNO;
            int pointNO;

            int spaceDimension;
            int histogramResolution;
            int scaleNumber;
            int cellMaxValue;
            int slidingWindowSize;
            Array array;
            bool together = inputParser.determineTogetherOrSeparately();
            if (together)
            {
                array = inputParser.parseInputFile(out spaceDimension, out histogramResolution,
                    out serverNO, out pointNO, out scaleNumber, out cellMaxValue, out slidingWindowSize);
            }
            else
            {
                parseInputSeparately(inputParser, out serverNO, out pointNO, out spaceDimension,
                    out histogramResolution, out scaleNumber, out cellMaxValue, out array, out slidingWindowSize);
            }
            Console.WriteLine("Point no.: {0}", pointNO);

            ShannonEntropyComputer entropyComputer = new ShannonEntropyComputer();
            JenShaDivComputer jenShaDivComputer = new JenShaDivComputer(entropyComputer);
            FrequencyComputer frequencyComputer = new FrequencyComputer(array, transformator, cellMaxValue,
                scaleNumber);
            Array heftArray = heftArrayCreator.createHeftArray(spaceDimension, histogramResolution, array);
            Array frequencyArray = frequencyComputer.createFrequencyArray(spaceDimension, histogramResolution);

            Divider divider = new Divider(array, heftArray, frequencyArray, transformator, jenShaDivComputer,
                spaceDimension, histogramResolution, serverNO, slidingWindowSize);
            Coords[] partition = divider.determinePartition();
            writeOutTiles(serverNO, spaceDimension, partition);
        }
 public JenShaDivComputer(ShannonEntropyComputer entropyComputer)
 {
     this.entropyComputer = entropyComputer;
 }