public FrequencyComputer(Array array, IndexTransformator transformator, int cellMaxValue, 
     int scaleNumber)
 {
     this.array = array;
     this.transformator = transformator;
     this.scaleNumber = scaleNumber;
     this.cellFillScale = new double[scaleNumber];
     double step = (double)cellMaxValue / (double)scaleNumber;
     for (int idx = 0; idx < scaleNumber; idx++)
     {
         this.cellFillScale[idx] = idx * step;
     }
 }
Beispiel #2
0
 public Divider(Array array, Array heftArray, Array frequencyArray, IndexTransformator transformator, 
     JenShaDivComputer jenShaDivComputer, int spaceDimension, int histogramResolution, int serverNO,
     int slidingWindowSize)
 {
     this.array = array;
     this.heftArray = heftArray;
     this.frequencyArray = frequencyArray;
     this.transformator = transformator;
     this.jenShaDivComputer = jenShaDivComputer;
     this.spaceDimension = spaceDimension;
     this.histogramResolution = histogramResolution;
     this.serverNO = serverNO;
     this.slidingWindowSize = slidingWindowSize;
     int[] lengthsTileNumberArray = new int[2 * spaceDimension];
     for (int idx = 0; idx < 2 * spaceDimension; idx++)
     {
         lengthsTileNumberArray[idx] = histogramResolution;
     }
     this.listOfLeaves = new List<Coords>();
 }
Beispiel #3
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 InputParser(IndexTransformator transformator)
 {
     this.transformator = transformator;
 }
 public HeftArrayCreator(IndexTransformator transformator)
 {
     this.transformator = transformator;
 }