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

Initial CI setup #55

Merged
merged 10 commits into from
Jun 23, 2021
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Install VTK dependencies
run: |
sudo apt-get update
sudo apt-get install libsm6 libgl1-mesa-glx
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('envs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install flake8
export QT_QPA_PLATFORM=offscreen
if [ -f envs/requirements.txt ]; then pip install -r envs/requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude stitch
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude stitch
- name: Test with pytest
run: |
# TODO: add image artifact
#python -u -m magmap.tests.unit_testing
python -u -m magmap.tests.test_libmag
6 changes: 3 additions & 3 deletions envs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ imageio==2.9.0
importlib-metadata==3.10.0
importlib-resources==5.1.2
iniconfig==1.1.1
javabridge==1.0.18.post21+g4526f53
javabridge==1.0.19.post4+gbebed64
Jinja2==2.11.3
jmespath==0.10.0
joblib==1.0.1
Expand Down Expand Up @@ -53,7 +53,7 @@ s3transfer==0.3.6
scikit-image==0.17.2
scikit-learn==0.24.1
scipy==1.5.4
SimpleITK==1.2.0rc2.dev1162+g2a79d
SimpleITK==2.0.2rc2.dev785+g8ac4f
six==1.15.0
threadpoolctl==2.1.0
tifffile==2020.9.3
Expand All @@ -62,5 +62,5 @@ traits==6.2.0
traitsui==7.1.1
typing-extensions==3.7.4.3
urllib3==1.26.5
vtk==8.1.2
vtk==9.0.1
zipp==3.4.1
2 changes: 2 additions & 0 deletions magmap/cv/segmenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def segment_ws(roi, channel, thresholded=None, blobs=None):
of labels given as an image of the same shape as ``roi``.
"""
labels = []
labels_ws = None
multichannel, channels = plot_3d.setup_channels(roi, channel, 3)
for i in channels:
roi_segment = roi[..., i] if multichannel else roi
Expand All @@ -157,6 +158,7 @@ def segment_ws(roi, channel, thresholded=None, blobs=None):
if blobs is None:
# default to finding peaks of distance transform if no blobs
# given, using an anisotropic footprint
distance = ndimage.distance_transform_edt(thresholded)
try:
local_max = feature.peak_local_max(
distance, indices=False, footprint=np.ones((1, 3, 3)),
Expand Down
10 changes: 5 additions & 5 deletions magmap/gui/roi_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1204,11 +1204,11 @@ def on_motion(event):
if labels is not None:
for i in range(len(labels)):
label = labels[i]
if z_relative >= 0 and z_relative < label.shape[0]:
ax.imshow(
label[z_relative], cmap=cmap_labels,
norm=cmap_labels.norm)
#ax.imshow(label[z_relative]) # showing only threshold
if 0 <= z_relative < label.shape[0]:
img = label[z_relative]
if img.ndim > 1:
ax.imshow(
img, cmap=cmap_labels, norm=cmap_labels.norm)

if ((segs_in is not None or segs_out is not None)
and not circles == self.CircleStyles.NO_CIRCLES):
Expand Down