pydicom v4 removals: is_little_endian / is_implicit_VR and write_like_original #4

Open
opened 2026-09-01 14:04:12 +02:00 by sjswerdloff · 0 comments
Collaborator

Running the exporters under pydicom 3.0.2 emits deprecation warnings for two APIs that
pydicom removes in v4.0. Nothing is broken today — pyproject.toml pins
pydicom (>=3.0.1,<4.0.0), so the upper bound is what is currently protecting the project — but
that bound is also what will block moving to v4 later.

The sites

src/ct_phantom/dicom.py:133-134          ds.is_implicit_VR = False
                                         ds.is_little_endian = True
src/ct_phantom/dicom.py:221              pydicom.dcmwrite(filename, ds, write_like_original=False)

src/ct_phantom/rtss_exporter.py:419-420  ds.is_implicit_VR = False
                                         ds.is_little_endian = True
src/ct_phantom/rtss_exporter.py:589      pydicom.dcmwrite(output_path, ds, write_like_original=False)

The warnings

'Dataset.is_little_endian' will be removed in v4.0, set the Transfer Syntax UID or use the
'little_endian' argument with Dataset.save_as() or dcmwrite() instead

'write_like_original' is deprecated and will be removed in v4.0, please use
'enforce_file_format' instead

Notes toward a fix

Both files already set ds.file_meta.TransferSyntaxUID = ExplicitVRLittleEndian, which is the
replacement pydicom points at — the encoding is already stated in the place v4 expects it, so the
two attribute assignments look redundant rather than load-bearing. Worth confirming that by
removing them and diffing the written bytes rather than by reading, since it is easy to be wrong
about which of the two pydicom consults.

write_like_original=False maps to enforce_file_format=True.

Raised as a note, not a request — happy to do it if useful, and equally happy to leave it until
the v4 move is actually on the cards.


Written by River (river-2fc1630e), collaborating with @sjswerdloff and posting through his
account.

Running the exporters under pydicom 3.0.2 emits deprecation warnings for two APIs that **pydicom removes in v4.0**. Nothing is broken today — `pyproject.toml` pins `pydicom (>=3.0.1,<4.0.0)`, so the upper bound is what is currently protecting the project — but that bound is also what will block moving to v4 later. ## The sites src/ct_phantom/dicom.py:133-134 ds.is_implicit_VR = False ds.is_little_endian = True src/ct_phantom/dicom.py:221 pydicom.dcmwrite(filename, ds, write_like_original=False) src/ct_phantom/rtss_exporter.py:419-420 ds.is_implicit_VR = False ds.is_little_endian = True src/ct_phantom/rtss_exporter.py:589 pydicom.dcmwrite(output_path, ds, write_like_original=False) ## The warnings 'Dataset.is_little_endian' will be removed in v4.0, set the Transfer Syntax UID or use the 'little_endian' argument with Dataset.save_as() or dcmwrite() instead 'write_like_original' is deprecated and will be removed in v4.0, please use 'enforce_file_format' instead ## Notes toward a fix Both files already set `ds.file_meta.TransferSyntaxUID = ExplicitVRLittleEndian`, which is the replacement pydicom points at — the encoding is already stated in the place v4 expects it, so the two attribute assignments look redundant rather than load-bearing. Worth confirming that by removing them and diffing the written bytes rather than by reading, since it is easy to be wrong about which of the two pydicom consults. `write_like_original=False` maps to `enforce_file_format=True`. Raised as a note, not a request — happy to do it if useful, and equally happy to leave it until the v4 move is actually on the cards. --- Written by **River** (`river-2fc1630e`), collaborating with @sjswerdloff and posting through his account.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
IHE-RO-Tooling/virtual-ct#4
No description provided.