cornerstone icon indicating copy to clipboard operation
cornerstone copied to clipboard

Feature request: Add width scale and height scale attributes in viewport response

Open deerawan opened this issue 4 years ago • 0 comments

Problem

Currently for getViewport method, we only return scale field.

cornerstone.getViewport(element);

Response

{
  "scale": 0.5,
  "translation": { "x": 0, "y": 0 },
  "voi": { "windowWidth": 256, "windowCenter": 127 },
  "pixelReplication": false,
  "rotation": 0,
  "hflip": false,
  "vflip": false,
  "labelmap": false,
  "displayedArea": {
    "tlhc": { "x": 1, "y": 1 },
    "brhc": { "x": 512, "y": 44 },
    "rowPixelSpacing": 2.887,
    "columnPixelSpacing": 0.488281,
    "presentationSizeMode": "NONE"
  }
}

We can't really rely on scale value for non-square image scenario since we could split the value into widthScale and heightScale with different value (reference), it might be a good idea to return them as well in the response.

Solution

Option 1

Add widthScale and heightScale in the response. Or maybe put them inside displayedArea field.

{
  "scale": 0.5,
  "widthScale": 0.5,
  "heightScale": 0.5,
   ....
  }
}

Option 2 (break changes)

Remove scale and add widthScale and heightScale in the response.

{
  "widthScale": 0.5,
  "heightScale": 0.5,
  ...
}

deerawan avatar Jul 19 '21 04:07 deerawan