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

fix(dcmjs): Add a set of accessors to the sequence list so the API is more consistent #224

Merged
merged 2 commits into from
Oct 25, 2021

Conversation

wayfarer3130
Copy link
Contributor

@wayfarer3130 wayfarer3130 commented Oct 15, 2021

This is another attempt to make the naturalize data objects more consistent. This change minimally affects the API, but makes it possible to consistently be accessed, rather than having the naturalize/denaturalize produce inconsistent results.
There are no circular reference here. The change makes sequence objects remain lists, but adds an accessor so that child properties can consistently be accessed on the top level object. That is, suppose the per frame groups is a sequence with 1 element, then:

const seq = elements.PerFrameFunctionalGroupsSequence
expect(seq.length).to.equal(1)
Object.keys(seq[0]).forEach( key => expect(seq[key]).to.equal(seq[0][key]);

Also, if you modify any existing key of seq[0], it will be reflected in seq, and vice-versa. however, adding a key to seq[0] will not automatically add it to seq or vice-versa.

Copy link
Collaborator

@pieper pieper left a comment

Choose a reason for hiding this comment

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

thanks for putting this together. I think you and Rudolfo are both at Radical, right? Did you confirm with him that this approach will address the issues he had before?

src/DicomMetaDictionary.js Show resolved Hide resolved
@ladeirarodolfo
Copy link
Contributor

Thanks for the implementation much better :D. I have added only some minor inputs

src/DicomMetaDictionary.js Show resolved Hide resolved
src/utilities/addAccessors.js Show resolved Hide resolved
@wayfarer3130
Copy link
Contributor Author

@pieper - Rodolfo and I are agreed on this one, as he state, so is this one ready to go in now? Fixes a number of related bugs in OHIF, so I'm hoping to get it in soon.

@pieper
Copy link
Collaborator

pieper commented Oct 25, 2021

LGTM - thanks for working through all this. 👍

@pieper pieper merged commit 70b2433 into dcmjs-org:master Oct 25, 2021
@ohif-bot
Copy link
Collaborator

🎉 This PR is included in version 0.18.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants