Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into atheb/fix_connect…
Browse files Browse the repository at this point in the history
…ivity_visualize
  • Loading branch information
AntoineTheb committed Feb 9, 2024
2 parents d4eb976 + 41078d0 commit 325271f
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 152 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/freeze_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
freeze_requirements:
runs-on: ubuntu-latest
runs-on: scilus-runners
steps:
-
name: Checkout scilpy
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Scilpy test suite

on:
push:
branches:
- master
pull_request_target:
branches:
- master

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
MPLBACKEND: agg
OPENBLAS_NUM_THREADS: 1

jobs:
test:
runs-on: scilus-runners
steps:
- name: Checkout repository
uses: actions/[email protected]

- name: Fetch python version from repository
id: python-selector
run: echo "python-version=$(cat .python-version)" >> $GITHUB_OUTPUT

- name: Set up Python for Scilpy
uses: actions/[email protected]
with:
python-version: ${{ steps.python-selector.outputs.python-version }}
cache: 'pip'

- name: Install non-python dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
curl \
git \
libblas-dev \
liblapack-dev \
libfreetype6-dev
- name: Install Scilpy
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .
- name: Run tests
run: |
export C_INCLUDE_PATH=$pythonLocation/include/python${{ steps.python-selector.outputs.python-version }}:$C_INCLUDE_PATH
pytest --cov-report term-missing:skip-covered
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: unittests
name: scilpy-unittests-${{ github.run_id }}
verbose: true
directory: .test_reports/
fail_ci_if_error: true
root_dir: $GITHUB_WORKSPACE/scilpy/

- name: Upload test reports and coverage to artifacts
uses: actions/[email protected]
with:
name: test-reports
path: |
.test_reports/*
114 changes: 0 additions & 114 deletions Jenkinsfile

This file was deleted.

1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include LICENSE
include requirements.txt
include .python-version

recursive-include data/LUT *
recursive-include scilpy *.c
recursive-include scilpy *.cpp
recursive-include scilpy *.pyx
34 changes: 34 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
codecov:
allow_coverage_offsets: True

coverage:
status:
project:
default:
target: 75%
threshold: 2%
branches:
- master
if_ci_failed: error
only_pulls: false
patch:
default:
target: 90%
branches:
- master
if_ci_failed: error
only_pulls: false

component_management:
individual_components:
- component_id: scilpy_scripts
name: Scripts
paths:
- scripts/
- component_id: scilpy_library
name: Library
paths:
- scilpy/

comment:
layout: "condensed_header, diff, components"
4 changes: 3 additions & 1 deletion scripts/scil_tractogram_assign_custom_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,9 @@ def main():
data = np.clip(data, np.quantile(data, 0.05),
np.quantile(data, 0.95))
elif args.use_dpp:
data = np.squeeze(sft.data_per_point[args.use_dpp]._data)
tmp = [np.squeeze(sft.data_per_point[args.use_dpp][s]) for s in
range(len(sft))]
data = np.hstack(tmp)
elif args.load_dps:
data = np.squeeze(load_matrix_in_any_format(args.load_dps))
if len(data) != len(sft):
Expand Down
7 changes: 3 additions & 4 deletions scripts/scil_tractogram_filter_by_anatomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import json
import logging
import os
import pkg_resources
import importlib.resources as resources

from dipy.io.streamline import save_tractogram
from dipy.io.utils import is_header_compatible
Expand Down Expand Up @@ -142,9 +142,8 @@ def load_wmparc_labels():
Load labels dictionary of different parcellations from the
Desikan-Killiany atlas
"""
resource_package = pkg_resources.get_distribution('scilpy').location
labels_path = os.path.join(
resource_package, 'data/LUT/dk_aggregate_structures.json')
lut_package = resources.files('data').joinpath('LUT')
labels_path = lut_package.joinpath('dk_aggregate_structures.json')
with open(labels_path) as labels_file:
labels = json.load(labels_file)
return labels
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def test_help_option(script_runner):
ret = script_runner.run('scil_assign_custom_color_to_tractogram.py',
ret = script_runner.run('scil_tractogram_assign_custom_color.py',
'--help')
assert ret.success

Expand All @@ -24,7 +24,7 @@ def test_execution_tractometry(script_runner):
'IFGWM.trk')
in_anat = os.path.join(get_home(), 'tractometry',
'IFGWM_labels_map.nii.gz')
ret = script_runner.run('scil_assign_custom_color_to_tractogram.py',
ret = script_runner.run('scil_tractogram_assign_custom_color.py',
in_bundle, 'colored.trk', '--from_anatomy',
in_anat)
assert ret.success
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


def test_help_option(script_runner):
ret = script_runner.run('scil_assign_uniform_color_to_tractograms.py',
ret = script_runner.run('scil_tractogram_assign_uniform_color.py',
'--help')
assert ret.success

Expand All @@ -22,7 +22,7 @@ def test_execution_tractometry(script_runner):
os.chdir(os.path.expanduser(tmp_dir.name))
in_bundle = os.path.join(get_home(), 'tractometry',
'IFGWM.trk')
ret = script_runner.run('scil_assign_uniform_color_to_tractograms.py',
ret = script_runner.run('scil_tractogram_assign_uniform_color.py',
in_bundle, '--fill_color', '0x000000',
'--out_tractogram', 'colored.trk')
assert ret.success

0 comments on commit 325271f

Please sign in to comment.