PTB-MR / mrpro

MR image reconstruction and processing.
https://ptb-mr.github.io/mrpro/
Apache License 2.0
13 stars 2 forks source link

__repr__ for our dataclasses #250

Closed ckolbPTB closed 1 month ago

ckolbPTB commented 5 months ago

Currently when we do someting like

idata = IData.from....
print(idata)

then we get a lot of mainly useless information. It would be nice if this print statement would lead to some helpful information, e.g. IData with shape [1 1 20 30 40]

This would require to implement __repr__ method for our dataclasses. See e.g. https://www.pythontutorial.net/python-oop/python-__repr__/

ckolbPTB commented 3 months ago

Suggestion:

IData -> IData with shape [...], FOV [...], TE, TR, TI and flip angle QData -> QData with shape [...] and FOV [...] KNoise/DcfData -> KNoise/DcfData with shape [...] KData -> KData with shape [...], trajectory shape [...], FOV, TE, TR, TI and flip angle, encoding_matrix, recon_matrix

fzimmermann89 commented 3 months ago

I would suggest to put fov, te etc. in kheader repr.

And in kdata return Kdata instance: (shape, dtype) and header.repr

ckolbPTB commented 3 months ago

check default __repr__ for dataclasses and what can be reused