Skip to content

Commit ddcc838

Browse files
committed
catching no given arguments
1 parent 188d64f commit ddcc838

4 files changed

Lines changed: 19 additions & 17 deletions

File tree

.gitlab-ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ test_pytest:
4141
rules:
4242
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
4343

44-
#test_run_parcellate:
45-
# extends: test_pytest
46-
# before_script:
47-
# - *default_before_script
48-
# - pip install .
49-
# - mkdir test/test_results/ -p
50-
# script:
51-
# - 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
44+
test_run_parcellate:
45+
extends: test_pytest
46+
before_script:
47+
- *default_before_script
48+
- pip install .
49+
- mkdir tests/test_results/ -p
50+
script:
51+
- 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
5252

5353
#test_run_features:
5454
# extends: test_run_parcellate

radtract/features.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from nibabel.affines import apply_affine
1414
import SimpleITK as sitk
1515
from cmdint.Utils import ProgressBar
16+
import sys
1617

1718

1819
def map_check(data: np.ndarray,
@@ -341,6 +342,10 @@ def load_features(feature_file_names: list, select=[], drop=[], expected_parcels
341342

342343
def main():
343344

345+
if len(sys.argv) == 1:
346+
print('type \'radtract_features -h\' for help')
347+
return
348+
344349
parser = argparse.ArgumentParser(description='RadTract Feature Calculation')
345350
parser.add_argument('--parcellation', type=str, help='Input parcellation file')
346351
parser.add_argument('--map', type=str, help='Parameter map file (e.g. fractional anisotropy)')

radtract/parcellation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
import nibabel as nib
6-
import numpy.linalg
76
from nibabel.affines import apply_affine
87
from skimage.morphology import binary_dilation, binary_closing
98
from sklearn.svm import SVC
@@ -19,6 +18,7 @@
1918
import argparse
2019
import joblib
2120
import multiprocessing
21+
import sys
2222

2323

2424
def load_trk_streamlines(filename: str):
@@ -518,6 +518,11 @@ def parcellate_tract(streamlines: nib.streamlines.array_sequence.ArraySequence,
518518

519519

520520
def main():
521+
522+
if len(sys.argv) == 1:
523+
print('type \'radtract_parcellate -h\' for help')
524+
return
525+
521526
parser = argparse.ArgumentParser(description='RadTract Tract Parcellation')
522527
parser.add_argument('--streamlines', type=str, help='Input streamline file')
523528
parser.add_argument('--envelope', type=str, help='Input streamline envelope file', default=None)

radtract/prediction.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,3 @@ def run_cv_experiment(feature_files, targets, remove_map_substrings=[], n_jobs=-
154154
print('Done')
155155

156156
return predictions, ground_truth, classifiers
157-
158-
159-
def main():
160-
pass
161-
162-
163-
if __name__ == '__main__':
164-
main()

0 commit comments

Comments
 (0)