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