pydicom.filereader.data_element_generator¶
-
pydicom.filereader.
data_element_generator
(fp, is_implicit_VR, is_little_endian, stop_when=None, defer_size=None, encoding='iso8859', specific_tags=None)¶ Create a generator to efficiently return the raw data elements.
Note
This function is used internally - usually there is no need to call it from user code. To read data from a DICOM file,
dcmread()
shall be used instead.Parameters: - fp (file-like) – The file-like to read from.
- is_implicit_VR (bool) –
True
if the data is encoded as implicit VR,False
otherwise. - is_little_endian (bool) –
True
if the data is encoded as little endian,False
otherwise. - stop_when (None, callable, optional) – If
None
(default), then the whole file is read. A callable which takes tag, VR, length, and returnsTrue
orFalse
. If it returnsTrue
,read_data_element
will just return. - defer_size (int, str, None, optional) – See
dcmread()
for parameter info. - encoding – Encoding scheme
- specific_tags (list or None) – See
dcmread()
for parameter info.
Returns: - VR (str or None) –
None
if implicit VR, otherwise the VR read from the file. - length (int) – The length of the DICOM data element (could be DICOM “undefined
length”
0xFFFFFFFFL
) - value_bytes (bytes or str) – The raw bytes from the DICOM file (not parsed into Python types)
- is_little_endian (bool) –
True
if transfer syntax is little endian; elseFalse
.