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.