-
Notifications
You must be signed in to change notification settings - Fork 595
displaying images (series) with different sizes causes the image to be clipped #304
Description
When a series with different image's size is displayed in cornerstone (stack scroll behavior), the subsequent images might get clipped (if the first image is smaller).
For example, if a series with 3 images (128x128, 256x256, 512x512) is used to render images using cornerstone.displayImage (stack scroll) the 2nd and 3rd images will be clipped to 128x128.
The reason for this is when setting the first image, the displayedArea which is part of the viewport is initialized with the same image size:
cornerstone/src/internal/getDefaultViewport.js
Lines 102 to 110 in 12da9ed
| displayedArea: { | |
| tlhc: { | |
| x: 1, | |
| y: 1 | |
| }, | |
| brhc: { | |
| x: image.columns, | |
| y: image.rows | |
| }, |
Subsequent calls to displayImage will use the original viewport and merge any new properties:
cornerstone/src/displayImage.js
Lines 41 to 48 in 12da9ed
| // Merge viewport | |
| if (viewport) { | |
| for (const attrname in viewport) { | |
| if (viewport[attrname] !== null) { | |
| enabledElement.viewport[attrname] = viewport[attrname]; | |
| } | |
| } | |
| } |
Workaround
The user provide a viewport parameter in the displayImage method what includes the new image displayedArea initialized