From 8e8085b87a3807e90d63f4b1c45856a48db7e248 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Wed, 16 Jul 2025 17:52:13 +0200 Subject: [PATCH 1/9] Add citation reminder on prerpocessor init --- .../preprocessor/preprocessor.py | 2 ++ .../utils/citation_reminder.py | 33 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 brainles_preprocessing/utils/citation_reminder.py diff --git a/brainles_preprocessing/preprocessor/preprocessor.py b/brainles_preprocessing/preprocessor/preprocessor.py index e2fb776..8f34870 100644 --- a/brainles_preprocessing/preprocessor/preprocessor.py +++ b/brainles_preprocessing/preprocessor/preprocessor.py @@ -22,6 +22,7 @@ ) from brainles_preprocessing.registration import ANTsRegistrator from brainles_preprocessing.registration.registrator import Registrator +from brainles_preprocessing.utils.citation_reminder import citation_reminder from brainles_preprocessing.utils.logging_utils import LoggingManager from brainles_preprocessing.utils.zenodo import verify_or_download_atlases @@ -46,6 +47,7 @@ class BasePreprocessor(ABC): """ + @citation_reminder def __init__( self, center_modality: CenterModality, diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py new file mode 100644 index 0000000..b376deb --- /dev/null +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -0,0 +1,33 @@ +import os + +from rich.console import Console + +CITATION_LINK = "https://github.com/BrainLesion/preprocessing#citation" + + +def citation_reminder(func): + """Decorator to remind users to cite panoptica.""" + + def wrapper(*args, **kwargs): + if ( + os.environ.get("BRAINLES_PREPROCESSING_CITATION_REMINDER", "true").lower() + == "true" + ): + console = Console() + console.rule("Thank you for using [bold]brainles-preprocessing[/bold]") + console.print( + "Please support our development by citing", + justify="center", + ) + console.print( + f"{CITATION_LINK} -- Thank you!", + justify="center", + ) + console.rule() + console.line() + os.environ["BRAINLES_PREPROCESSING_CITATION_REMINDER"] = ( + "false" # Show only once + ) + return func(*args, **kwargs) + + return wrapper From be957bd800e2e56427aadf196fa920b4a0e5ebe1 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Wed, 16 Jul 2025 17:53:15 +0200 Subject: [PATCH 2/9] Add citation readme section --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2aaa926..61d23c8 100644 --- a/README.md +++ b/README.md @@ -111,9 +111,25 @@ For further information please have a look at our [Jupyter Notebook tutorials](h +## Citation +> [!IMPORTANT] +> If you use `brainles-preprocessing` in your research, please cite it to support the development! - +Kofler, F., Rosier, M., Astaraki, M., Möller, H., Mekki, I. I., Buchner, J. A., Schmick, A., Pfiffer, A., Oswald, E., Zimmer, L., Rosa, E. de la, Pati, S., Canisius, J., Piffer, A., Baid, U., Valizadeh, M., Linardos, A., Peeken, J. C., Shit, S., … Menze, B. (2025). *BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis* [arXiv preprint arXiv:2507.09036](https://doi.org/10.48550/arXiv.2507.09036) + + +``` +@misc{kofler2025brainlesionsuiteflexibleuserfriendly, + title={BrainLesion Suite: A Flexible and User-Friendly Framework for Modular Brain Lesion Image Analysis}, + author={Florian Kofler and Marcel Rosier and Mehdi Astaraki and Hendrik Möller and Ilhem Isra Mekki and Josef A. Buchner and Anton Schmick and Arianna Pfiffer and Eva Oswald and Lucas Zimmer and Ezequiel de la Rosa and Sarthak Pati and Julian Canisius and Arianna Piffer and Ujjwal Baid and Mahyar Valizadeh and Akis Linardos and Jan C. Peeken and Surprosanna Shit and Felix Steinbauer and Daniel Rueckert and Rolf Heckemann and Spyridon Bakas and Jan Kirschke and Constantin von See and Ivan Ezhov and Marie Piraud and Benedikt Wiestler and Bjoern Menze}, + year={2025}, + eprint={2507.09036}, + archivePrefix={arXiv}, + primaryClass={cs.CV}, + url={https://arxiv.org/abs/2507.09036}, +} +``` ## Documentation We provide a (WIP) documentation. Have a look [here](https://brainles-preprocessing.readthedocs.io/en/latest/?badge=latest) From a04b75774fd2acba39fa19108fcd4ca4f1b5f6b7 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Wed, 16 Jul 2025 17:57:01 +0200 Subject: [PATCH 3/9] Fix docstrings --- brainles_preprocessing/registration/ANTs/ANTs.py | 2 +- brainles_preprocessing/utils/citation_reminder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/brainles_preprocessing/registration/ANTs/ANTs.py b/brainles_preprocessing/registration/ANTs/ANTs.py index 3e37f2b..a1a9ea1 100644 --- a/brainles_preprocessing/registration/ANTs/ANTs.py +++ b/brainles_preprocessing/registration/ANTs/ANTs.py @@ -241,7 +241,7 @@ def inverse_transform( fixed_image_path (str or Path): Path to the fixed image. moving_image_path (str or Path): Path to the moving image. transformed_image_path (str or Path): Path to the transformed image (output). - matrix_path (str or Path or List[str | Path]): Path to the transformation matrix or a list of matrices. + matrix_path (str or Path or List[str | Path]): Path to the transformation matrix or a list of matrices. log_file_path (str or Path): Path to the log file. interpolator (str): Interpolator to use for the transformation. Default is 'nearestNeighbor'. **kwargs: Additional transformation parameters to update the instantiated defaults. diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index b376deb..57ec789 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -6,7 +6,7 @@ def citation_reminder(func): - """Decorator to remind users to cite panoptica.""" + """Decorator to remind users to cite brainles-preprocessing.""" def wrapper(*args, **kwargs): if ( From 93499442754d5733cf25c53653fba89c26c80ab3 Mon Sep 17 00:00:00 2001 From: "brainless-bot[bot]" <153751247+brainless-bot[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 10:08:38 +0000 Subject: [PATCH 4/9] Autoformat with black --- example/example_native_space_preprocessor.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/example/example_native_space_preprocessor.py b/example/example_native_space_preprocessor.py index e66782f..65a76fd 100644 --- a/example/example_native_space_preprocessor.py +++ b/example/example_native_space_preprocessor.py @@ -90,7 +90,5 @@ def preprocess(input_dir: Path, output_dir: Path): base_dir = Path(__file__).parent preprocess( input_dir=Path(base_dir / f"example_data/{subject}"), - output_dir=Path( - base_dir / f"example_data/native_space_preprocessed_{subject}" - ), + output_dir=Path(base_dir / f"example_data/native_space_preprocessed_{subject}"), ) From 1769994f20568c121dcc824050e49a45a6a1bb4b Mon Sep 17 00:00:00 2001 From: marcel rosier <32431395+MarcelRosier@users.noreply.github.com> Date: Thu, 17 Jul 2025 12:37:04 +0200 Subject: [PATCH 5/9] Update brainles_preprocessing/utils/citation_reminder.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- brainles_preprocessing/utils/citation_reminder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index 57ec789..afc0618 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -8,6 +8,7 @@ def citation_reminder(func): """Decorator to remind users to cite brainles-preprocessing.""" + @functools.wraps(func) def wrapper(*args, **kwargs): if ( os.environ.get("BRAINLES_PREPROCESSING_CITATION_REMINDER", "true").lower() From ea83647e911f57f4c2418011abca6ce406d15a19 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Thu, 17 Jul 2025 12:38:38 +0200 Subject: [PATCH 6/9] Add missing import --- brainles_preprocessing/utils/citation_reminder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index afc0618..b325db6 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -1,3 +1,4 @@ +import functools import os from rich.console import Console From 062be13df8e50cd065ee5bd7b414eba4434559b4 Mon Sep 17 00:00:00 2001 From: neuronflow <7048826+neuronflow@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:09:03 +0200 Subject: [PATCH 7/9] Update brainles_preprocessing/utils/citation_reminder.py why not Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- brainles_preprocessing/utils/citation_reminder.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index b325db6..807ebab 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -7,8 +7,16 @@ def citation_reminder(func): - """Decorator to remind users to cite brainles-preprocessing.""" - + """ + Decorator to remind users to cite brainles-preprocessing. + + The reminder is shown when the environment variable + `BRAINLES_PREPROCESSING_CITATION_REMINDER` is set to "true" (default). + To disable the reminder, set the environment variable to "false". + + Environment variable used: + - BRAINLES_PREPROCESSING_CITATION_REMINDER: Controls whether the reminder is shown. + """ @functools.wraps(func) def wrapper(*args, **kwargs): if ( From 56cfd1e9fa459a87b8138486cb1472e86f7ee7de Mon Sep 17 00:00:00 2001 From: "brainless-bot[bot]" <153751247+brainless-bot[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 11:10:29 +0000 Subject: [PATCH 8/9] Autoformat with black --- brainles_preprocessing/utils/citation_reminder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index 807ebab..803969a 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -9,14 +9,15 @@ def citation_reminder(func): """ Decorator to remind users to cite brainles-preprocessing. - - The reminder is shown when the environment variable + + The reminder is shown when the environment variable `BRAINLES_PREPROCESSING_CITATION_REMINDER` is set to "true" (default). To disable the reminder, set the environment variable to "false". - + Environment variable used: - BRAINLES_PREPROCESSING_CITATION_REMINDER: Controls whether the reminder is shown. """ + @functools.wraps(func) def wrapper(*args, **kwargs): if ( From 32017859668a9316736e747d02f087b9e9986be9 Mon Sep 17 00:00:00 2001 From: Marcel Rosier Date: Thu, 17 Jul 2025 14:37:37 +0200 Subject: [PATCH 9/9] Always show citation reminder if env var is not set to false --- brainles_preprocessing/utils/citation_reminder.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/brainles_preprocessing/utils/citation_reminder.py b/brainles_preprocessing/utils/citation_reminder.py index b325db6..d40552e 100644 --- a/brainles_preprocessing/utils/citation_reminder.py +++ b/brainles_preprocessing/utils/citation_reminder.py @@ -27,9 +27,6 @@ def wrapper(*args, **kwargs): ) console.rule() console.line() - os.environ["BRAINLES_PREPROCESSING_CITATION_REMINDER"] = ( - "false" # Show only once - ) return func(*args, **kwargs) return wrapper