View in #cornerstone3d on Slack
@Julian_Linares: Does anyone know when/where is Cornerstone3D.Enums.Events.IMAGE_RETRIEVAL_STAGE
event supposed to be triggered? I’m trying to use it to implement a load progress bar but it doesn’t seem to be triggered
I’ve already tried with Cornerstone3D.eventTarget
and the viewport element
@Peter_Newhook: Generally, I think the events trigger on the viewport element. Looking at the only place that event fires, seems like it only happens when there are pending images? https://github.com/cornerstonejs/cornerstone3D/blob/b922cdc85eba1e60b7a7bb6cb7d730[…]21aefcbe/packages/core/src/loaders/ProgressiveRetrieveImages.ts
<cornerstone3D/packages/core/src/loaders/ProgressiveRetrieveImages.ts at b922cdc85eba1e60b7a7bb6cb7d7309921aefcbe · cornerstonejs/cornerstone3D · GitHub | ProgressiveRetrieveImages.ts>
@Julian_Linares: It really depends on the event, CORNERSTONE_IMAGE_LOADED
for example, is fired in EventTarget so I figured this one would be as well but I ended up with the conclusion that it is only for “progressive loading” which im not really working with
@Syed_Pasha: Are you saying CORNERSTONE_IMAGE_LOADED
does not work for you?
@Julian_Linares: No, CORNERSTONE_IMAGE_LOADED
works perfectly, I was using it as an example
@Syed_Pasha: got it. that was the same event i used to track progress.
you’re trying to achieve the same behvaiour but using IMAGE_RETRIEVAL_STAGE
instead?
@Julian_Linares: I can already track the amount of images loaded in a stack/series but I have some heavy single image series and I want to track the load progress of the individual image being loaded. On previous versions of cornerstone there was a perfect event for this called 'cornerstoneimageloadprogress'
but now I cant seem to find one that does the same
@Syed_Pasha: yes. that event used to inform how much an image has been loaded. i thought the newer event does the same. maybe i’m wrong then.
well if you want to support/create a new event that does this sort of thing, you may visit the dicomImageLoader repo, find the xhrRequest file and see if there is an event emitter there and if not, add it.
@Julian_Linares: Yes I found out that you can use the onprogress function of the cornerstoneDICOMImageLoader to handle load progress, problem is it is always returning a total of 0
const loaderConfig = {
onprogress: (event, params) => {
const progress = event.loaded;
const total = event.total;
console.log(progress);
},
}
cornerstoneDICOMImageLoader.init(loaderConfig);
It might be an issue related to decodeImageFrameWorker.worker.js being instanced differently than in the source code because I previously had issues with this and the framework im using. Thought maybe there was a cornerstone event to go around it
@Syed_Pasha: dicomImageLoader - xhrRequests - onprogress
this is the place where your onprogress is called. maybe you can add an event here and debug what’s going wrong.
> It might be an issue related to decodeImageFrameWorker.worker.js being instanced differently than in the source code because I previously had issues with this and the framework im using. Thought maybe there was a cornerstone event to go around it (edited)
understood. even if cornerstone had to emit an event, it will be in the function that i linked.
here is the code from the older, depricated cornerstoneWadoImageLoader. notice how there’s an event being emitted by cornerstone. this is missed in the newer dicomImageLoader.
@Alireza_Sedghi do you know why the load progress event is removed in the xhrRequests file of dicomImageLoader?
@Julian_Linares: This helped a lot, thank you!
I’ll try to figure out why is it providing a total of 0
@Alireza_Sedghi: I don’t remember it ever worked