/// <summary> /// Writes a sequence of spectral values to the service in the specified order. /// </summary> /// <param name="rowIndex">The starting row index.</param> /// <param name="columnIndex">The starting column index.</param> /// <param name="bandIndex">The starting band index.</param> /// <param name="spectralValues">The spectral values.</param> /// <param name="writeOrder">The writing order.</param> /// <exception cref="System.NotSupportedException">The service is not writable.</exception> void IRasterService.WriteFloatValueSequence(Int32 rowIndex, Int32 columnIndex, Int32 bandIndex, Double[] spectralValues, RasterDataOrder writeOrder) { throw new NotSupportedException("The service is not writable."); }
/// <summary> /// Reads a sequence of spectral values from the service. /// </summary> /// <param name="rowIndex">The zero-based row index of the first value.</param> /// <param name="columnIndex">The zero-based column index of the first value.</param> /// <param name="bandIndex">The zero-based band index of the first value.</param> /// <param name="numberOfValues">The number of values.</param> /// <param name="readOrder">The reading order.</param> /// <returns>The array containing the sequence of values in the specified order.</returns> /// <exception cref="System.NotSupportedException">The specified reading order is not supported.</exception> public Double[] ReadFloatValueSequence(Int32 rowIndex, Int32 columnIndex, Int32 bandIndex, Int32 numberOfValues, RasterDataOrder readOrder) { if (readOrder != DataOrder) { throw new NotSupportedException("The specified reading order is not supported."); } return(_rawImageReader.ReadValueSequence(rowIndex, columnIndex, bandIndex, numberOfValues).Cast <Double>().ToArray()); }
/// <summary> /// Writes the specified spectral values to the service in the specified order. /// </summary> /// <param name="rowIndex">The row index.</param> /// <param name="columnIndex">The column index.</param> /// <param name="spectralValues">The spectral values.</param> /// <param name="writeOrder">The writing order.</param> /// <exception cref="System.NotSupportedException">The service is not writable.</exception> void IRasterService.WriteValueSequence(Int32 startIndex, UInt32[] spectralValues, RasterDataOrder writeOrder) { throw new NotSupportedException("The service is not writable."); }
/// <summary> /// Reads a sequence of spectral values from the service. /// </summary> /// <param name="startIndex">The zero-based absolute starting index.</param> /// <param name="numberOfValues">The number of values to be read.</param> /// <param name="readOrder">The reading order.</param> /// <returns>The array containing the sequence of values in the specified order.</returns> /// <exception cref="System.NotSupportedException">The specified reading order is not supported.</exception> public UInt32[] ReadValueSequence(Int32 startIndex, Int32 numberOfValues, RasterDataOrder readOrder) { if (readOrder != DataOrder) { throw new NotSupportedException("The specified reading order is not supported."); } return(_rawImageReader.ReadValueSequence(startIndex, numberOfValues)); }
/// <summary> /// Writes the specified spectral values to the service in the specified order. /// </summary> /// <param name="rowIndex">The row index.</param> /// <param name="columnIndex">The column index.</param> /// <param name="spectralValues">The spectral values.</param> /// <param name="writeOrder">The writing order.</param> /// <exception cref="System.NotSupportedException">The service does not support writing.</exception> void IRasterService.WriteFloatValueSequence(Int32 startIndex, Double[] spectralValues, RasterDataOrder writeOrder) { throw new NotSupportedException("The service does not support writing."); }
/// <summary> /// Writes a sequence of spectral values to the service in the specified order. /// </summary> /// <param name="rowIndex">The starting row index.</param> /// <param name="columnIndex">The starting column index.</param> /// <param name="bandIndex">The starting band index.</param> /// <param name="spectralValues">The spectral values.</param> /// <param name="writeOrder">The writing order.</param> /// <exception cref="System.NotSupportedException">The service does not support writing.</exception> void IRasterService.WriteValueSequence(Int32 rowIndex, Int32 columnIndex, Int32 bandIndex, UInt32[] spectralValues, RasterDataOrder writeOrder) { throw new NotSupportedException("The service does not support writing."); }
/// <summary> /// Reads a sequence of spectral values from the service. /// </summary> /// <param name="rowIndex">The zero-based row index of the first value.</param> /// <param name="columnIndex">The zero-based column index of the first value.</param> /// <param name="bandIndex">The zero-based band index of the first value.</param> /// <param name="numberOfValues">The number of values.</param> /// <returns>The array containing the sequence of values in the default order of the service.</returns> public Double[] ReadFloatValueSequence(Int32 rowIndex, Int32 columnIndex, Int32 bandIndex, Int32 numberOfValues, RasterDataOrder readOrder) { // there may be not enough values, or the number may be greater than the maximum allowed Double[] values = new Double[Calculator.Min(MaximumNumberOfValues, numberOfValues, (Dimensions.NumberOfRows - rowIndex) * Dimensions.NumberOfColumns * Dimensions.NumberOfBands + (Dimensions.NumberOfColumns - columnIndex) * Dimensions.NumberOfBands + Dimensions.NumberOfBands - bandIndex)]; Int32 currentIndex = 0; while (currentIndex < values.Length) { // read the specified pixel Double[] currentValues = _operation.ComputeFloat(rowIndex, columnIndex); Array.Copy(currentValues, bandIndex, values, currentIndex, Math.Min(currentValues.Length - bandIndex, values.Length - currentIndex)); // change indices for the next pixel bandIndex = 0; columnIndex++; if (columnIndex == Dimensions.NumberOfColumns) { columnIndex = 0; rowIndex++; } currentIndex += currentValues.Length - bandIndex; } return(values); }
/// <summary> /// Reads a sequence of spectral values from the service. /// </summary> /// <param name="startIndex">The zero-based absolute starting index.</param> /// <param name="numberOfValues">The number of values to be read.</param> /// <param name="readOrder">The reading order.</param> /// <returns>The array containing the sequence of values in the specified order.</returns> public Double[] ReadFloatValueSequence(Int32 startIndex, Int32 numberOfValues, RasterDataOrder readOrder) { // compute the row/column/band indices from the start index Int32 columnIndex = 0, rowIndex = 0, bandIndex = 0; rowIndex = startIndex / (Dimensions.NumberOfColumns * Dimensions.NumberOfBands); columnIndex = (startIndex - rowIndex * Dimensions.NumberOfColumns * Dimensions.NumberOfBands) / Dimensions.NumberOfBands; bandIndex = startIndex - rowIndex * Dimensions.NumberOfColumns * Dimensions.NumberOfBands - columnIndex * Dimensions.NumberOfBands; return(ReadFloatValueSequence(rowIndex, columnIndex, bandIndex, numberOfValues, readOrder)); }