cornerstonejs / cornerstone

JavaScript library to display interactive medical images including but not limited to DICOM
https://docs.cornerstonejs.org/
MIT License
2.06k stars 598 forks source link

Stack of different dimension images unexpected behavior #430

Open fakyras opened 4 years ago

fakyras commented 4 years ago

I have been building an app for frontal/lateral chest x-rays, where mouse scrolling would switch between frontal and lateral - so a study would be treated similarly to CT scans.

The problem is that dimensions of frontal and lateral images usually do not match and this causes rendering issues:


Situation no1 - the first slice is frontal & the second - lateral:

stack_fr1

scrolling to lateral slice:

stack_fr2

==> the lateral image is not fully extended vertically


situation no2 - the first slice is lateral & the second - frontal:

stack_la1

scrolling to frontal slice:

stack_la2

==> although frontal fits vertically, it has been cropped to lateral image dimensions horizontally.


It seems the application gets stuck with the dimensions of the first slice it renders. The workaround I have at the moment is to have a button with reset function to be applied, i.e.:

  reset() {
    const element = this.state.cornerstoneElement;
    cornerstone.reset(element);
  }

But as you can imagine - this is not ideal.

I wonder if anyone had this similar issue before and how they have it resolved. Any help would be appreciated.

swederik commented 4 years ago

Tagging @Zaid-Safadi because he introduced this bug with the presentation state displayed area viewport property and we have discussed it before.

Zaid-Safadi commented 4 years ago

There are multiple ways to solve this externally in the viewer and internally in the library as proposed here

I am happy to provide a fix that we agree on. I'll continue the discussion on the original thread to explore solutions.