本文整理汇总了C#中DicomUncompressedPixelData.SetFrame方法的典型用法代码示例。如果您正苦于以下问题:C# DicomUncompressedPixelData.SetFrame方法的具体用法?C# DicomUncompressedPixelData.SetFrame怎么用?C# DicomUncompressedPixelData.SetFrame使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DicomUncompressedPixelData
的用法示例。
在下文中一共展示了DicomUncompressedPixelData.SetFrame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAdvanced_FileOnDisk_16Bits_OW
public void TestAdvanced_FileOnDisk_16Bits_OW()
{
var filename = Path.GetTempFileName();
CreateDicomImage(rows : 20, columns : 30, numberOfFrames : 5).Save(filename);
var dcf = new DicomFile(filename);
dcf.Load(DicomReadOptions.StorePixelDataReferences);
try
{
var pd = new DicomUncompressedPixelData(dcf);
Assert.AreEqual(16, pd.BitsAllocated, "BitsAllocated");
Assert.AreEqual(16, pd.BitsStored, "BitsStored");
Assert.AreEqual(15, pd.HighBit, "HighBit");
Assert.AreEqual(20, pd.ImageHeight, "ImageHeight");
Assert.AreEqual(30, pd.ImageWidth, "ImageWidth");
Assert.AreEqual(5, pd.NumberOfFrames, "NumberOfFrames");
Assert.AreEqual("MONOCHROME2", pd.PhotometricInterpretation, "PhotometricInterpretation");
Assert.AreEqual(0, pd.PixelRepresentation, "PixelRepresentation");
Assert.AreEqual(1, pd.SamplesPerPixel, "SamplesPerPixel");
Assert.AreEqual(20*30*2, pd.UncompressedFrameSize, "UncompressedFrameSize");
var newFrameData = new byte[pd.UncompressedFrameSize];
for (var n = 0; n < newFrameData.Length; ++n)
newFrameData[n] = 0x7F;
pd.SetFrame(1, newFrameData);
pd.UpdateAttributeCollection(dcf.DataSet);
var pixelData = dcf.DataSet[DicomTags.PixelData].Values as byte[];
for (var frame = 0; frame < 5; ++frame)
{
var fd = pd.GetFrame(frame);
var expectedValue = frame == 1 ? (byte) 0x7F : (byte) (0x80 + frame);
Assert.AreEqual(pd.UncompressedFrameSize, fd.Length, "PixelData(frame={0}).Length", frame);
AssertBytesEqual(expectedValue, fd, "PixelData(frame={0})", frame);
AssertBytesEqual(expectedValue, pixelData, frame*pd.UncompressedFrameSize, pd.UncompressedFrameSize, "AttributeValues(frame={0})", frame);
}
}
finally
{
File.Delete(filename);
}
}