populse / populse_mia

Multiparametric Image Analysis
Other
10 stars 9 forks source link

[Initialization step] Requirements management is suboptimal #300

Closed servoz closed 1 year ago

servoz commented 1 year ago

It seems that the requirements management is currently a mixture of elements from V1 and V2, which in some cases leads to a result that is at best imperfect, at worst wrong.

We would like to have a message at initialisation time, which would tell the user exactly which of the requirements is wrong, in a way that is simple and easy to understand for the average user.

manuegrx commented 1 year ago

Side effect of this issue :

When using alone a brick with self.requirement = [] there is an issue during pipeline initialization. A windows appears with the following message : message

However if we used this brick in a pipeline there is no pipeline initialization issue

For example brick preprocess.others.ConformeImage --> intialization issue when using the brick alone and okay when brick is used in Anat_mriqc pipeline.

It seems to come from make_initResult function (in populse_mia/user_interfacte/pipeline_maganer/process_mia).

def make_initResult(self):
        """Make the initResult_dict from initialisation."""
        if (
            (self.requirement is None)
            or (not self.inheritance_dict)
            or (not self.outputs)
        ):
            print(
                "\nDuring the {0} process initialisation, some possible "
                "problems were detected:".format(self)
            )

            if self.requirement is None:
                print("- requirement attribute was not found ...")

            if not self.inheritance_dict:
                print("- inheritance_dict attribute was not found ...")

            if not self.outputs:
                print("- outputs attribute was not found ...")

            print()

        if (
            self.outputs
            and self.requirement is not None
            and "spm" in self.requirement
        ):
            self.outputs["notInDb"] = ["spm_script_file"]

        return {
            "requirement": self.requirement,
            "outputs": self.outputs,
            "inheritance_dict": self.inheritance_dict,
        }

When using the brick alone, it is like self.requirement is None and not when using the same brick in a pipeline. I do not understand why, maybe I missing something

servoz commented 1 year ago

The issue#300 branch does now the job. I'm waiting to merge it with master until the PR at capsul is accepted and the unit test problems caused by these changes are corrected. Then I will close this ticket.

servoz commented 1 year ago

Done!