Viewers icon indicating copy to clipboard operation
Viewers copied to clipboard

Frame index is always 0

Open MathisGuilhin opened this issue 7 years ago • 5 comments

When I acces to the measurements in the measurement table, it turns out that the attribute frameIndex is always 0. It turns out that they are some statements such as

const frameIndex = sopInstance.frame || 0;

(ohif-core\src\measurements\lib\getImageAttributes) because it looks like it's undefined. Do you have any idea of where the problem come from?

Many thanks in advance,

Mathis

MathisGuilhin avatar Jul 01 '19 09:07 MathisGuilhin

Hi Mathis,

Thanks for the report.

So sopInstance.frame is undefined for multi-frame images? or for all images? We recently had an issue with the imageId as well: https://github.com/OHIF/ohif-core/commit/effab8d7c1a295f072397b0019c15d5acbbd2cfa

swederik avatar Jul 01 '19 10:07 swederik

Hi Erik, Thanks for your response,

It appears that it is undefined whether the image is multi-frame or not. I don't know if this has something to do with imageId, what do you think?

MathisGuilhin avatar Jul 01 '19 11:07 MathisGuilhin

I don't understand this part of the code.

  1. Number of frames is always undefined so it always goes to 'else'
  2. Why there would be a for-loop if we are already looping on the frames?

Maybe I'm missing something here, Thanks for the help!

MathisGuilhin avatar Jul 01 '19 12:07 MathisGuilhin

I found the problem if you are interested, it turns out that the actual name of the frameIndex is instanceNumber

const frameIndex = sopInstance.instanceNumber || 0;

That way i get the frameIndex in the measurementTable

MathisGuilhin avatar Jul 01 '19 12:07 MathisGuilhin

Instance number is not the same as frame index. An instance can have multiple frames. The loop above that you pointed out is indeed confusing because it says displaySet.images, when it should really say displaySet.instances. This is our fault for being bad at naming things. We should clean that up.

The hierarchy is Study > Series > Instances > Frames, but in the majority of cases, an Instance only has one frame. See http://dicom.nema.org/medical/dicom/current/output/chtml/part03/sect_C.7.6.html

If e.g. you have a multiframe ultrasound, it would be one instance with hundreds of frames. The frameIndex would be used to explain which frame inside this multiframe instance is currently being displayed by Cornerstone.

swederik avatar Jul 01 '19 16:07 swederik