Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
d178203
misc build & test framework updates
casperdcl Oct 3, 2021
f7fef87
added Path object to dcminfo
pjmark Oct 21, 2021
2f9a144
Merge branch 'devel' of github.com:NiftyPET/NIMPA into devel
pjmark Oct 21, 2021
e3991c3
added sinogram dtype in dcminfo function
pjmark Oct 21, 2021
0813021
fixing dcmsort for cases when series descr not given
pjmark Oct 21, 2021
1627736
added PET, MR, SIGNA for DICOM info in dcminfo()
pjmark Oct 24, 2021
389970f
further improvements on DICOM info extraction
pjmark Oct 24, 2021
27bc8c5
little bug in DICOM info extraction
pjmark Oct 24, 2021
9d06fa3
another bug in DICOM info extraction
pjmark Oct 24, 2021
c152a7f
posix paths in bais field correction function in prc.py
pjmark Oct 25, 2021
1e95ea1
posix bug fix
pjmark Oct 25, 2021
df72572
adding basic dcminfo outputs option
pjmark Oct 27, 2021
dfc19c9
adding another option of finding T1w sequence using dcminfo()
pjmark Oct 27, 2021
9467c1b
added another possible extension of DICOM file - img
pjmark Oct 27, 2021
d9b073d
added functionality for dcminfo()
pjmark Oct 27, 2021
f0759c3
added study and series times and dates
pjmark Oct 27, 2021
edec216
enabling imtrimup to use PurePaths
pjmark Oct 27, 2021
ccfb8a9
fixing bug with pathlib in imtrimup()
pjmark Oct 28, 2021
b644a79
fix formatting
casperdcl Oct 31, 2021
6589206
img_resample: minor log bugfix
casperdcl Oct 31, 2021
ac27adb
prc: add `conv_separable(output)` & `imsmooth(output_array)`
casperdcl Oct 31, 2021
9d204e2
prc: expose `conv_separable(sync)` & `imsmooth(sync)`
casperdcl Oct 31, 2021
16f1940
bump cuvec version
casperdcl Nov 1, 2021
6fd266f
use asPyCuVec_f convenience
casperdcl Nov 1, 2021
1671089
fix unused prc.nlm(output)
casperdcl Nov 1, 2021
59fa26f
bump py3.6 tests
casperdcl Nov 2, 2021
cd5aed5
fixed bug in dcminfo() for unused dose calib factor
pjmark Nov 2, 2021
00a1fac
fixed bugs with DICOM sorter dcmsort()
pjmark Nov 11, 2021
e2455fb
misc tidy & fixes
casperdcl Nov 27, 2021
85ac6b0
fix CuVec optional output arrays
casperdcl Nov 27, 2021
fa091e6
misc tidy & framework updates
casperdcl Nov 27, 2021
abc6cf4
improc: expose nlm(sync)
casperdcl Nov 27, 2021
7cfce25
improc: add isub
casperdcl Nov 27, 2021
c47b250
isub dtype uint => int
casperdcl Nov 27, 2021
b448dbe
expose nlm, isub
casperdcl Nov 27, 2021
06ada8a
rename source isub2d => isub
casperdcl Nov 27, 2021
e500204
remove unnecessary NULL checks
casperdcl Nov 27, 2021
0dba93b
cleanup
casperdcl Nov 27, 2021
9fe4742
improc: add `div`
casperdcl Nov 27, 2021
807cd48
tests: improc.div
casperdcl Nov 27, 2021
6a59261
remove unnecessary cu.asarray
casperdcl Nov 27, 2021
831271b
improc: rename source div => elemwise
casperdcl Nov 27, 2021
8f1274b
improc.elemwise: add `mul` & tests
casperdcl Nov 27, 2021
d45d3bb
expose conv_separable, tidy imports
casperdcl Nov 27, 2021
dbc1a61
improc: fix isub dtype
casperdcl Nov 28, 2021
43b2527
prc.imsmooth: make voxsize optional
casperdcl Nov 28, 2021
119be59
added correction for centre of mass as a precondition of SPM registra…
pjmark Dec 25, 2021
d7ff5b2
added resampling using DIPY
pjmark Dec 31, 2021
3a1ee03
lint
casperdcl Jan 2, 2022
de05b6d
check_cuvec convenience
casperdcl Jan 2, 2022
5aa974b
improc.elemwise: add `add` & tests
casperdcl Jan 2, 2022
8d473c5
deps: require dipy by default
casperdcl Jan 2, 2022
a609752
added DIPY affine/rigid registration
pjmark Jan 3, 2022
89753b5
merging with dipy registration
pjmark Jan 3, 2022
22977e9
fix merge
casperdcl Jan 3, 2022
f10e8ff
prc.numcu module
casperdcl Jan 4, 2022
e164982
prc.numcu: CPU versions
casperdcl Jan 4, 2022
21ac9fb
use NumCu
casperdcl Jan 8, 2022
2cca4e7
added an option of flipping any image dimension in correction for cen…
pjmark Jan 11, 2022
7b64f52
Merge branch 'devel' of github.com:NiftyPET/NIMPA into devel
pjmark Jan 11, 2022
74aebe3
minor modification of bias field correction dictionary output
pjmark Jan 11, 2022
814d4ec
fixed bug in the smoothing function when input given as dictionary
pjmark Jan 12, 2022
7099d6e
important bug fix in NIfTI image read getnii()
pjmark Jan 13, 2022
fb6be08
dcm2niix => dicom2nifti
casperdcl Oct 31, 2021
d502e95
add fimout support
casperdcl Oct 31, 2021
819f7b6
fix deprecated dependency_links
casperdcl Nov 11, 2021
7c636aa
re-add DCM2NIIX option
casperdcl Jan 13, 2022
badae99
prc.imio: auto-detect dcm2nii tool
casperdcl Jan 14, 2022
c100606
add optional dcm2niix python package
casperdcl Jan 15, 2022
70da069
drop dicom2nifti
casperdcl Jan 16, 2022
ff0b7e3
Merge pull request #24 from NiftyPET/dicom2nifti
casperdcl Jan 16, 2022
bf6d8e7
minor framework updates
casperdcl Jan 16, 2022
e18b70f
update miutil
casperdcl Jan 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test
on: [push, pull_request]
jobs:
check:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
if: github.event_name != 'pull_request' || github.repository_owner != 'NiftyPET'
runs-on: ubuntu-latest
name: Check
steps:
Expand All @@ -19,7 +19,7 @@ jobs:
pip install -U pre-commit
sudo apt-get install -yqq clang-format
- uses: reviewdog/action-setup@v1
- if: github.event_name != 'schedule'
- if: github.event_name == 'push' || github.event_name == 'pull_request'
name: comment
run: |
if [[ $EVENT == pull_request ]]; then
Expand All @@ -34,12 +34,12 @@ jobs:
EVENT: ${{ github.event_name }}
- run: pre-commit run -a --show-diff-on-failure
test:
if: github.event_name != 'pull_request' || github.head_ref != 'devel'
if: github.event_name != 'pull_request' || github.repository_owner != 'NiftyPET'
name: Test py${{ matrix.python }}
runs-on: [self-hosted, cuda, python]
strategy:
matrix:
python: [3.6, 3.9]
name: Test py${{ matrix.python }}
python: [3.7, 3.9]
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -48,7 +48,7 @@ jobs:
run: setup-python -p${{ matrix.python }}
- run: pip install -U -e .[dev]
- run: pytest
- run: codecov
- uses: codecov/codecov-action@v1
- name: Post Run setup-python
run: setup-python -p${{ matrix.python }} -Dr
if: ${{ always() }}
Expand Down
11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand Down Expand Up @@ -31,21 +31,24 @@ repos:
- id: flake8
args: [-j8]
additional_dependencies:
- flake8-broken-line
- flake8-bugbear
- flake8-comprehensions
- flake8-debugger
- flake8-isort
- flake8-string-format
- repo: https://github.com/google/yapf
rev: 6db9374
rev: v0.32.0
hooks:
- id: yapf
args: [-i]
additional_dependencies: [toml]
- repo: https://github.com/PyCQA/isort
rev: 5.9.3
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/doublify/pre-commit-clang-format
rev: master
rev: '6230247'
hooks:
- id: clang-format
files: \.(cc?|cuh?|cxx|cpp|h|hpp|hxx|java|js)$
Expand Down
31 changes: 22 additions & 9 deletions niftypet/nimpa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,25 @@
'LOG_FORMAT', 'LogHandler',
# config
'path_resources', 'resources', 'cmake_prefix',
# numcu
'add', 'div', 'mul',
# improc
'conv_separable', 'isub', 'nlm',
# core
'create_disk', 'imdiff', 'imscroll', 'profile_points', 'imtrimup',
'affine_fsl', 'affine_niftyreg', 'array2nii', 'bias_field_correction',
'centre_mass_img', 'coreg_spm', 'coreg_vinci', 'create_dir', 'create_mask',
'ct2mu', 'dcm2im', 'dcm2nii', 'dcmanonym', 'dcminfo', 'dcmsort',
'dice_coeff', 'dice_coeff_multiclass', 'fwhm2sig', 'getnii', 'getnii_descr',
'im_cut', 'imfill', 'imsmooth', 'iyang', 'motion_reg', 'nii_gzip',
'nii_modify', 'nii_ugzip', 'niisort', 'orientnii', 'pet2pet_rigid',
'pick_t1w', 'psf_gaussian', 'psf_measured', 'pvc_iyang', 'realign_mltp_spm',
'resample_fsl', 'resample_mltp_spm', 'resample_niftyreg', 'resample_spm',
'resample_vinci', 'time_stamp'] # yapf: disable
'affine_fsl', 'affine_dipy', 'affine_niftyreg',
'array2nii', 'bias_field_correction',
'centre_mass_img', 'centre_mass_corr', 'coreg_spm', 'coreg_vinci',
'create_dir', 'create_mask', 'ct2mu',
'dcm2im', 'dcm2nii', 'dcmanonym', 'dcminfo', 'dcmsort',
'dice_coeff', 'dice_coeff_multiclass', 'fwhm2sig', 'getnii',
'getnii_descr', 'im_cut', 'imfill', 'imsmooth', 'iyang', 'motion_reg', 'nii_gzip',
'nii_modify', 'nii_ugzip', 'niisort', 'orientnii', 'pet2pet_rigid', 'pick_t1w',
'psf_gaussian', 'psf_measured', 'pvc_iyang', 'realign_mltp_spm', 'resample_fsl',
'resample_mltp_spm', 'resample_niftyreg', 'resample_spm', 'resample_vinci', 'resample_dipy',
'time_stamp'] # yapf: disable

from numcu import add, div, mul
from pkg_resources import resource_filename

from niftypet.ninst import cudasetup as cs
Expand All @@ -40,11 +47,14 @@
from .img import create_disk, imdiff, imscroll, profile_points
from .prc import imtrimup # for backward compatibility
from .prc import (
affine_dipy,
affine_fsl,
affine_niftyreg,
array2nii,
bias_field_correction,
centre_mass_corr,
centre_mass_img,
conv_separable,
coreg_spm,
coreg_vinci,
create_dir,
Expand All @@ -63,19 +73,22 @@
im_cut,
imfill,
imsmooth,
isub,
iyang,
motion_reg,
nii_gzip,
nii_modify,
nii_ugzip,
niisort,
nlm,
orientnii,
pet2pet_rigid,
pick_t1w,
psf_gaussian,
psf_measured,
pvc_iyang,
realign_mltp_spm,
resample_dipy,
resample_fsl,
resample_mltp_spm,
resample_niftyreg,
Expand Down
5 changes: 3 additions & 2 deletions niftypet/nimpa/img/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""
import logging
import math
import pathlib

import numpy as np
import scipy.ndimage as ndi
Expand Down Expand Up @@ -80,9 +81,9 @@ def profile_points(im, p0, p1, steps=100):
def imdiff(imref, imnew, verbose=False, plot=False, cmap='bwr'):
"""
Compare the new image (imnew) to the reference image (imref),
returning (and optionallt plotting) the difference.
returning (and optional plotting) the difference.
"""
if isinstance(imref, str):
if isinstance(imref, (str, pathlib.Path)):
imref = imio.getnii(imref)
log.info('using NIfTI files as image input for the reference')
elif isinstance(imref, (np.ndarray, np.generic)):
Expand Down
7 changes: 7 additions & 0 deletions niftypet/nimpa/include/isub.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#ifndef _NIMPA_ISUB_H_
#define _NIMPA_ISUB_H_

/// 2D
void d_isub(float *dst, const float *src, const int *idxs, int J, int X, bool _sync = true);

#endif // _NIMPA_ISUB_H_
2 changes: 1 addition & 1 deletion niftypet/nimpa/include/nlm.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

/// main NLM function
void d_nlm3d(float *dst, const float *src, const float *ref, float sigma, int Z, int Y, int X,
int HALF_WIDTH, bool _sync);
int HALF_WIDTH, bool _sync = true);

#endif // _NIMPA_NLM_H_
27 changes: 17 additions & 10 deletions niftypet/nimpa/prc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# initialise the module folder
__all__ = [
# imio
'array2nii', 'create_dir', 'dcm2im', 'dcm2nii', 'dcmanonym', 'dcminfo',
'dcmsort', 'fwhm2sig', 'getnii', 'getnii_descr', 'nii_gzip', 'nii_ugzip',
'niisort', 'orientnii', 'pick_t1w', 'time_stamp',
'array2nii', 'create_dir', 'dcm2im', 'dcm2nii', 'dcmanonym', 'dcminfo', 'dcmsort', 'fwhm2sig',
'getnii', 'getnii_descr', 'nii_gzip', 'nii_ugzip', 'niisort', 'orientnii', 'pick_t1w',
'time_stamp',
# prc
'bias_field_correction', 'centre_mass_img', 'ct2mu', 'im_cut', 'imsmooth',
'imtrimup', 'iyang', 'nii_modify', 'pet2pet_rigid', 'psf_gaussian',
'psf_measured', 'pvc_iyang',
'bias_field_correction', 'centre_mass_img', 'centre_mass_corr', 'ct2mu', 'im_cut',
'imsmooth', 'imtrimup',
'iyang', 'nii_modify', 'pet2pet_rigid', 'psf_gaussian', 'psf_measured', 'pvc_iyang',
# num
'conv_separable', 'isub', 'nlm',
# regseg
'affine_fsl', 'affine_niftyreg', 'coreg_spm', 'coreg_vinci', 'create_mask',
'dice_coeff', 'dice_coeff_multiclass', 'imfill', 'motion_reg',
'realign_mltp_spm', 'resample_fsl', 'resample_mltp_spm',
'resample_niftyreg', 'resample_spm', 'resample_vinci'] # yapf: disable
'affine_dipy', 'affine_fsl', 'affine_niftyreg',
'coreg_spm', 'coreg_vinci', 'create_mask', 'dice_coeff', 'dice_coeff_multiclass',
'imfill', 'motion_reg', 'realign_mltp_spm', 'resample_fsl', 'resample_dipy',
'resample_mltp_spm', 'resample_niftyreg', 'resample_spm',
'resample_vinci'] # yapf: disable

from .imio import (
array2nii,
Expand All @@ -32,10 +35,12 @@
pick_t1w,
time_stamp,
)
from .num import conv_separable, isub, nlm

# will be deprecated
from .prc import (
bias_field_correction,
centre_mass_corr,
centre_mass_img,
ct2mu,
im_cut,
Expand All @@ -49,6 +54,7 @@
pvc_iyang,
)
from .regseg import (
affine_dipy,
affine_fsl,
affine_niftyreg,
coreg_spm,
Expand All @@ -59,6 +65,7 @@
imfill,
motion_reg,
realign_mltp_spm,
resample_dipy,
resample_fsl,
resample_mltp_spm,
resample_niftyreg,
Expand Down
Loading