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

Alternative SCImage Constructor #97

Merged
merged 3 commits into from
Aug 10, 2021
Merged

Conversation

CPBridge
Copy link
Collaborator

@CPBridge CPBridge commented Aug 7, 2021

The current constructor for the SCImage requires several pieces of patient or study related metadata. Often in practice, this information is simply copied from another dataset in the study in user code, but this process is annoying and verbose. I have now done this in several places personally.

This PR introduces a new alternative constructor for SCImage called from_study_dataset (open to other suggestions for the name), that accepts another dataset from the study and copies the patient and study related metadata from there. This should make user code more concise and less error prone for this very common situation. Also added tests.

@CPBridge CPBridge requested a review from hackermd August 7, 2021 03:29
@CPBridge CPBridge changed the base branch from master to dev August 7, 2021 03:30
Copy link
Collaborator

@hackermd hackermd left a comment

Choose a reason for hiding this comment

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

Nice! That's handy. Just one comment regarding the name of the method and its parameter.

@@ -367,3 +367,158 @@ def __init__(
self.PixelData = encapsulate([encoded_frame])
else:
self.PixelData = encoded_frame

@classmethod
def from_study_dataset(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I find the name study_dataset confusing, since a data set encodes an instance. Can we call it reference_dataset or ref_dataset instead?

Copy link
Collaborator Author

@CPBridge CPBridge Aug 10, 2021

Choose a reason for hiding this comment

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

Totally agree. I knew study_dataset wasn't great but was drawing a blank on something better and was hoping you could suggest one. Thanks! Changed the method and its parameter to ref_dataset as suggested in 5cce71d.

@hackermd hackermd added the enhancement New feature or request label Aug 9, 2021
@hackermd hackermd merged commit f26656b into dev Aug 10, 2021
@hackermd hackermd deleted the feat/alternative_sc_constructor branch August 10, 2021 01:06
hackermd added a commit that referenced this pull request Aug 31, 2021
* Integrate new pydicom DS formatting

* Fix recording of evidence in structured reports

* Fix mypy errors

* Add test for report referencing multiple studies

* Add properties to content items

* Use datetime workaround for python 3.6 support

* Add properties and methods on SR templates

* Update type of content item property return value

* Fix typo in exception message

* Fix recording of evidence in structured reports

* Update package version

* Add image library entries to SR documents (#77)

* Fixed enum RelationshipType

* Fix handling of library entry descriptors

* Fix default value for Pixel Origin Interpretation

* Implement indexing by dimension index values

* Rename tracking id methods

* Add check for correct segment numbers

* Fix implementation of content property on SR documents

* Make value and unit required for NUM content items

* Fix return value type of properties of NUM content item

* Add qualifier property to NUM content item

* Return uids of type UID instead of str

* Simplify reshaping of graphic data array

* Add is_root parameter to alternative constructor

* Allow constructor of UID to accept a value

* Chang Optional[x] -> Union[x, None] in docstrings

* Log warning if wrong number of content items

* Add property for temporal range type

* Move QualitativeEvaluation from content to templates

* Allow Concept Name Code Sequence to be absent

* Require Concept Name Code Sequence for CONTAINER

* Let pydicom handle encapsulated frame decoding

* Write error traceback to stderr instead of stdout

* Add docstrings for enums

* Implementation of Parametric Map IOD (#89)

* Changed PatientSexValues to single letters

* Expose enum at package root

* Remove sphinx duplication for highdicom.enum

* Alternative SCImage Constructor (#97)

* Only warn if patient name check fails

Co-authored-by: hackermd <[email protected]>
Co-authored-by: Christopher Bridge <[email protected]>
Co-authored-by: Sean Doyle <[email protected]>
Co-authored-by: Sean Doyle <[email protected]>
Co-authored-by: Markus D. Herrmann <[email protected]>
Co-authored-by: Chris Gorman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants