Skip to content

Commit

Permalink
catching no given arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
peterneher committed Sep 26, 2023
1 parent 188d64f commit ddcc838
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
16 changes: 8 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions radtract/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)')
Expand Down
7 changes: 6 additions & 1 deletion radtract/parcellation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -19,6 +18,7 @@
import argparse
import joblib
import multiprocessing
import sys


def load_trk_streamlines(filename: str):
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 0 additions & 8 deletions radtract/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit ddcc838

Please sign in to comment.