-
Notifications
You must be signed in to change notification settings - Fork 37
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
Conversation
There was a problem hiding this 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.
src/highdicom/sc/sop.py
Outdated
@@ -367,3 +367,158 @@ def __init__( | |||
self.PixelData = encapsulate([encoded_frame]) | |||
else: | |||
self.PixelData = encoded_frame | |||
|
|||
@classmethod | |||
def from_study_dataset( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
* 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]>
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.