File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -57,14 +57,21 @@ function convertToIntPixelData(floatPixelData) {
5757function setPixelDataType ( imageFrame , preScale ) {
5858 const isScaled = preScale ?. scaled ;
5959 const scalingParmeters = preScale ?. scalingParameters ;
60- const rescaleSlope = scalingParmeters ?. rescaleSlope ;
61- const rescaleIntercept = scalingParmeters ?. rescaleIntercept ;
62- const isNegative = rescaleSlope < 0 || rescaleIntercept < 0 ;
60+ let isNegative = false ;
61+ if ( isScaled && scalingParmeters ) {
62+ const rescaleSlope = scalingParmeters ?. rescaleSlope || 1 ;
63+ const rescaleIntercept = scalingParmeters ?. rescaleIntercep || 0 ;
64+ const suvbw = scalingParmeters ?. suvbw || 1 ;
65+ isNegative =
66+ suvbw *
67+ ( imageFrame . smallestPixelValue * rescaleSlope + rescaleIntercept ) <
68+ 0 ;
69+ }
6370
6471 if ( imageFrame . bitsAllocated === 32 ) {
6572 imageFrame . pixelData = new Float32Array ( imageFrame . pixelData ) ;
6673 } else if ( imageFrame . bitsAllocated === 16 ) {
67- if ( imageFrame . pixelRepresentation === 0 && ! ( isScaled && isNegative ) ) {
74+ if ( imageFrame . pixelRepresentation === 0 && ! isNegative ) {
6875 imageFrame . pixelData = new Uint16Array ( imageFrame . pixelData ) ;
6976 } else {
7077 imageFrame . pixelData = new Int16Array ( imageFrame . pixelData ) ;
You can’t perform that action at this time.
0 commit comments