File tree Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Expand file tree Collapse file tree 1 file changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -1240,21 +1240,25 @@ function unpackPixelData(multiframe) {
12401240
12411241 const pixelData = new Uint8Array ( data ) ;
12421242
1243- const max = multiframe . MaximumFractionalValue ;
1244- const onlyMaxAndZero =
1245- pixelData . find ( element => element !== 0 && element !== max ) ===
1246- undefined ;
1247-
1248- if ( ! onlyMaxAndZero ) {
1249- // This is a fractional segmentation, which is not currently supported.
1250- return ;
1251- }
1243+ // IDC: we encountered segmentations defined as fractional with a constant pixel values which is not the MaximumFractionalValue.
1244+ // Here we add the following check: if the labelmap has a constant value (independently by the value itself), it is considered a binary segmentation
1245+ const firstNonZeroIndex = pixelData . findIndex ( element => element > 0 ) ;
1246+ const firstNonZeroValue = pixelData [ firstNonZeroIndex ] ;
1247+ const onlyOneValueAndZero =
1248+ pixelData . find (
1249+ element => element !== 0 && element !== firstNonZeroValue
1250+ ) === undefined ;
1251+
1252+ if ( onlyOneValueAndZero ) {
1253+ log . warn (
1254+ "This segmentation object is actually binary... processing as such."
1255+ ) ;
12521256
1253- log . warn (
1254- "This segmentation object is actually binary... processing as such."
1255- ) ;
1257+ return pixelData ;
1258+ }
12561259
1257- return pixelData ;
1260+ // This is a fractional segmentation, which is not currently supported.
1261+ return ;
12581262}
12591263
12601264/**
You canāt perform that action at this time.
0 commit comments