/// <summary> /// Prepares the result of the operation. /// </summary> /// <returns>The resulting object.</returns> protected override ISpectralGeometry PrepareResult() { Int32 maxSourceValue = 0; for (Int32 bandIndex = 0; bandIndex < Source.Raster.NumberOfBands; bandIndex++) { for (Int32 rowIndex = 0; rowIndex < Source.Raster.NumberOfRows; rowIndex++) { for (Int32 columnIndex = 0; columnIndex < Source.Raster.NumberOfColumns; columnIndex++) { maxSourceValue = Math.Max(maxSourceValue, (Int32)Source.Raster.GetValue(rowIndex, columnIndex, bandIndex)); } } } // selection of colors with equal range from minimum to maximum _colors = Enumerable.Range(1, maxSourceValue + 1).Select(number => (Int32)(number * ((1 << 24) - 1.0) / (maxSourceValue + 1))).ToArray(); // randomization Random random = new Random(); for (Int32 colorIndex = 0; colorIndex < _colors.Length; colorIndex++) { Int32 replaceIndex = random.Next(0, _colors.Length); Int32 temp = _colors[colorIndex]; _colors[colorIndex] = _colors[replaceIndex]; _colors[replaceIndex] = temp; } SetResultProperties(RasterFormat.Integer, 3, maxSourceValue > Calculator.Pow(256, 3) ? 16 : 8, RasterPresentation.CreateTrueColorPresentation()); return(base.PrepareResult()); }
/// <summary> /// Prepares the result of the operation. /// </summary> /// <returns>The resulting object.</returns> protected override ISpectralGeometry PrepareResult() { SetResultProperties(RasterFormat.Integer, 3, 8, RasterPresentation.CreateTrueColorPresentation(0, 1, 2)); return(base.PrepareResult()); }