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

ENH: Create roles instead of hard-coded DICOM display fields #963

Merged

Conversation

cpinter
Copy link
Member

@cpinter cpinter commented Apr 27, 2021

There are DICOM display fields that do not concern only one instance, but a higher level such as series (number of images), study (number of series), or patient (last study date, number of studies). These fields were calculated using hard-coded functions. Now these have their own role classes that do the necessary processing in their endUpdate functions.

Copy link
Member

@lassoan lassoan 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, this looks great. I've just added a couple of mostly trivial comments.

@cpinter cpinter force-pushed the roles-instead-of-hardcoded-display-fields branch from 65b8ad0 to 8d16d91 Compare April 27, 2021 18:56
@lassoan
Copy link
Member

lassoan commented Apr 27, 2021

Comment here if the code is ready for review (and remove "WIP" from the subject).

@cpinter cpinter force-pushed the roles-instead-of-hardcoded-display-fields branch from 8d16d91 to da49319 Compare April 28, 2021 10:41
@cpinter cpinter changed the title ENH: Create roles instead of hard-coded DICOM display fields !WIP! ENH: Create roles instead of hard-coded DICOM display fields Apr 28, 2021
@cpinter
Copy link
Member Author

cpinter commented Apr 28, 2021

I wanted to do some more extensive testing first. Everything seems good, so if you agree then it's ready to be merged.

@cpinter
Copy link
Member Author

cpinter commented Apr 28, 2021

One thing I am still thinking about is the best way to update the displayed fields after removing entries from the database.

I created a ticket for it where we can discuss this:
#964

This work is not in the scope of this PR, I was just thinking ahead because now I have a pretty good understanding about how these displayed fields work, and when I get to doing the update on removal it will be old memory.

Copy link
Member

@lassoan lassoan left a comment

Choose a reason for hiding this comment

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

Fix the typo in the commit message (roles->rules). I've also added a few trivial comments. After these are fixed it is ready to be merged.

@@ -3070,7 +2970,8 @@ void ctkDICOMDatabase::updateDisplayedFields()
Q_D(ctkDICOMDatabase);

// Get the files for which the displayed fields have not been created yet (DisplayedFieldsUpdatedTimestamp is NULL)
//TODO: handle cases when the values actually changed; now we only cover insertion and schema update
// Note: The per-instance update only covers insertion and schema update. If fields on the series/study/patient level need to be
// updated on the insertion of a new instance, then it can be handled using the startUpdate/endUpdate functions of the roles.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// updated on the insertion of a new instance, then it can be handled using the startUpdate/endUpdate functions of the roles.
// updated on the insertion of a new instance, then it can be handled using the startUpdate/endUpdate functions of the rules.

Copy link
Member Author

Choose a reason for hiding this comment

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

Apparently I made this mistake at many places, including the branch name and commit message. I fixed them all except for the branch name.

Libs/DICOM/Core/ctkDICOMDatabase.h Outdated Show resolved Hide resolved
ctkDICOMDatabase* DICOMDatabase;
};
#endif
Copy link
Member

Choose a reason for hiding this comment

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

why all the lines are marked as changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure why line endings in some files are converted to Windows style. Thanks for noticing.

There are DICOM display fields that do not concern only one instance, but a higher level such as series (number of images), study (number of series), or patient (last study date, number of studies). These fields were calculated using hard-coded functions. Now these have their own rule classes that do the necessary processing in their endUpdate functions.
@cpinter cpinter force-pushed the roles-instead-of-hardcoded-display-fields branch from da49319 to be87628 Compare April 29, 2021 07:47
@cpinter
Copy link
Member Author

cpinter commented Apr 29, 2021

I made the changes. Please merge if there is nothing else. Thank you!

@lassoan lassoan merged commit 88d954f into commontk:master Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants