feat: OHIF-1000: Study prefetcher (#2466)

* Enable study prefetcher and expose configs

* Fix progress for all images

* Enable study loading listener

* Add new default for displaying progress bar for series

* Use events instead of redux to improve performance

* Add documentation, resolve issues with different datasets

* CR Updates

* CR Updates

* CR Updates & Resolve issue when activating both stack and study prefetch

* Add upward and update display set logic

* Add new behavior to prefetching orders

* Rollback display set check and activate cache check

* Remove prefetch check

* Check if displayset has images

* Debounce check cache events

* Remove usued debounce flags

* Ignore prefetching same image

* Use new image instead of image rendered

* Continue prefetch after cache check

* Update prefetch logic after checking cache

* Remove log

* Update displayset count default to 3

* Update netlify config

Co-authored-by: Alireza <ar.sedghi@gmail.com>
This commit is contained in:
Igor OctavianoandAlireza authored and GitHub committed 2021-09-09 09:58:24 +02:00
1 parent ea0963d75f
commit 8f2604509d
26 files changed
+970 -384

No files matched your search

@@ -1,42 +1,23 @@
import { Component } from "react";
import PropTypes from "prop-types";
import OHIF from "@ohif/core";
import { useEffect } from 'react';
import OHIF from '@ohif/core';
class StudyLoadingMonitor extends Component {
static propTypes = {
studies: PropTypes.array.isRequired,
setStudyLoadingProgress: PropTypes.func.isRequired,
clearStudyLoadingProgress: PropTypes.func.isRequired
};
const { StudyLoadingListener } = OHIF.classes;
componentDidMount() {
// TODO: This is pretty ugly. The thing is that the StudyLoadingListener
// needs to update the Redux store, but shouldn't know that it exists.
// I am therefore passing in some functions to update the store instead,
// but this should definitely be cleaned up somehow.
const options = {
_setProgressData: (progressId, progressData) => {
this.props.setStudyLoadingProgress(progressId, progressData);
},
_clearProgressById: progressId => {
this.props.clearStudyLoadingProgress(progressId);
}
const StudyLoadingMonitor = ({ studies }) => {
useEffect(() => {
const studyLoadingListener = StudyLoadingListener.getInstance();
if (studies && studies.length > 0) {
studyLoadingListener.clear();
studyLoadingListener.addStudies(studies);
}
return () => {
studyLoadingListener.clear();
};
}, [studies]);
const { StudyLoadingListener } = OHIF.classes;
this.studyLoadingListener = StudyLoadingListener.getInstance(options);
this.studyLoadingListener.clear();
this.studyLoadingListener.addStudies(this.props.studies);
}
render() {
return null;
}
componentWillUnmount() {
// Destroy stack loading listeners when we close the viewer
this.studyLoadingListener.clear();
}
}
return null;
};
export default StudyLoadingMonitor;