Please:
While running the data README to run the 'bare bones' example to load data and incorporate transforms -
(all the libraries are installed using !pip install -r requirements.txt)
import pathlib
from fastmri.data import subsample
from fastmri.data import transforms, mri_data
# Create a mask function
mask_func = subsample.RandomMaskFunc(
center_fractions=[0.08, 0.04],
accelerations=[4, 8]
)
def data_transform(kspace, mask, target, data_attributes, filename, slice_num):
# Transform the data into appropriate format
# Here we simply mask the k-space and return the result
kspace = transforms.to_tensor(kspace)
masked_kspace, _ = transforms.apply_mask(kspace, mask_func)
return masked_kspace
dataset = mri_data.SliceDataset(
root=pathlib.Path(
'/home/../fastMRI_AUTOMAP/singlecoil_train/'
),
transform=data_transform,
challenge='singlecoil'
)
for masked_kspace in dataset:
# Do reconstruction
pass
It is giving the following error -
ValueError Traceback (most recent call last)
/tmp/ipykernel_32041/2396895955.py in <module>
24 )
25
---> 26 for masked_kspace in dataset:
27 # Do reconstruction
28 pass
~/Downloads/fastMRI_AUTOMAP/fastMRI/fastmri/data/mri_data.py in __getitem__(self, i)
358 sample = (kspace, mask, target, attrs, fname.name, dataslice)
359 else:
--> 360 sample = self.transform(kspace, mask, target, attrs, fname.name, dataslice)
361
362 return sample
/tmp/ipykernel_32041/2396895955.py in data_transform(kspace, mask, target, data_attributes, filename, slice_num)
13 # Here we simply mask the k-space and return the result
14 kspace = transforms.to_tensor(kspace)
---> 15 masked_kspace, _ = transforms.apply_mask(kspace, mask_func)
16 return masked_kspace
17
ValueError: too many values to unpack (expected 2)
Please: While running the data README to run the 'bare bones' example to load data and incorporate transforms - (all the libraries are installed using
!pip install -r requirements.txt
)It is giving the following error -