dicomioexception:requested bytes past end of fixed length stream.

Source: Internet
Author: User

today, when using the Dicomfile.open (Stream s) interface, an exception is encountered:dicomioexception:requested bytes past end of fixed length stream.
For detailed reasons we look at the source code very clearly: public bool Require (UINT count, Bytesourcecallback callback, object state) {Lock (_lock) {if (_stream. Length-_stream. Position) >= count) return true;
throw new Dicomioexception ("requested {0} bytes past end of fixed length stream.", count);}}
The position of the stream at that time is at the end of the stream, that is, Length-position equals 0, and therefore throws this exception.

The solution is very easy: first position the stream to the beginning of the dicom.

Similar codes such as the following: var stream = new MemoryStream ();                using (var f = File.Open (@ "1.2.156.112605.75006881735343.1369658682.4.4.1.DCM", FileMode.Open)) {            F.copyto (stream); } stream.            Seek (0, Seekorigin.begin); var df = Dicom.DicomFile.Open (stream);

dicomioexception:requested bytes past end of fixed length stream.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.