Skip to content

Commit

Permalink
Creation of a PredictManager from MapsManager (aramis-lab#557)
Browse files Browse the repository at this point in the history
* first commit for creation of a Predict_manager
  • Loading branch information
camillebrianceau committed May 30, 2024
1 parent cdd618c commit 2f304cf
Show file tree
Hide file tree
Showing 8 changed files with 1,247 additions and 870 deletions.
5 changes: 3 additions & 2 deletions clinicadl/interpret/interpret.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import List

from clinicadl import MapsManager
from clinicadl.utils.predict_manager.predict_manager import PredictManager


def interpret(
Expand Down Expand Up @@ -85,8 +86,8 @@ def interpret(
verbose_str = verbose_list[verbose]

maps_manager = MapsManager(maps_dir, verbose=verbose_str)

maps_manager.interpret(
predict_manager = PredictManager(maps_manager)
predict_manager.interpret(
data_group=data_group,
name=name,
method=method,
Expand Down
8 changes: 5 additions & 3 deletions clinicadl/predict/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from clinicadl import MapsManager
from clinicadl.utils.exceptions import ClinicaDLArgumentError
from clinicadl.utils.predict_manager.predict_manager import PredictManager


def predict(
Expand Down Expand Up @@ -53,16 +54,17 @@ def predict(
verbose_list = ["warning", "info", "debug"]

maps_manager = MapsManager(maps_dir, verbose=verbose_list[0])
predict_manager = PredictManager(maps_manager)
# Check if task is reconstruction for "save_tensor" and "save_nifti"
if save_tensor and maps_manager.network_task != "reconstruction":
if save_tensor and predict_manager.maps_manager.network_task != "reconstruction":
raise ClinicaDLArgumentError(
"Cannot save tensors if the network task is not reconstruction. Please remove --save_tensor option."
)
if save_nifti and maps_manager.network_task != "reconstruction":
if save_nifti and predict_manager.maps_manager.network_task != "reconstruction":
raise ClinicaDLArgumentError(
"Cannot save nifti if the network task is not reconstruction. Please remove --save_nifti option."
)
maps_manager.predict(
predict_manager.predict(
data_group,
caps_directory=caps_directory,
tsv_path=tsv_path,
Expand Down
Loading

0 comments on commit 2f304cf

Please sign in to comment.