using System; namespace UltrasoundImageDenoiseCSLib { /// /// 裸图像 /// public class RawImage { /// /// 数据区,长度=Width*Height*Channel /// 一行数据的末尾没有填充值(补齐4字节),直接是所有点的各通道像素值 /// public byte[] DataBuffer { get; set; } /// /// 图像宽度 /// public int Width { get; set; } /// /// 图像高度 /// public int Height { get; set; } /// /// 图像通道数 /// public int Channel { get; set; } /// /// 构造函数 /// public RawImage() { DataBuffer = null; Width = 0; Height = 0; Channel = 0; } /// /// 构造函数 /// /// /// /// /// public RawImage(byte[] data, int width, int height, int channel) { DataBuffer = data; Width = width; Height = height; Channel = channel; } /// /// 销毁 /// C#中byte[]数组不需要专门手动dispose /// 这里保留Dispose是为了避免后面RawImage不再用byte[]时,不用再各处再增加dispose的代码 /// public void Dispose() { if (DataBuffer != null) { Array.Clear(DataBuffer, 0, DataBuffer.Length); DataBuffer = null; } Width = 0; Height = 0; Channel = 0; } } }