train custom dataset without metadata information
Hi, I would like to ask about using my own dataset. I have volume data with size 200,200,100 (D,W,H) and corresponding label with same size. I don't have metadata such as affine, etc. I got problem when running test_seg.py when using monai 0.9.0 it gives me an error like this:
Traceback (most recent call last): File "XX\anaconda3\envs\py38.2\lib\site-packages\monai\transforms\transform.py", line 89, in apply_transform return _apply_transform(transform, data, unpack_items) File "XX\anaconda3\envs\py38.2\lib\site-packages\monai\transforms\transform.py", line 53, in _apply_transform return transform(parameters) File "XX\anaconda3\envs\py38.2\lib\site-packages\monai\transforms\spatial\dictionary.py", line 530, in __call__ affine=meta_data["affine"], KeyError: 'affine'
when I change to monai 1.1.0 I got the error similar to (https://github.com/MASILab/3DUX-Net/issues/39)
So I deleted this part :
Invertd( keys="pred", # invert thepreddata field, also support multiple fields transform=test_transforms, orig_keys="image", # get the previously applied pre_transforms information on theimgdata field, # then invertpredbased on this information. we can use same info # for multiple fields, also support different orig_keys for different fields meta_keys="pred_meta_dict", # key field to save inverted meta data, every item maps tokeysorig_meta_keys="image_meta_dict", # get the meta data fromimg_meta_dictfield when inverting, # for example, may need theaffineto invertSpacingdtransform, # multiple fields can use the same meta data to invert meta_key_postfix="meta_dict", # ifmeta_keys=None, use "{keys}_{meta_key_postfix}" as the meta key, # if orig_meta_keys=None, use "{orig_keys}_{meta_key_postfix}", # otherwise, no need this arg during inverting nearest_interp=False, # don't change the interpolation mode to "nearest" when inverting transforms # to ensure a smooth output, then execute AsDiscreted transform to_tensor=True, # convert to PyTorch Tensor after inverting ),
and it finally works when using 1.1.0 version. am I in right direction?
thank you