Fix VFA validation for NumPy flip angles - #162
Conversation
|
@MohamedNasser8 can you review this one when you have some time? |
|
Of course |
|
Thanks @ParikshitGupta2605 My one concern is where to fix it. This solves it inside vfa.py, but flip_angles actually belongs to DCEAcquisitionParams, and other parts of the code read it too (e.g. signal-to-concentration) . The field is declared as list[float] but nothing actually enforces that. That means every other function depends on DCEAcquisitionParams keeps the same bug. I think it's better to fix it once at the dataclass for example use post_init to keep it list. I mean convert whatever is passed into a plain list of floats, and raise a clear error if it genuinely can't be converted. |
|
Thanks for the feedback! Normalizing flip_angles in DCEAcquisitionParams.post_init is a better approach since it guarantees a consistent list[float] representation for all consumers, rather than handling it only in vfa.py. I'll update the implementation accordingly and simplify the VFA-specific changes. |
|
Thanks both. Also note there are several locations where we cast as list or as array that probably needs to be cleaned up once this is implemented in the dataclass. |
|
Reopening with the final version - Pull request #167 |
Summary
This PR fixes the validation of
flip_anglesincompute_t1_vfa()when provided as a NumPy array.Previously, the code used:
which raises a
ValueErrorfor NumPy arrays because their truth value is ambiguous.Changes
Noneand empty arrays.flip_anglesusingnp.asarray()before validation.Fixes #159