fepegar / torchio

Medical imaging toolkit for deep learning
https://torchio.org
Apache License 2.0
2.08k stars 240 forks source link

RandomGhosting: restore parameter has no effect #1196

Closed sravan953 closed 1 week ago

sravan953 commented 2 months ago

Is there an existing issue for this?

Bug summary

See -- https://github.com/fepegar/torchio/blob/04f385da5aeba3986c691cf975b79ddf0c02714a/src/torchio/transforms/augmentation/intensity/random_ghosting.py#L211

ri, rj, rk are not used anywhere else in the code. Per the current implementation, only the center line of k-space is restored.

Code for reproduction

RandomGhosting(
                num_ghosts=(4, 10),
                intensity=(0.5, 0.7),
                restore=0.9,
)

Actual outcome

restore has no effect on the ghosting transform.

Error messages

No response

Expected outcome

Was the intended design to restore x% of the entire k-space, or x% of the center line of k-space? Or something else?

System info

No response

romainVala commented 2 months ago

Hi, Thanks for the report, you are right : the implementation choose to restore only (and always) the three center plane of the kspace (with no use of the restore parameter)

I am not sure if there is a need to control this restore parameter (restore=1 would remove the artefact). You can already control the artefact strength with the intensity parameter.

But for sure the documentation should be changed ...

fepegar commented 2 months ago

Great catch, @sravan953. I'm disappointed that linters haven't caught this. It turns out that feature is in preview mode.

Was the intended design to restore x% of the entire k-space, or x% of the center line of k-space? Or something else?

The intended design was indeed to restore a percentage of the k-space. I will investigate and either fix this or remove the parameter.