dicomio

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorInsufficientBytesLeft indicates there are not enough bytes left in
	// the current buffer (or enough bytes left until the currently set limit)
	// to complete the operation.
	ErrorInsufficientBytesLeft = errors.New("not enough bytes left until buffer limit to complete this operation")
)

Functions

This section is empty.

Types

type Reader

type Reader interface {
	io.Reader
	// ReadUInt8 reads a uint16 from the underlying reader.
	ReadUInt8() (uint8, error)
	// ReadUInt16 reads a uint16 from the underlying reader.
	ReadUInt16() (uint16, error)
	// ReadUInt32 reads a uint32 from the underlying reader.
	ReadUInt32() (uint32, error)
	// ReadInt16 reads a int16 from the underlying reader.
	ReadInt16() (int16, error)
	// ReadInt32 reads a int32 from the underlying reader.
	ReadInt32() (int32, error)
	// ReadFloat32 reads a float32 from the underlying reader.
	ReadFloat32() (float32, error)
	// ReadFloat64 reads a float32 from the underlying reader.
	ReadFloat64() (float64, error)
	// ReadString reads an n byte string from the underlying reader.
	// Uses the charset.CodingSystem encoding decoders to read the string, if
	// set.
	ReadString(n uint32) (string, error)
	// Skip skips the reader ahead by n bytes.
	Skip(n int64) error
	// Peek returns the next n bytes without advancing the reader. This will
	// return bufio.ErrBufferFull if the buffer is full.
	Peek(n int) ([]byte, error)
	// PushLimit sets a read limit of n bytes from the current position of the
	// reader. Once the limit is reached, IsLimitExhausted will return true, and
	// other attempts to read data from dicomio.Reader will return io.EOF.
	PushLimit(n int64) error
	// PopLimit removes the most recent limit set, and restores the limit before
	// that one.
	PopLimit()
	// IsLimitExhausted indicates whether or not we have read up to the
	// currently set limit position.
	IsLimitExhausted() bool
	// BytesLeftUntilLimit returns the number of bytes remaining until we reach
	// the currently set limit position.
	BytesLeftUntilLimit() int64
	// SetTransferSyntax sets the byte order and whether the current transfer
	// syntax is implicit or not.
	SetTransferSyntax(bo binary.ByteOrder, implicit bool)
	// IsImplicit returns if the currently set transfer syntax on this Reader is
	// implicit or not.
	IsImplicit() bool
	// SetCodingSystem sets the charset.CodingSystem to be used when ReadString
	// is called.
	SetCodingSystem(cs charset.CodingSystem)
	ByteOrder() binary.ByteOrder
}

Reader provides common functionality for reading underlying DICOM data.

func NewReader

func NewReader(in *bufio.Reader, bo binary.ByteOrder, limit int64) Reader

NewReader creates and returns a new dicomio.Reader.

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

Writer is a lower level encoder that manages writing out entities to an io.Reader.

func NewWriter

func NewWriter(out io.Writer, bo binary.ByteOrder, implicit bool) Writer

NewWriter initializes and returns a Writer.

func (*Writer) GetTransferSyntax

func (w *Writer) GetTransferSyntax() (binary.ByteOrder, bool)

GetTransferSyntax gets the current transfer syntax of this Writer.

func (*Writer) SetTransferSyntax

func (w *Writer) SetTransferSyntax(bo binary.ByteOrder, implicit bool)

SetTransferSyntax sets the current transfer syntax of this Writer.

func (*Writer) WriteByte

func (w *Writer) WriteByte(v byte) error

WriteByte writes the provided byte to the Writer.

func (*Writer) WriteBytes

func (w *Writer) WriteBytes(v []byte) error

WriteBytes writes the provided byte slice to the Writer.

func (*Writer) WriteFloat32

func (w *Writer) WriteFloat32(v float32) error

WriteFloat32 writes the provided float32 to the Writer.

func (*Writer) WriteFloat64

func (w *Writer) WriteFloat64(v float64) error

WriteFloat64 writes the provided float64 to the Writer.

func (*Writer) WriteString

func (w *Writer) WriteString(v string) error

WriteString writes the provided string to the Writer.

func (*Writer) WriteUInt16

func (w *Writer) WriteUInt16(v uint16) error

WriteUInt16 writes the provided uint16 to the Writer.

func (*Writer) WriteUInt32

func (w *Writer) WriteUInt32(v uint32) error

WriteUInt32 writes the provided uint32 to the Writer.

func (*Writer) WriteZeros

func (w *Writer) WriteZeros(len int) error

WriteZeros writes len bytes of zeros at the current position of the Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL