pydicom.filebase.DicomIO

class pydicom.filebase.DicomIO(*args: Any, **kwargs: Any)[source]

File object which holds transfer syntax info and anything else we need.

__init__(*args: Any, **kwargs: Any) None[source]

Methods

__init__(*args, **kwargs)

read([length, need_exact_length])

Reads the required length, returns EOFError if gets less

read_beUL()

Return an unsigned long read with big endian byte order

read_beUS()

Return an unsigned short from the file with big endian byte order

read_be_tag()

Read and return two unsigned shorts (big endian) from the file.

read_leUL()

Return an unsigned long read with little endian byte order

read_leUS()

Return an unsigned short from the file with little endian byte order

read_le_tag()

Read and return two unsigned shorts (little endian) from the file.

write_UL(val)

Write an unsigned long with little endian byte order

write_US(val)

Write an unsigned short with little endian byte order

write_beUL(val)

Write an unsigned long with big endian byte order

write_beUS(val)

Write an unsigned short with big endian byte order

write_leUL(val)

Write an unsigned long with little endian byte order

write_leUS(val)

Write an unsigned short with little endian byte order

write_tag(tag)

Write a dicom tag (two unsigned shorts) to the file.

Attributes

defer_size

is_implicit_VR

is_little_endian

max_read_attempts

read(length: int | None = None, need_exact_length: bool = False) bytes[source]

Reads the required length, returns EOFError if gets less

If length is None, then read all bytes

read_beUL() int[source]

Return an unsigned long read with big endian byte order

read_beUS() int[source]

Return an unsigned short from the file with big endian byte order

read_be_tag() Tuple[int, int][source]

Read and return two unsigned shorts (big endian) from the file.

read_leUL() int[source]

Return an unsigned long read with little endian byte order

read_leUS() int[source]

Return an unsigned short from the file with little endian byte order

read_le_tag() Tuple[int, int][source]

Read and return two unsigned shorts (little endian) from the file.

write_UL(val: int) None[source]

Write an unsigned long with little endian byte order

write_US(val: int) None[source]

Write an unsigned short with little endian byte order

write_beUL(val: int) None[source]

Write an unsigned long with big endian byte order

write_beUS(val: int) None[source]

Write an unsigned short with big endian byte order

write_leUL(val: int) None[source]

Write an unsigned long with little endian byte order

write_leUS(val: int) None[source]

Write an unsigned short with little endian byte order

write_tag(tag: int | str | Tuple[int, int] | BaseTag) None[source]

Write a dicom tag (two unsigned shorts) to the file.