-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Optimize observer pattern in ctkDICOMScheduler
This commit addresses an efficiency issue in the implementation of the Observer pattern within the ctkDICOMScheduler and its associated UI widgets. The system had the potential to emit a large number of signals: The ctkDICOMScheduler functions as an intermediary between the UI and the underlying logic, tunneling all processing signals from the logic through itself. The UI components monitor the ctkDICOMScheduler to react to these signals. This leads to an O(N^2) complexity problem when dealing with many patients/studies/series. To mitigate this, several strategies have been implemented: 1. **Batching and Throttling**: Changes are now batched together and a throttling mechanism has been introduced. This mechanism delays the processing of changes, reducing the number of signals by waiting a certain amount of time since the last signal before sending a new one. This is particularly effective when changes often occur in bursts. 2. **Filtering**: A filtering mechanism has been added to the signals, allowing only relevant changes to be signaled to each observer. This is achieved by adding a parameter to the signals that specifies the type of changes the signal represents. 3. **Hierarchical Observers**: The hierarchical relationship of the observers has been leveraged to reduce the number of signals. Now, each object observes its nearest ancestor that has changed, rather than observing the ctkDICOMScheduler directly.
- Loading branch information
Showing
19 changed files
with
867 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.