Add the DataLoadingPlan functionality to MedicalFolder*
Closes #319 (closed). Should not be merged before !131 (merged) .
The class diagram looks like this. I have highlighted in green the functions that have been modified, and in red a new special function that was needed to be able to use the DataLoadingPlan inside a MedicalFolder
The main changes are:
- MedicalFolderBase now inherits from
DataLoadingPlanMixin
, thus giving the DataLoadingPlan functionality to bothMedicalFolderDataset
andMedicalFolderController
. - The
DataPipelineDataLoadingBlock
implementing the mapping of Modalities to Folders is simply an instance ofMapperDPMapperBlock
. ItsDataLoadingBlocks
should be__type_id
modalities_to_folders
. Itsmap
member has the following semantics:map = {'modality': ['folder1', 'folder2', ...]}
. For example
map = {'T1': ['T1-Philips', 'T1-Siemens'],
'T2': ['lowdose', 'myscans'],
'label': ['label']
}
An example of the full usage can be found in the tests, and will be made even more clear in the future when we implement CLI and GUI.
- Before, the
MedicalFolderController
scanned all subfolders of all subjects to identify all available modalities. Now the modalities obtained in this way are considered "candidate" modalities (for instance, to be presented to the GUI). The candidate modalities are the same as the actualmodalities
only when a DataLoadingPlan is not active, otherwise the actualmodalities
are obtained from theDataLoadingPlan
- We no longer cache the
subjects_has_all_modalities
property, because if a DataLoadingPlan is set after this property was computed the first time, it would become invalid - The
_subject_modality_folder
has the important role of providing a link between the purely logical map between{'modality': ['folder names', ...]}
and the actual situation on the file system. When we interrogate the DataLoadingPlan for the folder names corresponding to a given modelity, we obtain a list of possibilities. But which one is right depends on which one actually exists among the subject's subfolders. The_subject_modality_folder
is responsible for finding this.
Edited by VESIN Marc