monai-deploy-app-sdk icon indicating copy to clipboard operation
monai-deploy-app-sdk copied to clipboard

Fix DICOMSeriesToVolumeOperator casting bug

Open WillButAgain opened this issue 11 months ago • 2 comments

The array was being read in as int16 which caused some values to be truncated, it should instead be uint16. I also added a check that uint16 is sufficient after the slope/intercept transformation is applied. if it is not, it will use int32 instead.

WillButAgain avatar Mar 03 '25 16:03 WillButAgain

There is one more commit with additional changes.

The problem is we need the datatypes for the slope and intercept to be compatible with the volume data. uint16 and float32 are not compatible. We ended up needing to check the datatypes of all 3 (vol_data_, slope, intercept) in order to do any casting. Our solution is not elegant, but it will always find the lowest overhead datatype between the options of uint16, float32, and float64.

There may be some benefit in checking again to see if the datatype can be further reduced after the slope/intercept transform is applied. We are open to discussion on this and could add that functionality as well if desired.

WillButAgain avatar Mar 31 '25 12:03 WillButAgain