diff --git a/Makefile b/Makefile index b59cc88..0ac4b33 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,7 @@ prepare: tests/data/moae_fmriprep ## demo: prepares the data of MOAE dataset prepare \ -vv \ --reset_database \ - --non_linear_coreg + --linear_coreg generalize: ## demo: predicts labels of MOAE dataset bidsmreye $$PWD/tests/data/moae_fmriprep \ diff --git a/bidsmreye/_cli.py b/bidsmreye/_cli.py index fd893e5..8c00d32 100644 --- a/bidsmreye/_cli.py +++ b/bidsmreye/_cli.py @@ -54,7 +54,7 @@ def cli(argv: Any = sys.argv) -> None: model_weights_file=model_weights_file, reset_database=args.reset_database, bids_filter_file=args.bids_filter_file, - non_linear_coreg=bool(getattr(args, "non_linear_coreg", False)), + linear_coreg=bool(getattr(args, "linear_coreg", False)), log_level_name=log_level_name, force=bool(getattr(args, "force", False)), ) diff --git a/bidsmreye/_parsers.py b/bidsmreye/_parsers.py index 69dcbdf..d807161 100644 --- a/bidsmreye/_parsers.py +++ b/bidsmreye/_parsers.py @@ -158,10 +158,13 @@ def common_parser(formatter_class: type[HelpFormatter] = HelpFormatter) -> Argum prepare_parser = _add_common_arguments(prepare_parser) # TODO make it possible to pass path to a model ? prepare_parser.add_argument( - "--non_linear_coreg", + "--linear_coreg", help=""" -Uses a more aggressive (and non-linear) alignment procedure -to the deepmreye template.""", +Uses a less aggressive (and linear) alignment procedure +to the deepmreye template. + +May lead to worse results so check your outputs. +""", action="store_true", ) @@ -190,10 +193,12 @@ def common_parser(formatter_class: type[HelpFormatter] = HelpFormatter) -> Argum all_parser = _add_common_arguments(all_parser) # TODO make it possible to pass path to a model ? all_parser.add_argument( - "--non_linear_coreg", + "--linear_coreg", help=""" -Uses a more aggressive (and non-linear) alignment procedure +Uses a less aggressive (and linear) alignment procedure to the deepmreye template. + +May lead to worse results so check your outputs. """, action="store_true", ) diff --git a/bidsmreye/bidsmreye.py b/bidsmreye/bidsmreye.py index ca85362..e013ccd 100755 --- a/bidsmreye/bidsmreye.py +++ b/bidsmreye/bidsmreye.py @@ -27,7 +27,7 @@ def bidsmreye( model_weights_file: str | None = None, reset_database: bool | None = None, bids_filter_file: str | None = None, - non_linear_coreg: bool = False, + linear_coreg: bool = False, log_level_name: str | None = None, force: bool = False, ) -> None: @@ -50,7 +50,7 @@ def bidsmreye( model_weights_file=model_weights_file, reset_database=reset_database, bids_filter=bids_filter, - non_linear_coreg=non_linear_coreg, + linear_coreg=linear_coreg, force=force, ) # type: ignore diff --git a/bidsmreye/configuration.py b/bidsmreye/configuration.py index 35e4b5e..9dee2a4 100644 --- a/bidsmreye/configuration.py +++ b/bidsmreye/configuration.py @@ -54,7 +54,7 @@ def _check_input_dir(self, attribute: str, value: Path) -> None: debug: str | bool | None = field(kw_only=True, default=None) reset_database: bool = field(kw_only=True, default=False) - non_linear_coreg: bool = field(kw_only=True, default=False) + linear_coreg: bool = field(kw_only=True, default=False) force: bool = field(kw_only=True, default=False) has_GPU: bool = False diff --git a/bidsmreye/prepare_data.py b/bidsmreye/prepare_data.py index e3f4d4c..126cf6d 100644 --- a/bidsmreye/prepare_data.py +++ b/bidsmreye/prepare_data.py @@ -33,7 +33,7 @@ log = bidsmreye_log(name="bidsmreye") -def coregister_and_extract_data(img: str, non_linear_coreg: bool = False) -> None: +def coregister_and_extract_data(img: str, linear_coreg: bool = False) -> None: """Coregister image to eye template and extract data from eye mask for one image. :param img: Image to coregister and extract data from @@ -49,7 +49,7 @@ def coregister_and_extract_data(img: str, non_linear_coreg: bool = False) -> Non z_edges, ) = preprocess.get_masks() - transforms = ["Affine", "Affine", "SyNAggro"] if non_linear_coreg else None + transforms = None if linear_coreg else ["Affine", "Affine", "SyNAggro"] preprocess.run_participant( img, @@ -168,7 +168,7 @@ def prepapre_image( log.info(f"Processing file: {Path(img_path).name}") - coregister_and_extract_data(img_path, non_linear_coreg=cfg.non_linear_coreg) + coregister_and_extract_data(img_path, linear_coreg=cfg.linear_coreg) deepmreye_mask_report = get_deepmreye_filename( layout_in, img=img_path, filetype="report" @@ -205,8 +205,8 @@ def prepare_data(cfg: Config) -> None: subjects = list_subjects(cfg, layout_in) text = "PREPARING DATA" - if cfg.non_linear_coreg: - log.info("Using non-linear coregistration") + if cfg.linear_coreg: + log.info("Using linear coregistration") with progress_bar(text=text) as progress: subject_loop = progress.add_task( diff --git a/boutiques/bidsmreye_0.4.0.json b/boutiques/bidsmreye_0.4.0.json index 7824419..d8da8cd 100644 --- a/boutiques/bidsmreye_0.4.0.json +++ b/boutiques/bidsmreye_0.4.0.json @@ -3,7 +3,7 @@ "description": "bids app using deepMReye to decode eye motion for fMRI time series data", "tool-version": "0.4.0", "schema-version": "0.5", - "command-line": "bidsmreye [VERSION] [BIDS_DIR] [OUTPUT_DIR] [ANALYSIS_LEVEL] [COMMAND] [PARTICIPANT_LABEL] [TASK] [RUN] [SPACE] [LOG_LEVEL] [DEBUG] [RESET_DATABASE] [BIDS_FILTER_FILE] [FORCE] [NON_LINEAR_COREG] [MODEL]", + "command-line": "bidsmreye [VERSION] [BIDS_DIR] [OUTPUT_DIR] [ANALYSIS_LEVEL] [COMMAND] [PARTICIPANT_LABEL] [TASK] [RUN] [SPACE] [LOG_LEVEL] [DEBUG] [RESET_DATABASE] [BIDS_FILTER_FILE] [FORCE] [LINEAR_COREG] [MODEL]", "inputs": [ { "name": "version", @@ -132,13 +132,13 @@ "value-key": "[FORCE]" }, { - "name": "non_linear_coreg", - "id": "non_linear_coreg", - "description": "Uses a more aggressive (and non-linear) alignment procedure to the deepmreye template.", + "name": "linear_coreg", + "id": "linear_coreg", + "description": "Uses a less aggressive (linear) alignment procedure to the deepmreye template.", "type": "Flag", "optional": true, - "command-line-flag": "--non_linear_coreg", - "value-key": "[NON_LINEAR_COREG]" + "command-line-flag": "--linear_coreg", + "value-key": "[LINEAR_COREG]" }, { "name": "model", @@ -187,7 +187,7 @@ "reset_database", "debug", "force", - "non_linear_coreg", + "linear_coreg", "log_level", "run", "space", @@ -199,7 +199,6 @@ "reset_database", "debug", "force", - "non_linear_coreg", "log_level", "model", "run", @@ -212,13 +211,12 @@ "reset_database", "debug", "force", - "non_linear_coreg", + "linear_coreg", "log_level", "model", "run", "space", "bids_filter_file", - "participant_label", "task" ] } diff --git a/boutiques/invocation.json b/boutiques/invocation.json index 45b02e1..9dec5e2 100644 --- a/boutiques/invocation.json +++ b/boutiques/invocation.json @@ -13,6 +13,6 @@ "debug": false, "reset_database": true, "force": false, - "non_linear_coreg": true, + "linear_coreg": true, "model": "1_guided_fixations" } diff --git a/tests/data/derivatives/bidsmreye/dataset_description.json b/tests/data/derivatives/bidsmreye/dataset_description.json index fc31552..caca3be 100644 --- a/tests/data/derivatives/bidsmreye/dataset_description.json +++ b/tests/data/derivatives/bidsmreye/dataset_description.json @@ -66,7 +66,7 @@ }, "debug": false, "reset_database": false, - "non_linear_coreg": false + "linear_coreg": false } } ], diff --git a/tests/test_configuration.py b/tests/test_configuration.py index eac2598..20e0ca5 100644 --- a/tests/test_configuration.py +++ b/tests/test_configuration.py @@ -17,7 +17,7 @@ def test_Config(data_dir, pybids_test_dataset): data_dir, ) assert not cfg.debug - assert not cfg.non_linear_coreg + assert not cfg.linear_coreg assert cfg.input_dir == pybids_test_dataset assert cfg.output_dir == data_dir / "bidsmreye" assert sorted(cfg.subjects) == ["01", "02", "03", "04", "05"] diff --git a/tests/test_parsers.py b/tests/test_parsers.py index d41260e..6fa1e83 100644 --- a/tests/test_parsers.py +++ b/tests/test_parsers.py @@ -14,12 +14,12 @@ def test_parser() -> None: "--task", "foo", "bar", - "--non_linear_coreg", + "--linear_coreg", ] ) assert args.task == ["foo", "bar"] - assert args.non_linear_coreg + assert args.linear_coreg def test_parser_basic() -> None: @@ -43,7 +43,7 @@ def test_parser_basic() -> None: ) assert args.task == ["foo", "bar"] - assert args.non_linear_coreg is False + assert args.linear_coreg is False def test_download_parser(): diff --git a/tools/create_boutiques_descriptor.py b/tools/create_boutiques_descriptor.py index 1faf21b..4781637 100644 --- a/tools/create_boutiques_descriptor.py +++ b/tools/create_boutiques_descriptor.py @@ -11,7 +11,7 @@ "$PWD/outputs/moae_fmriprep/derivatives " "participant " "all " - "--reset_database --non_linear_coreg --model 1_guided_fixations -vv" + "--reset_database --linear_coreg --model 1_guided_fixations -vv" ) cmd = cmd.split(" ")