[英]Manipulating and Converting PixelData of CT Image with fo-dicom in C#
[英]Getting PixelData of Multiframe (PaletteColor) Dicom File. fo-dicom
目前,当我从这个 dicom 文件中获取像素数据时,它似乎与提供的图像分辨率不匹配。
例如,图像的宽度和高度可能是:W: 600, H:430 这会让我认为预期的总大小是 258,000 个元素,但是当我得到像素数据时它只有 50104 个元素。
令我困惑的是,数组中的元素比文件分辨率少。 我期待如果存在不匹配,这可能是因为所有帧都被分组到同一个缓冲区中,我可能需要按帧数细分像素数据,但没有足够的元素来覆盖图像解析度? 我有点不知所措。
该 class 提供了 dicom 文件像素数据:
https://fo-dicom.github.io/html/cfa9fe02-c413-ea1f-52df-dd1a6f5b71cf.htm
其中每个像素都是一个字节,用于查找颜色查找表的索引。
代码示例
protected override byte[] GetPixelDataInternal(GrayscalePixelDataU8 pixelData, DicomDataset dicomDataset)
{
long totalDimensions = pixelData.Width * pixelData.Height;
DicomPixelData header = DicomPixelData.Create(dicomDataset);
// These uncompressed framesize matches total dimensions
Debug.Log($"Uncompressed Frame Size: {header.UncompressedFrameSize}");
Debug.Log($"GetPixelDataInternal: {pixelData.Width} x {pixelData.Height} Total: {totalDimensions}");
// pixelData.Data.Length does not match total length
Debug.Log($"PixelDataLength: {pixelData.Data.Length} ");
// It says it is not lossy.
Debug.Log($"IsLossy: {header.IsLossy}");
// ...
}
期望的行为
使用 fo-dicom 库打开和渲染具有光度解释 PaletteColor 的多帧 dicom 图像。
结果确实是因为 Transfer Syntax 是RLELossless
,并且需要对数据进行解码。
请参阅 fo-dicom 的DicomTranscoder
:
https://fo-dicom.github.io/html/f94d5b29-c69f-c0c7-6443-1b001cfc91ec.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.