本文整理汇总了C#中EvilDICOM.Core.IO.Reading.DICOMBinaryReader.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# DICOMBinaryReader.Reset方法的具体用法?C# DICOMBinaryReader.Reset怎么用?C# DICOMBinaryReader.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EvilDICOM.Core.IO.Reading.DICOMBinaryReader
的用法示例。
在下文中一共展示了DICOMBinaryReader.Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
/// <summary>
/// Reads the first 132 bits of a file to check if it contains the DICOM preamble.
/// </summary>
/// <param name="dr">a stream containing the bits of the file</param>
/// <returns>a boolean indicating whether or not the DICOM preamble was in the file</returns>
public static bool Read(DICOMBinaryReader dr)
{
byte[] preamble = new byte[132];
try
{
dr.ReadBytes(preamble, 0, 132);
}
catch (Exception)
{
throw new Exception("Could not read 128 null bit preamble. Perhaps file is too short");
}
if (preamble[128] != 'D' || preamble[129] != 'I' || preamble[130] != 'C' || preamble[131] != 'M')
{
Console.WriteLine("Missing characters D I C M in bits 128-131. Technically not a valid DICOM file. Will try to read anyway.");
dr.Reset();
return false;
}
else
{
return true;
}
}