Skip to content

Commit

Permalink
Merge pull request #48 from neuronflow/deprecated_prep
Browse files Browse the repository at this point in the history
Deprecated prep
  • Loading branch information
neuronflow authored Dec 10, 2023
2 parents 74a48bf + 810fbc5 commit 477fe20
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
3 changes: 0 additions & 3 deletions 0_preprocessing_batch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import os
from path import Path

from brats_toolkit.preprocessor import Preprocessor

# instantiate
Expand Down
2 changes: 0 additions & 2 deletions 1_segmentation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import datetime

from brats_toolkit.segmentor import Segmentor


# log
starttime = str(datetime.datetime.now().time())
print("*** starting at", starttime, "***")
Expand Down
4 changes: 1 addition & 3 deletions 2_fusion.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
from path import Path
import datetime

from brats_toolkit.fusionator import Fusionator
Expand All @@ -12,7 +10,7 @@
fus = Fusionator(verbose=True)

# input
SOURCEDIR = Path("example_data/output_segmentor/TCGA-DU-7294/")
SOURCEDIR = "example_data/output_segmentor/TCGA-DU-7294/"
# output
OUTPUTDIR = "example_data/output_fusionator/TCGA-DU-7294/"

Expand Down
14 changes: 9 additions & 5 deletions brats_toolkit/preprocessor.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import socketio
from brats_toolkit.util.docker_functions import start_docker, stop_docker, update_docker
import os
import sys
import tempfile
from pathlib import Path

import socketio

from brats_toolkit.util.citation_reminder import (
citation_reminder,
deprecated_preprocessor,
)
from brats_toolkit.util.docker_functions import start_docker, stop_docker, update_docker
from brats_toolkit.util.prep_utils import tempFiler
from brats_toolkit.util.citation_reminder import citation_reminder
import sys


class Preprocessor(object):

@citation_reminder
@deprecated_preprocessor
def __init__(self, noDocker=False):
# settings
self.clientVersion = "0.0.1"
Expand Down
38 changes: 34 additions & 4 deletions brats_toolkit/util/citation_reminder.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
from rich.console import Console

def citation_reminder(func):

def citation_reminder(func):
def wrapper(*args, **kwargs):
console = Console()
console.rule("[bold red]Friendly citation reminder[/bold red]")
console.print("If you use this software in your research, please [bold cyan]cite[/bold cyan] BraTS Toolkit and the original authors of the algorithms who make this repository and tool possible.", justify="center")
console.print("Details can be found at https://github.com/neuronflow/BraTS-Toolkit#citation", justify="center")
console.print(
"If you use this software in your research, please [bold cyan]cite[/bold cyan] BraTS Toolkit and the original authors of the algorithms who make this repository and tool possible.",
justify="center",
)
console.print(
"Details can be found at https://github.com/neuronflow/BraTS-Toolkit#citation",
justify="center",
)
console.print("Thank you!", justify="center")
console.rule()
console.line()
func(*args, **kwargs)
return wrapper

return wrapper


def deprecated_preprocessor(func):
def wrapper(*args, **kwargs):
console = Console()
console.rule("[bold red]Deprecation note[/bold red]")
console.print(
"Support for BraTS Toolkit's preprocessor will be deprecated soon, even though it should continue working.",
justify="center",
)
console.print(
"You can already beta test the new BrainLes preprocessing pipeline which allows for arbitrary sequences and implements multiple backends for registration and brain extration and. Furthermore it does not require docker",
justify="center",
)
console.print(
"visit https://github.com/BrainLesion/preprocessing to learn more",
justify="center",
)
console.rule()
console.line()
func(*args, **kwargs)

return wrapper

0 comments on commit 477fe20

Please sign in to comment.