diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7d8b53d..fa41839 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -41,14 +41,14 @@ test_pytest: rules: - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH -#test_run_parcellate: -# extends: test_pytest -# before_script: -# - *default_before_script -# - pip install . -# - mkdir test/test_results/ -p -# script: -# - radtract_parcellate --streamlines tests/test_data/test_tract.trk --envelope tests/test_data/test_tract_envelope.nii.gz --start tests/test_data/test_tract_b.nii.gz --num_parcels 5 --output test/test_results/hyperplane_parcellation_command.nii.gz +test_run_parcellate: + extends: test_pytest + before_script: + - *default_before_script + - pip install . + - mkdir tests/test_results/ -p + script: + - radtract_parcellate --streamlines tests/test_data/test_tract.trk --envelope tests/test_data/test_tract_envelope.nii.gz --start tests/test_data/test_tract_b.nii.gz --num_parcels 5 --output tests/test_results/hyperplane_parcellation_command.nii.gz #test_run_features: # extends: test_run_parcellate diff --git a/radtract/features.py b/radtract/features.py index cf08077..d6796ca 100644 --- a/radtract/features.py +++ b/radtract/features.py @@ -13,6 +13,7 @@ from nibabel.affines import apply_affine import SimpleITK as sitk from cmdint.Utils import ProgressBar +import sys def map_check(data: np.ndarray, @@ -341,6 +342,10 @@ def load_features(feature_file_names: list, select=[], drop=[], expected_parcels def main(): + if len(sys.argv) == 1: + print('type \'radtract_features -h\' for help') + return + parser = argparse.ArgumentParser(description='RadTract Feature Calculation') parser.add_argument('--parcellation', type=str, help='Input parcellation file') parser.add_argument('--map', type=str, help='Parameter map file (e.g. fractional anisotropy)') diff --git a/radtract/parcellation.py b/radtract/parcellation.py index 4a5774e..1a760ec 100644 --- a/radtract/parcellation.py +++ b/radtract/parcellation.py @@ -3,7 +3,6 @@ # SPDX-License-Identifier: Apache-2.0 import nibabel as nib -import numpy.linalg from nibabel.affines import apply_affine from skimage.morphology import binary_dilation, binary_closing from sklearn.svm import SVC @@ -19,6 +18,7 @@ import argparse import joblib import multiprocessing +import sys def load_trk_streamlines(filename: str): @@ -518,6 +518,11 @@ def parcellate_tract(streamlines: nib.streamlines.array_sequence.ArraySequence, def main(): + + if len(sys.argv) == 1: + print('type \'radtract_parcellate -h\' for help') + return + parser = argparse.ArgumentParser(description='RadTract Tract Parcellation') parser.add_argument('--streamlines', type=str, help='Input streamline file') parser.add_argument('--envelope', type=str, help='Input streamline envelope file', default=None) diff --git a/radtract/prediction.py b/radtract/prediction.py index 4899d52..38fd290 100644 --- a/radtract/prediction.py +++ b/radtract/prediction.py @@ -154,11 +154,3 @@ def run_cv_experiment(feature_files, targets, remove_map_substrings=[], n_jobs=- print('Done') return predictions, ground_truth, classifiers - - -def main(): - pass - - -if __name__ == '__main__': - main()