-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Discussed in #6831
Originally posted by agaldran August 7, 2023
Hello,
Sorry about the naive question, I am trying to wrap my head around transforms and meta_dicts. Right now I have the following operations:
import monai.transforms as t
data_dict = {'image': 'data/ct/images/.whatever.nii.gz'}
loader = t.LoadImaged(keys=('image'), image_only=False)
loaded_data_dict = loader(data_dict)
print(loaded_data_dict['image'].shape, loaded_data_dict['image_meta_dict']['pixdim'][1:4])
which returns a shape and voxel sizes of [281, 313, 182]
and (0.50,0.50,0.75)
respectively. Now, if I run:
spacing = t.Spacingd(keys=['image'], pixdim=(0.50, 0.50, 1.5), mode=('bilinear'))
spaced_data_dict = spacing(loaded_data_dict)
print(spaced_data_dict['image'].shape, spaced_data_dict['image_meta_dict']['pixdim'][1:4])
I am expecting to see approx half the voxels in the Z direction, as the original spacing was 0.75 and I am asking for twice that spacing. For the other directions, nothing should be changed^* . This is what I get:
[281, 313, 92], (0.50,0.50,0.75)
So, although the number of voxels are as expected, the spacing remains the same. I cannot find any other key in the meta data dictionary that tells me what is the current spacing for this volume. Am I doing something wrong here?
slicepaste
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working