All files / core/src/utilities logit.ts

50% Statements 1/2
100% Branches 0/0
0% Functions 0/1
50% Lines 1/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10            428x      
// This function is the analytical inverse of the dicom spec sigmoid function
// for values y = [0, 1] exclusive. We use this to perform better sampling of
// points for the LUT as some images can have 2^16 unique values. This method
// can be deprecated if vtk supports LUTFunctions rather than look up tables
// or if vtk supports logistic scale. It currently only supports linear and
// log10 scaling which can be set on the vtkColorTransferFunction
export const logit = (y: number, wc: number, ww: number): number => {
  return wc - (ww / 4) * Math.log((1 - y) / y);
};