Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pre-commit | Added one unit test #63

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions NiChart_DLMUSE/SegmentImage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import os
import shutil
from typing import Any
import DLMUSE
import DLICV


def run_dlicv(
Expand Down
2 changes: 1 addition & 1 deletion NiChart_DLMUSE/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .dlmuse_pipeline import run_pipeline, run_dlicv, run_dlmuse
from .dlmuse_pipeline import run_dlicv, run_dlmuse, run_pipeline
7 changes: 4 additions & 3 deletions NiChart_DLMUSE/dlmuse_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging
import os
from typing import Any

import pkg_resources # type: ignore

Expand Down Expand Up @@ -39,10 +40,10 @@ def run_pipeline(
in_data: str,
out_dir: str,
device: str,
dlmuse_extra_args: str = '',
dlicv_extra_args: str = '',
dlmuse_extra_args: str = "",
dlicv_extra_args: str = "",
sub_fldr: int = 1,
progress_bar = None,
progress_bar: Any = None,
) -> None:
"""
NiChart pipeline
Expand Down
6 changes: 4 additions & 2 deletions NiChart_DLMUSE/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def remove_common_suffix(list_files: list) -> list:

bnames = list_files
if len(list_files) == 1:
if list_files[0].endswith('_T1'): # If there is a single image with suffix _T1, remove it
if list_files[0].endswith(
"_T1"
): # If there is a single image with suffix _T1, remove it
bnames = [x[0:-3] for x in bnames]
return bnames

Expand Down Expand Up @@ -347,7 +349,7 @@ def remove_subfolders(in_dir: str) -> None:

def merge_output_data(in_dir: str) -> None:
"""
Takes all the results from the temp_working_fir and moves them into
Takes all the results from the temp_working_dir and moves them into
the output folder

:param in_dir: the input directory
Expand Down
16 changes: 14 additions & 2 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
remove_common_suffix,
remove_subfolders,
split_data,
get_bids_prefix
)


Expand Down Expand Up @@ -58,8 +59,19 @@ def testing_make_img_list() -> None:


def testing_get_bids_prefix() -> None:
pass

temp_file = "test-1234"
assert get_bids_prefix(temp_file) == "test"
temp_file = "test-1"
assert get_bids_prefix(temp_file) == "test"
temp_file = "test"
assert get_bids_prefix(temp_file) == "test"

temp_folder = "test_1234"
assert get_bids_prefix(temp_folder, True) == "test"
temp_folder = "test_1"
assert get_bids_prefix(temp_folder, True) == "test"
temp_folder = "test"
assert get_bids_prefix(temp_folder, True) == "test"

def testing_collect_T1() -> None:
os.system("mkdir test_collect_T1")
Expand Down
Loading