Skip to content

Commit

Permalink
Update based on testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkGardnerUSyd committed Aug 13, 2024
1 parent c0a8f07 commit 865feaf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install pytest
pip install pytest-cov
pip install coverage
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: install elastix
run: |
wget -P ~/ElastixDownload "https://github.com/SuperElastix/elastix/releases/download/5.0.1/elastix-5.0.1-linux.tar.bz2"
- 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
# 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
- name: Test with pytest
run: |
mkdir /home/runner/elastix
Expand Down
5 changes: 5 additions & 0 deletions CBCTCardiacSegmentation/DicomHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def PrepareCTData(CTDir,OutputDir='',StructFile='',PreviousNiftiFiles=[],KeepTem
elif isfile(CTDir):
CTNiftiFile = CTDir
StructNiftiDir = ''

else:
print('File type neither directory or file')
CTNiftiFile = ''
StructNiftiDir = ''

return CTNiftiFile,StructNiftiDir

Expand Down
22 changes: 14 additions & 8 deletions tests/test_CBCT_Segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
import subprocess
from pathlib import Path
import sys
import numpy as np
from shutil import rmtree
import glob
import json
from platform import system
import SimpleITK as sitk

from platipy.imaging.tests.data import get_lung_nifti, get_lung_dicom
from platipy.imaging.projects.cardiac.run import run_hybrid_segmentation
from platipy.imaging import ImageVisualiser
from platipy.imaging.label.utils import get_com

'''
For testing/ example purposes it's safest to manually append the path variable to ensure our
Expand All @@ -34,10 +29,17 @@
from CBCTCardiacSegmentation.SegUtil import DoDicomProcessing

def test_DicomProcessing():
CTDicomDir = ''
# Download the test data
data_path = get_lung_dicom()
test_pat_path = data_path.joinpath("LCTSC-Test-S1-101")

CTDicomDir = test_pat_path.joinpath('1.3.6.1.4.1.14519.5.2.1.7014.4598.106943890850011666503487579262')
OutputDir='./DicomProcessing'
DoDicomProcessing(CTDicomDir,OutputDir=OutputDir)

rmtree(data_path)
rmtree(OutputDir)


def test_PlatipyCTSegmentation():
# Download the test data
Expand Down Expand Up @@ -125,11 +127,15 @@ def test_DicomCBCTSegmentationGeneration():

# Download the test data
data_path = get_lung_dicom()
test_pat_path = data_path.joinpath("LCTSC-Test-S1-101")

CBCTDir = test_pat_path.joinpath('1.3.6.1.4.1.14519.5.2.1.7014.4598.106943890850011666503487579262')
PlanningCTDir = test_pat_path.joinpath('1.3.6.1.4.1.14519.5.2.1.7014.4598.106943890850011666503487579262')

SegmentationMethods = ['Direct','Synthetic','Transform','Test']

CBCTDir = '' #Is a dicom directory file
PlanningCTDir = ''
#CBCTDir = '' #Is a dicom directory file
#PlanningCTDir = ''
ElastixParamDir = ''
StructFile = ''

Expand Down

0 comments on commit 865feaf

Please sign in to comment.