Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with pydicom v3 #272

Closed
wants to merge 16 commits into from
Closed

Compatible with pydicom v3 #272

wants to merge 16 commits into from

Conversation

howff
Copy link
Contributor

@howff howff commented Jan 29, 2025

Description

Related issues: #266

Finishing off PR #268

Checklist

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

Open questions

Questions that require more discussion or to be addressed in future development:

@vsoch
Copy link
Member

vsoch commented Jan 29, 2025

This looks great! One design suggestion that I think will make this hugely easier - we can add a function to utils that basically returns the pydicom read_file / dcmread function, and that way if/when the way to read dicom changes (it has changed multiple times over the years) we can change just one spot. What do you think?

@howff
Copy link
Contributor Author

howff commented Jan 29, 2025

Just a couple of thoughts:

  1. I don't think this PR needs to wait for any changes to pydicom, it's a simple change and without it deployment is severely hindered
  2. In general I agree with having some abstraction to hide details which might change but in this case I think it's better if pydicom can not keep changing its API now that it's at v3, is mature, and is heavily used

@vsoch
Copy link
Member

vsoch commented Jan 29, 2025

I don't think this PR needs to wait for any changes to pydicom, it's a simple change and without it deployment is severely hindered

I am not saying changes to pydicom, I'm saying that in some utils.py you'd have:

def dcmread(filename)
    return pydicom.dcrmread(filename)

And then across the code base:

import deid.utils as utils

dcm = utils.dcmread(filename)

And then if there is a change to pydicom (which there has been several times already for this specific function) we are changing one place instead of 200. Does that make sense?

@howff
Copy link
Contributor Author

howff commented Jan 30, 2025

As primary owner/maintainer I will let you decide on changes such as that. I just wanted to get the fix for v3 across the line!

@vsoch
Copy link
Member

vsoch commented Jan 30, 2025

@howff I think that would be the better design. Would you have time to work on this?

@howff
Copy link
Contributor Author

howff commented Jan 30, 2025

I would prefer to keep this PR for a bug fix and use a different PR for a feature request, but since you asked so nicely and deid really needs to be fixed asap I've made the requested changes.

abrooks added 2 commits January 30, 2025 22:39
to prevent circular import
to prevent circular import
Copy link
Member

@vsoch vsoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

CHANGELOG.md Outdated Show resolved Hide resolved
__copyright__ = "Copyright 2025, Andrew Brooks"
__license__ = "MIT"

import pydicom
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this as a function to the utils.py file:

https://github.com/pydicom/deid/blob/1a0ef4480bf958966f1fd9d153247664dd0fc169/deid/dicom/utils.py

Then for use you can do:

import deid.dicom.utils as utils
dcm = utils.dcmread(filename)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It didn't work, circular reference

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we did:

utils/
__init__.py 
fileio.py
dcmread.py

To avoid the circular reference? The basic idea is around organization - we want dcmread to clearly be in a utils module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a maintainer I review for functionality and design, with an eye for looking forward. I gave you my feedback and design suggestions, which did not have any bug. The only problem here is this comment. Please try to follow the code of conduct moving forward.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done everything which you asked me to do, but this PR has been closed without being merged. Can you confirm that you've done everything which this PR did, but in your own PR, so that I know whether to delete this branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vsoch Please excuse my frustration. The fix only required

  • deleting two space characters
  • deleting ,<2

but I spent two days doing the extra work (and my wife complained because I was still working on it after 11pm). I am glad that you managed to achieve everything yourself in about 20 minutes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For transparency, this is the comment I responded to above (that you deleted).

image

I was respectful in my interactions, kind, and always asked for your thoughts and if you had time to work on it. I'm sorry for your frustration - I hope you find strategies to respond to review that don't lead to that in the future.

@vsoch vsoch closed this Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants