From a007ffa235a641ce5bb0e9645fd0a7d47e858db6 Mon Sep 17 00:00:00 2001 From: ncullen93 Date: Fri, 16 Feb 2024 23:23:53 +0100 Subject: [PATCH] test gha workflow --- .github/workflows/wheels.yml | 64 ++------------------ ants/contrib/bids/__init__.py | 2 - ants/contrib/bids/cohort.py | 107 ---------------------------------- 3 files changed, 6 insertions(+), 167 deletions(-) delete mode 100644 ants/contrib/bids/__init__.py delete mode 100644 ants/contrib/bids/cohort.py diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 922c2eaa..96c6c844 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -3,10 +3,10 @@ name: Build on: push: branches: - - master + - master pull_request: branches: - - master + - master release: types: [created] workflow_dispatch: @@ -24,71 +24,19 @@ jobs: # Windows 64-bit - os: windows-latest - python: '3.8' - cibw_python: 38 - platform_id: win_amd64 - - os: windows-latest - python: '3.9' - cibw_python: 39 - platform_id: win_amd64 - - os: windows-latest - python: '3.10' - cibw_python: 310 - platform_id: win_amd64 - - os: windows-latest - python: '3.11' - cibw_python: 311 - platform_id: win_amd64 - - os: windows-latest - python: '3.12' + python: "3.12" cibw_python: 312 platform_id: win_amd64 # Linux 64-bit - os: ubuntu-latest - python: '3.8' - cibw_python: 38 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: '3.9' - cibw_python: 39 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: '3.10' - cibw_python: 310 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: '3.11' - cibw_python: 311 - platform_id: manylinux_x86_64 - - os: ubuntu-latest - python: '3.12' + python: "3.12" cibw_python: 312 platform_id: manylinux_x86_64 # macOS on Intel 64-bit - os: macos-latest - python: '3.8' - cibw_python: 38 - arch: x86_64 - platform_id: macosx_x86_64 - - os: macos-latest - python: '3.9' - cibw_python: 39 - arch: x86_64 - platform_id: macosx_x86_64 - - os: macos-latest - python: '3.10' - cibw_python: 310 - arch: x86_64 - platform_id: macosx_x86_64 - - os: macos-latest - python: '3.11' - cibw_python: 311 - arch: x86_64 - platform_id: macosx_x86_64 - - os: macos-latest - python: '3.12' + python: "3.12" cibw_python: 312 arch: x86_64 platform_id: macosx_x86_64 @@ -214,7 +162,7 @@ jobs: echo $wheeldir mv $mywhl $wheeldir rm -r -f $extrawheeldir $wheeldirx - + - name: Publish package uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 if: ${{ (github.event_name == 'push') && (runner.os == 'Linux') }} diff --git a/ants/contrib/bids/__init__.py b/ants/contrib/bids/__init__.py deleted file mode 100644 index 89b70ebe..00000000 --- a/ants/contrib/bids/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ - -from .cohort import * \ No newline at end of file diff --git a/ants/contrib/bids/cohort.py b/ants/contrib/bids/cohort.py deleted file mode 100644 index 1d802e28..00000000 --- a/ants/contrib/bids/cohort.py +++ /dev/null @@ -1,107 +0,0 @@ -""" -BIDSCohort class for handling BIDS datasets. -This class allows you to streamline various tasks -related to neuroimage processing, machine learning -analysis, and deep learning sampling - - -NOTES ------- -# Example: run N4 bias correction on the T1 images of a BIDS dataset -cohort = BIDSCohort(directory='~/desktop/projects/dlbs-bet/data/raw-bids/') - -def n4(img): - return img.n4_bias_correction() - -cohort.apply_to_images(fn=n4, modality='T1w', subjects='*', - out_suffix='N4') - - - -""" - -import ants - - -class Cohort(object): - """ - Base class for Cohort objects. This class allows - you to streamline the processing and analysis of - medical imaging datasets - """ - def __init__(self): - pass - - -class CSVCohort(Cohort): pass -class FolderCohort(Cohort): pass -class ListCohort(Cohort): pass - - -class CSVSampler(object): - def __init__(self, dataframe, input_reader=None, target_reader=None, - input_transform=None, target_transform=None, co_transform=None, - input_return_processor=None, target_return_processor=None, co_return_processor=None): - pass - - def generate(self): - """ - Return a generator that can be passed in to Keras `fit_generator` - """ - pass - -class BIDSCohort(BIDSLayout): - """ - BIDSCohort class for handling BIDS datasets. - """ - def __init__(self, path, **kwargs): - """ - Initialize a BIDS cohort object - """ - super(BIDSCohort, self).__init__(path=path, **kwargs) - - def apply_to_images(self, fn, modality, image_type=None, subjects='*', out_suffix=''): - for subject in self.subjects: - in_file = self.get_modality(subject=subject, modality=modality) - - img = ants.image_read(in_file) - img_proc = fn(img) - - out_file = in_file.replace('.nii.gz', '%s.nii.gz' % out_suffix) - ants.image_write(img_proc, out_file) - - def __getitem__(self, index): - """ - Access items from the cohort. - - Arguments - --------- - index : string - if index is a subject ID, then a dictionary will be returned - where keys are the available modalities and values is the - file path or list of file paths available for that modality - """ - pass - - def create_sampler(self, inputs, targets, input_reader=None, target_reader=None, - input_transform=None, target_transform=None, co_transform=None, - input_return_processor=None, target_return_processor=None, co_return_processor=None): - """ - Create a BIDSSampler that can be used to generate infinite augmented samples - """ - pass - - - def copy_structure(self, other_directory): - """ - Copy the folder structure of the BIDSCohort - to another base directory, without any of the - actual files being copied. - - This is useful for creating a separate BIDSCohort - for processed data. - """ - pass - - -