Click or drag to resize
XDL

XDMBandMath Class

XDMBandMath 클래스는 사용자가 정의하는 연산식을 이용하여 영상 밴드 간의 래스터 연산을 수행한다.
Inheritance Hierarchy

Namespace:  Pixoneer.NXDL.NRS
Assembly:  NXDLrs (in NXDLrs.dll) Version: 1.2.817.72
Syntax
C#
public class XDMBandMath : XDMBand

The XDMBandMath type exposes the following members.

Constructors
  NameDescription
Public methodXDMBandMath
XDMBandMath 클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다.
Top
Methods
  NameDescription
Public methodGetInputParam
Band간의 수학적 연산에 필요한 입력 파라미터를 얻는다.
Public methodSetInputParam
Band Math을 위한 입력 파라미터를 설정한다.
Top
Remarks

영상 밴드는 추가한 순서대로 "B" 접두사를 붙여서 구분한다. 예를 들어 두 번째 영상 밴드는 "B2"로 수식에 사용하면 된다. 수식에 사용할 수 있는 토큰은 다음과 같다.

  • 숫자 : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • 연산자 : +, - *, /, <, >, <=, >=, ==, !=, ^
  • 함수 : sin, cos, tan, asin, acos, atan, exp, ln, log, sqrt, pow, inv

Examples
XBandParamMath의 ArrBandList에 추가한 밴드 중 첫번째 밴드(B1)의 화소값이 50보다 크면 0으로, 그렇지 않으면 B1 화소값을 반환하는 XDMBandMath 밴드를 생성하고 이를 파일로 저장하는 예제이다.
// IO initialize to load image file
XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
    return;
}

// Image load
String strFilePathLoad = "D:\\Sample\\RS_Sample\\Math\\etm.xdm";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);

// Set input param 
XBandParamMath InputParam = new XBandParamMath();

// Common
for (int i = 0; i < xrsFileInput.NumBand; i++)
{
    InputParam.ArrBandList.Add(xrsFileInput.GetBandAt(i));
}
InputParam.ExpressionIF = "B1 > 50";
InputParam.ExpressionELSE = "0";
InputParam.ExpressionTHEN = "B1";

// Create New process band and set input param
XDMBandMath bandProcess = new XDMBandMath();
bandProcess.BandName = xrsFileInput.FileName;
bandProcess.SetInputParam(ref InputParam);

// create XRSSaveFile to save realtime band(XDMBandXXXX)
// load another file to protect thread lock(it is stable and faster).
XRSSaveFile fileSave = new XRSSaveFile();
XDMBand bandCast = (XDMBand)bandProcess;
fileSave.AddBand(ref bandCast);

// Save output file
XThread thd = null;
String strFilePathSave = "D:\\Sample\\Out_Math.xdm";
if (!RasterIO.Export(ref fileSave, strFilePathSave, "XDM", out strError, thd))
{
    return;
}
See Also