Medical-Image-Analysis-Laboratory / mialsuperresolutiontoolkit

The Medical Image Analysis Laboratory Super-Resolution ToolKit (MIALSRTK) consists of a set of C++ and Python processing and workflow tools necessary to perform motion-robust super-resolution fetal MRI reconstruction in the BIDS Apps framework.
BSD 3-Clause "New" or "Revised" License
26 stars 12 forks source link

177 183 inputs as attributes #192

Closed t-sanchez closed 1 year ago

t-sanchez commented 1 year ago

Fix the issue https://github.com/Medical-Image-Analysis-Laboratory/mialsuperresolutiontoolkit/issues/177 -> Cleaned up inputs to workflows. Fix https://github.com/Medical-Image-Analysis-Laboratory/mialsuperresolutiontoolkit/issues/183 -> Make the pipeline crash explicitly when

A single stack is run A stack isn't found in filterbyrunid

t-sanchez commented 1 year ago

That's actually a good point. I don't think that it's currently handled. I'd need to check this case specifically.

t-sanchez commented 1 year ago

Actually, rather than having the checks scattered throughout the input stage, I refactored FilteringByRunId into CheckAndFilterInputStacks. The class takes as input input_images (T2w images), and optionally stacks, masks and labels.

It either uses the given stacks or extracts them from the T2w images and then checks that masks and labels have the requested stacks. It raises an exception when it is not the case. It also checks that at least ~one stack is~ two stacks are requested/found.

I think that this simplifies the workflow in the input_stage, removing the need for individual filtering. Rather, we filter immediately the files based on the stacks or the input_images found. The stack ordering then works on already filtered data, and there is no need to re-filter them afterwards.

t-sanchez commented 1 year ago

As the black refactoring makes the reading of relevant changes quite difficult, I've put some comments around the important changes.