/// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            _toarefGain = new Double[Source.Raster.NumberOfBands];

            switch (Source.Imaging.Device.MissionNumber)
            {
            case 7:
                Double sunZenith = 90 - Source.Imaging.SunElevation;
                Int32  dayOfYear = Source.Imaging.Time.DayOfYear;

                for (Int32 bandIndex = 0; bandIndex < Source.Raster.NumberOfBands; bandIndex++)
                {
                    if (Double.IsNaN(Source.Imaging.Bands[bandIndex].SolarIrradiance))
                    {
                        _toarefGain[bandIndex] = 0;
                    }
                    else
                    {
                        _toarefGain[bandIndex] = Convert.ToSingle(Constants.PI * (1 - 0.01673 * Math.Cos(0.9856 * (dayOfYear - 4) * Constants.PI / 180) * (1 - 0.01673 * Math.Cos(0.9856 * (dayOfYear - 4) * Math.PI / 180))) / (Source.Imaging.Bands[bandIndex].SolarIrradiance * Math.Cos(sunZenith * Constants.PI / 180)));
                    }
                }
                break;

            case 8:
                for (Int32 bandIndex = 0; bandIndex < Source.Raster.NumberOfBands; bandIndex++)
                {
                    _toarefGain[bandIndex] = 1 / (Math.Sin(Source.Imaging.SunElevation * Math.PI / 180));
                }
                break;
            }

            SetResultProperties(RasterFormat.Floating, 32, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            RasterPresentation presentation = null;

            if (_bandIndices.SequenceEqual(Enumerable.Range(0, Source.Raster.NumberOfBands)))
            {
                presentation = Source.Presentation;
            }
            else if (_bandIndices.Length == 3)
            {
                presentation = RasterPresentation.CreateFalseColorPresentation(0, 1, 2);
            }
            else
            {
                presentation = RasterPresentation.CreateGrayscalePresentation();
            }

            RasterImaging imaging = null;

            if (Source.Imaging != null)
            {
                imaging = RasterImaging.Filter(Source.Imaging, _bandIndices);
            }

            SetResultProperties(Source.Raster.Format, _bandIndices.Length, Source.Raster.NumberOfRows, Source.Raster.NumberOfColumns, Source.Raster.RadiometricResolution, Source.Raster.Mapper, presentation, imaging);

            return(base.PrepareResult());
        }
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            _toarefGain = new Double[Source.Raster.NumberOfBands];

            Double sunZenith = 90 - Source.Imaging.SunElevation, doySolarIrradianceSunZenithRatio;
            Int32  dayOfYear = Source.Imaging.Time.DayOfYear;

            for (Int32 bandIndex = 0; bandIndex < Source.Raster.NumberOfBands; bandIndex++)
            {
                doySolarIrradianceSunZenithRatio = Convert.ToSingle(Constants.PI * (1 - 0.01673 * Math.Cos(0.9856 * (dayOfYear - 4) * Constants.PI / 180) * (1 - 0.01673 * Math.Cos(0.9856 * (dayOfYear - 4) * Math.PI / 180))) / (Source.Imaging.Bands[bandIndex].SolarIrradiance * Math.Cos(sunZenith * Constants.PI / 180)));
                _toarefGain[bandIndex]           = doySolarIrradianceSunZenithRatio / Source.Imaging.Bands[bandIndex].PhysicalGain;
            }

            SetResultProperties(RasterFormat.Floating, 32, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }
Example #4
0
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            _segmentNumbers = new Dictionary <Segment, UInt32>();

            UInt32 number = 0;

            foreach (Segment segment in _segmentCollection.GetSegments())
            {
                _segmentNumbers.Add(segment, number);
                number++;
            }

            Int32 radiometricResolution = _segmentCollection.Count > Int16.MaxValue ? 32 : (_segmentCollection.Count > Byte.MaxValue ? 16 : 8);

            SetResultProperties(RasterFormat.Integer, 1, radiometricResolution, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }
Example #5
0
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            _meanValue = new Double[Source.Raster.NumberOfBands];

            for (Int32 bandIndex = 0; bandIndex < Source.Raster.NumberOfBands; bandIndex++)
            {
                Double result = 0;
                for (Int32 rowIndex = 0; rowIndex < Source.Raster.NumberOfRows; rowIndex++)
                {
                    for (Int32 columnIndex = 0; columnIndex < Source.Raster.NumberOfColumns; columnIndex++)
                    {
                        result += Source.Raster.GetFloatValue(rowIndex, columnIndex, bandIndex);
                    }
                }

                _meanValue[bandIndex] = result / (Source.Raster.NumberOfColumns * Source.Raster.NumberOfRows);
            }

            SetResultProperties(RasterFormat.Integer, 8, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }
Example #6
0
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            SetResultProperties(RasterFormat.Floating, 1, 32, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }
        /// <summary>
        /// Prepares the result of the operation.
        /// </summary>
        /// <returns>The resulting object.</returns>
        protected override ISpectralGeometry PrepareResult()
        {
            SetResultProperties(_validationGeometry, RasterFormat.Integer, 1, 8, RasterPresentation.CreateGrayscalePresentation());

            return(base.PrepareResult());
        }