Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Known Issue] Target Buffer Specification for StackViewport #59

Open
sedghi opened this issue Apr 1, 2022 · 0 comments
Open

[Known Issue] Target Buffer Specification for StackViewport #59

sedghi opened this issue Apr 1, 2022 · 0 comments
Labels
Known Issue Known issue when released

Comments

@sedghi
Copy link
Member

sedghi commented Apr 1, 2022

CSWIL has been recently equipped with an option to scale the array given the scaling parameters. It also can accept a targetBuffer to store the pixelData in the specified typedArray constructor name (Float32Array, Uint8Array etc).

Here are the problems:

  1. Memory inefficiency: Right now we are putting every thing regardless of the bitsAllocation into a Float32Array. The reason is scaling, since we are scaling PT series which will end up with float pixelData.

Potential Solution:
CSWIL should have a mechanism to compute the proper typed Array for the given pixelData, intercept, slop. It would be something like:

function getMinMaxAfterScaling(minValue, maxValue, slope, intercept, scalingParam){
  const minValueAfterScale = minValue * slope + intercept 
  const maxValueAfterScale = maxValue * slope + intercept 

  if (scalingParam){
    minValueAfterScale *= scalingParam
    maxValueAfterScale *= scalingParam
  }
}

Then we need a function to reason about the minValueAfterScale (MVAS) and maxValueAfterScale(MXVAS), something like

function getTypedArrayConstructor(MVAS, MXVAS){

  if (MVAS>0 && MXVAS<255 && isInteger(MVAS)) return Uint8Array
  If (MVAS < 0 && MVAS > -128 && MXVAS < 127 && isInteger(MVAS)) return Int8Array
  If (isFloat) return Float32Array
  ...

Notes:

  • Volume Loaders should still specify their targetBuffer since we use SharedArrayBuffer and fill it by pointers.
  • IsInteger and IsFloat should be written in a way that 1.0 be a float, and not integer (maybe we need to take into account the floatness of slope and intercept and scalingParams too?)
@sedghi sedghi added the Known Issue Known issue when released label Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Known Issue Known issue when released
Projects
None yet
Development

No branches or pull requests

1 participant