CastToType not working possibly

Hi,
i am modifying the “clara_mri_seg_brain_tumors_br16_full_amp_v1” example for my example training.
My datasets are 16 bit nifti: both images and labels. One choice is to convert all the images to float. I was looking to useCastToType to convert int16 to float32. i have the below in the pre_transforms:

        {
            "name": "LoadNifti",
            "args": {
                "fields": [
                    "image"
                ],
                "dtype": "int16"
            }
        },

        {
            "name": "LoadNifti",
            "args": {
                "fields": [
                    "label"
                ],
                "dtype": "int16"
            }
        },

       {
            "name": "CastToType",
            "args":{
                "fields": "image",
                "dtype": "float32"
            }
        },

        {
            "name": "ConvertToChannelsFirst",
            "args": {
                "fields": [
                    "image",
                    "label"
                ]
            }
        },


]
I think i may be doing something wrong because there is runtime error.
ValueError: int16 should be floating point type
2021-01-11 12:23:35,543 - ChainTransformer - ERROR - Error occurred while applying <class ‘ai4med.components.transforms.load_nifti.LoadNifti’> to following data dict.
2021-01-11 12:23:35,543 - ChainTransformer - ERROR - Key: image, Value: b’/workspace/data/resampled/64_cube/train/images/CTAWHS_0028_0000.nii.gz’
2021-01-11 12:23:35,543 - ChainTransformer - ERROR - Key: label, Value: b’/workspace/resampled/64_cube/train/labels/CTAWHS_0028.nii.gz’
2021-01-11 12:23:35,544 - ChainTransformer - ERROR - Key: ID, Value: 5
2021-01-11 12:23:35,544 - ChainTransformer - ERROR - Key: image.shape_format, Value: b’none’
2021-01-11 12:23:35,544 - ChainTransformer - ERROR - Asked to stop training since training is impossible now
Any suggestions?
thanks

Hi
I am not sure why you needed to do this. loadnifti used nibabel lib which should be able to open your files. The dtype parameter is used to cast the numpy
Could you simply try the transformations without dtype parameters as they should default to float32.

Thanks for reply. As you know the medical image range is such that 16 bit is enough. So, to convert and store as float, the file size will increase, besides adding one more task :-). Storage is cheap no doubt but when we have a large dataset size, it inefficient.
Hope it is clearer?
Best regards
Krishnan