in src/components/viewer.js [186:232]
getInstances() {
// Reset metrics
this.newSequence = true;
this.renderedImagesCount = 0;
this.readyImages = [];
this.readyImagesCount = 0;
this.fetchStartTime = Date.now();
this.setState({
renderTimer: 0,
totalTimer: 0,
fetchTimer: 0,
numReadyImages: 0,
readyImagesProgress: 0,
numRenderedImages: 0,
renderedImagesProgress: 0,
timeToFirstImage: 0,
isDisplaying: true,
});
// Set up an interval for updating metrics (10 times per second)
this.metricsIntervalId = setInterval(() => this.updateMetrics(), 100);
// Create a cancelable promise to allow this request to be cancelled
// if the component is unmounted
this.getInstancesPromise = api.makeCancelable(
api.fetchMetadata(
this.props.project, this.props.location,
this.props.dataset, this.props.dicomStore,
this.props.study[DICOM_TAGS.STUDY_UID].Value[0],
this.props.series[DICOM_TAGS.SERIES_UID].Value[0],
),
);
// Fetch instances and then start displaying
this.getInstancesPromise.promise
.then((instances) => {
this.setState({
instances,
});
this.startDisplayingInstances();
})
.catch((reason) => {
if (!reason.isCanceled) {
console.error(reason);
}
});
}