deid icon indicating copy to clipboard operation
deid copied to clipboard

fix: upgrade to pydicom 3

Open sammaxwellxyz opened this issue 1 year ago • 3 comments

Description

Related issues: #266 https://github.com/pydicom/deid/issues/266

Please include a summary of the change(s) and if relevant, any related issues above. update read_file to dcmread as per suggestion from pydicom 3 release notes https://github.com/pydicom/pydicom/releases/tag/v3.0.0

I couldn't tell if the other changes would cause external breaking changes.

I've run no testing

Checklist

  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] My changes generate no new warnings
  • [x] My code follows the style guidelines of this project

Open questions

Questions that require more discussion or to be addressed in future development: The approach as here https://github.com/pydicom/deid/pull/267/files may be worthwhile as well to avoid a similar case in the future

sammaxwellxyz avatar Oct 01 '24 21:10 sammaxwellxyz

Tiny conflict and then ready to test!

vsoch avatar Oct 02 '24 16:10 vsoch

Was there possibly a change with private fields?

######################END########################
.............................WARNING Empty values list encountered.  No fields will be identified.
WARNING Empty values list encountered.  No fields will be identified.
.................................
======================================================================
FAIL: test_fieldset_remove_private (test_replace_identifiers.TestDicom.test_fieldset_remove_private)
%fields field_set2_private
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/deid/deid/deid/tests/test_replace_identifiers.py", line 518, in test_fieldset_remove_private
    self.assertTrue("(0009, 0010)" in parser.lookup["field_set2_private"])
AssertionError: False is not true

vsoch avatar Oct 02 '24 17:10 vsoch

another idea is to have a set of helper scripts - not integrated into the main client, but optional to install (and support this extra functionality).

vsoch avatar Oct 02 '24 17:10 vsoch

Is it possible to get deid supporting pydicom v3 please?

howff avatar Jan 27 '25 11:01 howff

Why are the requirements changed like this?

"numpy>=1.20,<2.0" - why is numpy now restricted to <2? pydicom itself works with numpy>=2. Please can this be removed?

"matplotlib<4.0" - just wondering why? "python-dateutil<3.0" - just wondering why?

howff avatar Jan 27 '25 13:01 howff

What you can do is remove or change the pins and then run tests, and fix any issues that arise.

vsoch avatar Jan 27 '25 16:01 vsoch

Ok, I can't add commits to someone else's branch, but I can confirm the tests pass with numpy v2

after making the required changes:

  • deid/version.py
    • change to "numpy>=1.20",
  • tests/test_replace_identifiers.py
    • remove spaces from tags strings, so "(0009, 0010)" becomes "(0009,0010)"
    • and same for "(0010, 0020)" becomes "(0010,0020)"

howff avatar Jan 27 '25 17:01 howff

@sammaxwellxyz are you able and willing to update the PR with those changes?

vsoch avatar Jan 27 '25 20:01 vsoch

Hey,

@howff you should be able to fork off my branch to add your own commits and then raise a new PR from that.

are you able and willing to update the PR with those changes?

@vsoch willing, but won't be able to get to it for a while

sammaxwellxyz avatar Jan 29 '25 11:01 sammaxwellxyz

Thanks @sammaxwellxyz, either of those options work for me. @howff, you can fork and PR if you want this change imminently. Otherwise, we can wait for @sammaxwellxyz to finish the work here.

vsoch avatar Jan 29 '25 15:01 vsoch

Thank you for this work @sammaxwellxyz - I have finished up the PR in #273 with a slightly different design to import the pydicom.dcrmread in one place that can be edited in the future. Please let me know if you run into any issues, and have a good weekend!

vsoch avatar Jan 31 '25 14:01 vsoch