OSIPI / TF2.4_IVIM-MRI_CodeCollection

OSIPI TF2.4: IVIM MRI code collection
Apache License 2.0
9 stars 27 forks source link

[Feature] Implement checks for fulfilment of algorithm requirements in the OsipiBase class #45

Open IvanARashid opened 6 months ago

IvanARashid commented 6 months ago

Feature description

Currently, the OsipiBase class is used as a parent class for the standardisation of the submitted algorithms. It is also used as a common interface which we use in our testing, allowing for mass-calling of function fitting.

However, one thing we would like to implement in order to make things more robust is to check the inputs and compare them to the requirements of the submitted code. This is in order to raise relevant errors when we know that something will not work due to the input of e.g. init of OsipiBase, or OsipiBase.osipi_fit() not being compatible with the requirements of the fitting algorithm.

Describe the solution

The stadardised implementations of the algorithms can have attributes which describe the requirements of the inputs. E.g. specification of function bounds, number of b-values, number of b-value thresholds, etc (see the required_* attributes in src/standardized/IAR_LU_biexp.py. Write functions that makes sure that the inputs to OsipiBase follow these requirements. Call these checks in the OsipiBase.osipi_fit() function.

Describe alternatives

No response

Additional context

IVIM fitting algorithms can be categorised into e.g. least-squares fits, segmented least-squares fits, Bayesian, variable projection, etc. These have different types of requirements. The segmented algorithms require some kind of segmentation of the b-scale, i.e. a b-value threshold. Therefore, these algorithms would need this parameter specified. However, it could also be that the specific algorithm in question already has some default value, making it a non-requirement in the case of actually initiating the OsipiBase class. So to understand the requirements of each submission, one would need to actually dig into the code. However, for the implementation of this feature, it is not necessarily needed. You essentially only need to write code that compares inputs with the requirements specified in the standardised implementation of the algorithm.

Are you working on this?

None