Open ballaminut opened 4 years ago
This is a file to test the behavior
Confirmed that this is still a problem in 6.8.0. The RescaleIntercept is not assigned to centerPixelValue
, but the default value of centerPixelValue
is 0 and won't be changed when WindowCenter is not present. Similarly, the default value of maxPixelRange
is 0 and won't be changed when WindowWidth is not present.
We'll need to improve the inversion logic here as well as the case described in #3620. The relevant DICOM schema section is https://dicom.nema.org/medical/Dicom/current/output/chtml/part03/sect_C.11.2.html#sect_C.11.2.1.2
If a DICOM image has:
IMHO this is due to the fall through (line 586) break; case PHOTOMETRIC_INTERPRETATION: case PIXEL_SPACING: case SLICE_SPACING: case RESCALE_INTERCEPT: case WINDOW_CENTER: [...] break; case RESCALE_SLOPE: addInfo(tag, in.readString(elementLength)); break;
causing the RescaleIntercept to be assigned to centerPixelValue; probably the intended fall through was: break; case WINDOW_CENTER: String winCenter = in.readString(elementLength); if (winCenter.trim().length() == 0) centerPixelValue = -1; else { try { centerPixelValue = new Double(winCenter).intValue(); } catch (NumberFormatException e) { centerPixelValue = -1; } } addInfo(tag, winCenter); break; case PHOTOMETRIC_INTERPRETATION: case PIXEL_SPACING: case SLICE_SPACING: case RESCALE_INTERCEPT: case RESCALE_SLOPE: addInfo(tag, in.readString(elementLength)); break;
(with -1 initial value for centerPixelValue and maxPixelRange)