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

Rearchitect and Reinstate GPU #114

Open
wants to merge 319 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
319 commits
Select commit Hold shift + click to select a range
9423847
Bump NiftyReg version
onurulgen Mar 1, 2023
323182c
Generate coverage and upload it to Coveralls
onurulgen Mar 2, 2023
07e0558
Add badge for the coverage
onurulgen Mar 2, 2023
8538e7f
Add RNifti library
onurulgen Mar 6, 2023
414622b
Add NiftiImageData::Iterator::reset() to reset the iterator
onurulgen Mar 7, 2023
c631dc0
Add move constructor and assignment operator for NiftiImage
onurulgen Mar 7, 2023
4015cbf
Refactorise NiftiImage
onurulgen Mar 7, 2023
5bf6ca8
Add utility functions to NiftiImage
onurulgen Mar 13, 2023
a3b0cc9
Fix dimensions after initialisation of NiftiImage
onurulgen Mar 13, 2023
c863946
Fix a bug causing accessing freed memory in reg_io_WriteImageFile()
onurulgen Mar 13, 2023
43686ab
Refactorisations
onurulgen Mar 13, 2023
61de023
Refactor reg_createControlPointGrid() using automatic memory management
onurulgen Mar 13, 2023
001d498
Refactor reg_createSymmetricControlPointGrids() using automatic memor…
onurulgen Mar 13, 2023
058d4e9
Refactor reg_createImagePyramid() using automatic memory management
onurulgen Mar 13, 2023
0c1e715
Refactor reg_createMaskPyramid() using automatic memory management
onurulgen Mar 13, 2023
3a6d10c
Refactor reg_aladin class using automatic memory management
onurulgen Mar 13, 2023
1130e1f
Refactor reg_aladin_sym class using automatic memory management
onurulgen Mar 13, 2023
591fa91
Refactor reg_aladin app using automatic memory management
onurulgen Mar 13, 2023
4e5db2c
Refactor reg_base class using automatic memory management
onurulgen Mar 13, 2023
099572c
Refactor reg_f3d class using automatic memory management
onurulgen Mar 13, 2023
76c6652
Refactor reg_f3d2 class using automatic memory management
onurulgen Mar 13, 2023
ea8fac0
Refactor reg_f3d app using automatic memory management
onurulgen Mar 13, 2023
d9bc22b
Refactor reg_test_imageGradient using NiftiImage
onurulgen Mar 13, 2023
4f22230
Small fixes
onurulgen Mar 13, 2023
876a88d
Add NiftiImage::disown() to release the wrapped pointer
onurulgen Mar 14, 2023
495ce95
Use NiftiImage::disown() in reg_test_imageGradient
onurulgen Mar 14, 2023
8f96921
Refactor reg_test_interpolation using NiftiImage
onurulgen Mar 14, 2023
751f447
Add NiftiImage::realloc() to reallocate the image data
onurulgen Mar 14, 2023
19883fb
Add NiftiImage::setDim() to set a dimension of the image
onurulgen Mar 14, 2023
d13cf2d
Add ability to NiftiImage for copying only image info
onurulgen Mar 14, 2023
5f92c68
Update tests to leverage new abilities of NiftiImage
onurulgen Mar 14, 2023
4947c2e
Add an enum for NiftiImage dimensions
onurulgen Mar 15, 2023
d087265
Small fixes
onurulgen Mar 15, 2023
379c8f9
Add ability to NiftiImageData for extracting volume data
onurulgen Mar 15, 2023
4061036
Handle optimise* variables in Compute::NormaliseGradient()
onurulgen Mar 15, 2023
b226687
Refactorisations
onurulgen Mar 17, 2023
e9f5eaf
Add NiftiImage::copyData() to copy the pixel data from another image
onurulgen Mar 17, 2023
ade981c
Extend NiftiImage constructor to optionally allocate image data
onurulgen Mar 17, 2023
961700a
Add NiftiImage::totalBytes() to return the total size of the image da…
onurulgen Mar 17, 2023
53ad3a4
Add move constructor and assignment operator to NiftiImageData
onurulgen Mar 17, 2023
f3ba1f5
Remove nodeNumber parameter from GetMaximalLength() and NormaliseGrad…
onurulgen Mar 17, 2023
3592c61
Fix possible bugs causing accessing freed memory
onurulgen Mar 17, 2023
21ed730
Add tests for *Compute::GetMaximalLength() and *Compute::NormaliseGra…
onurulgen Mar 19, 2023
1d50702
Fix a bug in tests causing wrong voxel count calculation
onurulgen Mar 19, 2023
c597115
Fix HAVE_ZLIB definition
onurulgen Mar 20, 2023
c5dbb42
Refactor CMakeLists
onurulgen Mar 20, 2023
7deef0b
Refactorisations
onurulgen Mar 24, 2023
26d195b
Add NormaliseGradient() for CUDA and refactor GetMaximalLength()
onurulgen Mar 24, 2023
516b5ab
Extend tests for *Compute::GetMaximalLength() and *Compute::Normalise…
onurulgen Mar 24, 2023
72b1874
Move platform and measure initialisation into reg_base::SetPlatformTy…
onurulgen Mar 24, 2023
b58b3c8
Refactor NR_CUDA_SAFE_CALL() and NR_CUDA_CHECK_KERNEL()
onurulgen Mar 27, 2023
84afbe4
Refactorisations
onurulgen Mar 28, 2023
a6401b9
Modernise CUDA conjugate gradient functions
onurulgen Mar 29, 2023
66e48c8
Remove unnecessary testing functions
onurulgen Mar 29, 2023
a4ae032
Add tests for conjugate gradient
onurulgen Mar 30, 2023
66db3e8
Refactorisations
onurulgen Apr 3, 2023
9db2187
Generate test data only once for NormaliseGradientTest
onurulgen Apr 3, 2023
18495c9
Refactorisations
onurulgen Apr 5, 2023
1f84a28
Add *Content::UpdateWarped() to transfer warped image to the CUDA device
onurulgen Apr 5, 2023
a753c7f
Use CPU for GetWarpedImage()
onurulgen Apr 5, 2023
54a9990
Use CPU for reg_f3d2::GetWarpedImage()
onurulgen Apr 6, 2023
28bfb04
Handle NiftiImage copy options with an enum
onurulgen Jun 8, 2023
e5a0f42
Fix GPU version of ResampleImage() to make on a par with CPU version
onurulgen Jun 9, 2023
3f92721
Fix GPU version of GetImageGradient() to make on a par with CPU version
onurulgen Jun 9, 2023
5009c86
Refactor cudaCommon_createTextureObject()
onurulgen Jun 9, 2023
6739421
Move EPS value into reg_test_common.h
onurulgen Jun 9, 2023
eb246e6
Refactor reg_localTransformation_kernels.cu
onurulgen Jun 12, 2023
2cccd64
Refactor reg_localTransformation_gpu.cu
onurulgen Jun 12, 2023
c7971ae
Fix GPU version of GetDeformationField() to make on a par with CPU ve…
onurulgen Jun 16, 2023
e15d328
Add tests for *Compute::GetDeformationField()
onurulgen Jun 16, 2023
467027d
Refactorisations
onurulgen Jun 16, 2023
3cbbb00
Add tests for *Compute::VoxelCentricToNodeCentric()
onurulgen Jun 21, 2023
1f6452c
Fix GPU version of VoxelCentricToNodeCentric() to make on a par with …
onurulgen Jun 21, 2023
d59deb9
Fix macOS compilation errors
onurulgen Jun 22, 2023
e6855af
Fix the precision bug of reg_lncc
onurulgen Jun 22, 2023
6cfe8d7
Optimise reg_voxelCentric2NodeCentric_kernel()
onurulgen Jun 23, 2023
d37b15c
Issue #92: Added LNCC unit tests
mmodat Jun 23, 2023
84e79e4
Merge branch 'rearchitect-and-reinstate-gpu' of https://github.com/KC…
mmodat Jun 23, 2023
aa79bf2
Refactorisations
onurulgen Jun 23, 2023
a349585
Fix a bug causing wrong calculation of the affine transformation matrix
onurulgen Jun 28, 2023
5b7d8fe
Issue #92: fix affine initialisation in f3d. matrix went out of scope…
mmodat Jul 7, 2023
a1ed246
Copy affine transformation into reg_base instead of linking
onurulgen Jul 11, 2023
19f45f6
Make affine transformation memory managed in reg_aladin*
onurulgen Jul 11, 2023
570d7a9
Fix CUDA 12 incompatibilities
onurulgen Jul 11, 2023
46bb6c8
Fix a memory leak
onurulgen Jul 11, 2023
c425883
#92: block match & LTS CPU/CUDA regression tests
mmodat Jul 14, 2023
9506815
Refactor the LTS regression test
onurulgen Jul 14, 2023
9e85760
Refactor the BlockMatching regression test
onurulgen Jul 14, 2023
fdf30a4
Refactor the LNCC test
onurulgen Jul 17, 2023
ab5ce4f
Rename OptimiseKernel to LtsKernel
onurulgen Jul 17, 2023
655c6fd
Issue#92: Added BM unit test and fix mask handling
mmodat Jul 18, 2023
4444768
Refactorisations
onurulgen Jul 18, 2023
63bccdd
#92 fixed shared mem race condition in block match
mmodat Jul 19, 2023
8653742
Add NiftiImage::getDataType() returning the current data type
onurulgen Jul 20, 2023
2cd5ce4
Refactor _reg_resampling
onurulgen Jul 20, 2023
efb6331
Fix memory leaks in Content
onurulgen Jul 20, 2023
4006362
Refactor reg_nmi
onurulgen Jul 20, 2023
37c3370
Add symmetric scheme support for reg_nmi_gpu #92
onurulgen Jul 20, 2023
688d9ac
Add NMI regression tests #92
onurulgen Jul 20, 2023
fb586da
#92: Set the test seed to constant for reproducibility
mmodat Jul 24, 2023
4f29800
Issue #92: added a unit test for nmi
mmodat Jul 24, 2023
cd09926
Issue #92: activate CUDA for NMI test
mmodat Jul 24, 2023
a10fe1d
#72 #92 Added an error message when ln is set to 0
mmodat Jul 24, 2023
7204698
Add symmetric scheme support for reg_optimiser_gpu and reg_conjugateG…
onurulgen Jul 24, 2023
6b33dce
Add symmetric scheme support for reg_test_conjugateGradient #92
onurulgen Jul 24, 2023
da81948
#92: added bending energy tests
mmodat Jul 25, 2023
6e67a5b
Issue #68: checks for exising folder before saving
mmodat Jul 25, 2023
76efc9f
Refactorisations
onurulgen Jul 27, 2023
4a98c08
Rearchitect reg_measure to handle forward and backward similarity mea…
onurulgen Jul 31, 2023
c101e74
Disable OpenMP for coverage
onurulgen Jul 31, 2023
8129f1a
Rearchitect reg_measure to handle forward and backward voxel-based si…
onurulgen Aug 1, 2023
30c427d
Remove the symmetric scheme warning from reg_ssd_gpu
onurulgen Aug 3, 2023
82fe6aa
Rearchitect Content classes #92
onurulgen Aug 3, 2023
4bbc879
Add Debug header to handle errors and logging #92
onurulgen Aug 23, 2023
846b2f1
Refactor _reg_common_cuda #92
onurulgen Aug 24, 2023
3516bfe
Convert NMI regression test to a multi-measure regression test #92
onurulgen Aug 24, 2023
cece094
Refactor Cuda::TransferNiftiToDevice and remove Cuda::TransferNiftiTo…
onurulgen Aug 29, 2023
48751ff
Make SSD GPU on a par with the CPU version #92
onurulgen Aug 29, 2023
b1036be
#92 Added nmi gradient test
mmodat Aug 30, 2023
babf772
#92 Added nmi gradient test + pull
mmodat Aug 30, 2023
6fc1323
#92 removed readwritebinary as not needed
mmodat Aug 30, 2023
7d96dfd
#92 changed the def field test to be a unit test against known output
mmodat Aug 30, 2023
7580249
#92 Added spine composition to the unit test
mmodat Aug 30, 2023
eba4a9f
Add NiftiImage::setPixDim()
onurulgen Aug 30, 2023
2ec3de1
Fix test errors
onurulgen Aug 30, 2023
aa472f8
Turn math macros into inline functions #92
onurulgen Aug 30, 2023
c9540be
#92 addded test for composition of DF. CPU only for now
mmodat Aug 31, 2023
a269f05
Fix a bug causing shrunk output images
onurulgen Aug 31, 2023
004414e
Refactor Compute::GetApproximatedGradient()
onurulgen Sep 1, 2023
97966ff
Add NiftiImage::setIntentName()
onurulgen Sep 4, 2023
e1b7ad8
Refactorisations
onurulgen Sep 4, 2023
43181d5
Add more float* operations
onurulgen Sep 8, 2023
9fe8399
Add CUDA image operations
onurulgen Sep 8, 2023
557cc05
Add reg_getMinValue_gpu() and reg_getMaxValue_gpu()
onurulgen Sep 8, 2023
7548147
Implement CudaCompute::GetDefFieldFromVelocityGrid() #92
onurulgen Sep 8, 2023
3557636
#92: fix issue in reg_resample - fix failing test - fix output display
mmodat Sep 8, 2023
86e784f
Merge branch 'rearchitect-and-reinstate-gpu' of https://github.com/KC…
onurulgen Sep 8, 2023
ef4f55b
Fix a bug causing early freeing of the image data
onurulgen Sep 8, 2023
327d516
Refactorisations
onurulgen Sep 8, 2023
4aa2734
Fix precision of GetBasisSplineValue() and GetBasisSplineDerivativeVa…
onurulgen Sep 12, 2023
1b8600c
Fix a bug causing inconsistent results in successive runs of 2D f3d r…
onurulgen Sep 14, 2023
242049a
Refactorisations
onurulgen Sep 14, 2023
80cecbd
Fix wrong calculation of CUDA ApproxLinearEnergyGradient(), GetLandma…
onurulgen Sep 14, 2023
bc7ab04
Refactorisations
onurulgen Sep 18, 2023
336eec5
Implement CudaCompute::ApproxLinearEnergyGradient() #92
onurulgen Sep 18, 2023
8b0df8b
Fixes for CUDA 12
onurulgen Sep 18, 2023
422f69b
Add approximate linear energy gradient regression test #92
onurulgen Sep 18, 2023
0ce908b
Implement CudaCompute::ApproxLinearEnergy() #92
onurulgen Sep 21, 2023
60939a3
Add approximate linear energy regression test #92
onurulgen Sep 21, 2023
118e1da
Fix a bug in reg_spline_approxLinearEnergyGradient_gpu()
onurulgen Oct 5, 2023
e1ec1f4
Refactorisations
onurulgen Oct 5, 2023
47c4a84
Implement the kernel convolution for CUDA #92
onurulgen Oct 6, 2023
9f24fa1
Add regression tests for kernel convolution #92
onurulgen Oct 9, 2023
9b32632
Use ConvKernelType instead of NREG_CONV_KERNEL_TYPE
onurulgen Oct 10, 2023
230c6b9
Fix a bug in the kernel convolution regression test
onurulgen Oct 11, 2023
e04dacd
Optimise Cuda::KernelConvolution()
onurulgen Oct 11, 2023
b6d5097
Optimise reg_getMinMaxValue_gpu()
onurulgen Oct 12, 2023
a8f1232
Update compose deformation field test to include CUDA
onurulgen Oct 12, 2023
d925b8c
Add composition support for CudaCompute::GetDeformationField() #92
onurulgen Oct 13, 2023
563a842
Refactorisations
onurulgen Oct 18, 2023
4c1bc6a
Enable CUDA for NMI gradient unit test
onurulgen Oct 19, 2023
a39e685
Add content creator for f3d2 #92
onurulgen Oct 19, 2023
a4e1918
Refactorisations
onurulgen Oct 23, 2023
67cc123
Add regression tests for Compute::GetDeformationField() #92
onurulgen Oct 23, 2023
694ec87
Remove identifiers starting with a single underscore
onurulgen Oct 23, 2023
b1670e4
Refactorisations
onurulgen Oct 30, 2023
44e6b1b
Fix a bug in CudaCompute::VoxelCentricToNodeCentric() #92
onurulgen Oct 30, 2023
2f65fc9
Make CudaCompute::ResampleImage() on a par with CPU #92
onurulgen Oct 30, 2023
97bce9e
Make CudaCompute::GetDeformationField() on a par with CPU #92
onurulgen Oct 30, 2023
3db10fa
Temporarily disable GetDeformationFieldTest
onurulgen Oct 30, 2023
5eb3163
Make CudaCompute::NormaliseGradient() on a par with CPU #92
onurulgen Oct 31, 2023
1c315f1
Optimise CudaCompute::GetMaximalLength() #92
onurulgen Oct 31, 2023
cd064cb
Update tests
onurulgen Nov 1, 2023
cc92a52
Make CudaCompute::ApproxBendingEnergyGradient() on a par with CPU #92
onurulgen Nov 6, 2023
f021929
Add regression tests for approximate bending energy and approximate b…
onurulgen Nov 6, 2023
f4c3c15
Refactorisations
onurulgen Nov 13, 2023
52204d7
Implement reg_getNmiValue for CUDA #92
onurulgen Nov 14, 2023
bc4c672
Make reg_getVoxelBasedNmiGradient_gpu() on a par with CPU #92
onurulgen Nov 15, 2023
86db434
Add multi-timepoint support for MeasureTest #92
onurulgen Nov 15, 2023
5577571
Refactorisations
onurulgen Nov 16, 2023
f953b5f
Convert reference and floating images to float arrays from cudaArrays…
onurulgen Nov 17, 2023
1e8b36e
Refactorisations
onurulgen Nov 20, 2023
13697c3
Implement multi-timepoint support for CUDA #92
onurulgen Nov 20, 2023
b2a32ff
Implement reg_optimiser_gpu::Perturbation() #92
onurulgen Nov 23, 2023
8182839
Refactor Optimiser #92
onurulgen Nov 23, 2023
592d01d
Optimise Optimiser #92
onurulgen Nov 24, 2023
25aba87
Refactorisations
onurulgen Nov 24, 2023
b9c9bec
Use float gam instead of double in CudaOptimiser
onurulgen Nov 27, 2023
708106f
Optimise CudaResampling #92
onurulgen Nov 28, 2023
b46beb1
Combine GitHub Actions workflows for testing into a single file
onurulgen Nov 29, 2023
07d5ce7
Update GitHub Actions workflow for coverage
onurulgen Nov 29, 2023
f0ebbb1
Refactor CudaLocalTransformation
onurulgen Nov 29, 2023
ce26c69
Optimise Cuda::ApproxLinearEnergyGradient() #92
onurulgen Nov 30, 2023
120386a
Refactorisations
onurulgen Dec 1, 2023
6511740
Optimise Cuda::GetDeformationField() #92
onurulgen Dec 1, 2023
29647ad
Refactor CudaTools #92
onurulgen Jan 8, 2024
a73014e
Optimise Cuda::VoxelCentricToNodeCentric() #92
onurulgen Jan 9, 2024
92ec3ce
Optimise Cuda::DefFieldCompose() #92
onurulgen Jan 10, 2024
4c60059
Implement CudaCompute::SymmetriseVelocityFields() #92
onurulgen Jan 15, 2024
540f10b
Add symmetrise velocity fields regression test #92
onurulgen Jan 15, 2024
b34de37
Implement CudaCompute::UpdateVelocityField() #92
onurulgen Jan 16, 2024
0ddb72b
Add update velocity field regression test #92
onurulgen Jan 16, 2024
cbdea7c
Print the version info
onurulgen Jan 16, 2024
d2bfbe1
Implement Cuda::ResampleGradient() #92
onurulgen Jan 22, 2024
be7e6b7
Add resample gradient regression test #92
onurulgen Jan 22, 2024
1675ba7
Refactorisations
onurulgen Jan 23, 2024
c19f0bd
Add Cuda::GetIntermediateDefFieldFromVelGrid() #92
onurulgen Jan 23, 2024
1a8f4e1
Implement CudaCompute::ExponentiateGradient() #92
onurulgen Jan 24, 2024
69c1fe6
Add exponentiate gradient regression test #92
onurulgen Jan 24, 2024
45698ba
Refactor Cuda::GetAffineDeformationField() #92
onurulgen Jan 25, 2024
db09c2f
Refactor affine deformation field unit test #92
onurulgen Jan 26, 2024
387139a
Add composition to affine deformation field unit test #92
onurulgen Jan 26, 2024
f7d5fc5
Add testing for compute to affine deformation field unit test #92
onurulgen Jan 29, 2024
0a4ba26
Use real index numbers returned from maskCuda in deformationFieldCuda…
onurulgen Jan 30, 2024
587eac1
Use Codecov for coverage
onurulgen Jan 31, 2024
c3c9fda
Update minimum CMake version and use the new CUDA method
onurulgen Feb 5, 2024
2c3432c
Add a GitHub Action to build executables on a release #92
onurulgen Feb 6, 2024
2931554
Use self-hosted runners to enable CUDA for coverage
onurulgen Feb 8, 2024
18cc32b
Add a GitHub Action for static code analysis
onurulgen Feb 13, 2024
640ec07
Fix GPU ID parsing error in reg_f3d
onurulgen Feb 14, 2024
f5a5990
Upgrade libpng to 1.6.42
onurulgen Feb 15, 2024
a74e436
Upgrade zlib to 1.3.1
onurulgen Feb 15, 2024
193ef44
Upgrade RNifti and dependencies
onurulgen Feb 16, 2024
3abfaaa
Fix zlib compilation error
onurulgen Feb 16, 2024
f21c5fb
Fix linting issues of reg_png
onurulgen Feb 19, 2024
1fde5bb
Fix linting issues of nifti1_io
onurulgen Feb 19, 2024
b90d0d5
Enable inline suppressions for static code analysis
onurulgen Feb 19, 2024
7d1f3f8
Exclude Eigen library from static code analysis
onurulgen Feb 19, 2024
6cbbccd
Enable CRT secure warnings
onurulgen Feb 19, 2024
f5e227f
Fix linting issues
onurulgen Feb 20, 2024
1c99a7a
Eliminate dead code
onurulgen Feb 22, 2024
a560060
Use git to download Eigen library
onurulgen Feb 22, 2024
e6d09fc
Refactorisations
onurulgen Feb 23, 2024
cee3df5
Rename Measure as MeasureCreator
onurulgen Feb 23, 2024
e568f95
Refactor _reg_maths* and _reg_common_cuda_kernels
onurulgen Mar 5, 2024
e9f51fe
Embed Eigen library
onurulgen Mar 6, 2024
ebf0387
Replace Divide() with IndexToDims()
onurulgen Mar 6, 2024
f680bce
Add include directories for OpenMP
onurulgen Mar 8, 2024
43c39fa
Refactorisations
onurulgen Jun 1, 2024
7cfe146
Update macOS images in GitHub Actions
onurulgen Jun 12, 2024
41cd5a1
Update the OS image for Coverage
onurulgen Jun 12, 2024
65934f2
Fix linting issues
onurulgen Jun 12, 2024
dd78e8e
Use NiftiImage instead of nifti_image in _reg_ReadWriteImage
onurulgen Jul 12, 2024
cbbdd00
Change the image acquisition behaviour of NiftiImage
onurulgen Jul 12, 2024
1cea3df
Revert "Enable CRT secure warnings"
onurulgen Aug 19, 2024
2915900
Fix *Content::CastImageData() and eliminate its duplicates
onurulgen Aug 19, 2024
d515493
Use NiftiImage in Content classes
onurulgen Aug 27, 2024
7e1e926
Revert "Use float gam instead of double in CudaOptimiser"
onurulgen Aug 27, 2024
a148f14
Fix Floor(), Ceil(), and Round() functions
onurulgen Aug 27, 2024
da1da73
Merge branch 'master' into rearchitect-and-reinstate-gpu
onurulgen Aug 29, 2024
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
7 changes: 0 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ option(USE_OPENCL "To use the OpenCL platform" OFF)
option(USE_OPENMP "To use openMP for multi-CPU processing" ON)
option(USE_SSE "To enable SEE computation in some case" ON)
#-----------------------------------------------------------------------------
option(USE_THROW_EXCEP "To throw exception rather than exit" OFF)
mark_as_advanced(USE_THROW_EXCEP)
#-----------------------------------------------------------------------------
option(USE_NRRD "To use the NRRD file format" OFF)
mark_as_advanced(USE_NRRD)
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -207,10 +204,6 @@ else(BUILD_SHARED_LIBS)
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)
#-----------------------------------------------------------------------------
if(USE_THROW_EXCEP)
add_definitions(-DNR_THROW_EXCEP)
endif(USE_THROW_EXCEP)
#-----------------------------------------------------------------------------
add_subdirectory(third-party)
add_subdirectory(reg-io)
add_subdirectory(reg-lib)
Expand Down
7 changes: 1 addition & 6 deletions cmake/NIFTYREGConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# limitations under the License.

# This file sets NIFTYREG_INCLUDE_DIRS, NIFTYREG_LIBRARY_DIRS and NIFTYREG_LIBRARIES.
@PACKAGE_INIT@
@PACKAGE_INIT@

# add folder where this file resides to the cmake path such that it can use our find_package modules and .cmake files
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}")
Expand Down Expand Up @@ -55,9 +55,4 @@ endif()
if (@USE_SSE@)
set(NIFTYREG_BUILT_WITH_SSE TRUE)
mark_as_advanced(NIFTYREG_BUILT_WITH_SSE)
endif()
# THROW_EXCEP
if (@USE_THROW_EXCEP@)
set(NIFTYREG_BUILT_WITH_THROW_EXCEP TRUE)
mark_as_advanced(NIFTYREG_BUILT_WITH_THROW_EXCEP)
endif()
2 changes: 1 addition & 1 deletion niftyreg_build_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
301
306
244 changes: 103 additions & 141 deletions reg-apps/reg_aladin.cpp

Large diffs are not rendered by default.

136 changes: 54 additions & 82 deletions reg-apps/reg_average.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,46 +32,42 @@ typedef enum

void usage(char *exec)
{
char text[255];
reg_print_info(exec, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
reg_print_info(exec, "usage:");
sprintf(text, "\t%s <outputFileName> [OPTIONS]", exec);
reg_print_info(exec, text);
reg_print_info(exec, "\t-avg <inputAffineName1> <inputAffineName2> ... <inputAffineNameN>");
reg_print_info(exec, "\t\tIf the input are images, the intensities are averaged");
reg_print_info(exec, "\t\tIf the input are affine matrices, out=expm((logm(M1)+logm(M2)+...+logm(MN))/N)");
reg_print_info(exec, "");
reg_print_info(exec, "\t-avg_lts <AffineMat1> <AffineMat2> ... <AffineMatN> ");
reg_print_info(exec, "\t\tIt will estimate the robust average affine matrix by considering half of the matrices as ouliers.");
reg_print_info(exec, "");
reg_print_info(exec, "\t-avg_tran <referenceImage> <transformationFileName1> <floatingImage1> ... <transformationFileNameN> <floatingImageN> ");
reg_print_info(exec, "\t\tAll input images are resampled into the space of <reference image> and averaged");
reg_print_info(exec, "\t\tA cubic spline interpolation scheme is used for resampling");
reg_print_info(exec, "");
reg_print_info(exec, "\t-demean <referenceImage> <transformationFileName1> <floatingImage1> ... <transformationFileNameN> <floatingImageN>");
reg_print_info(exec, "\t\tThe demean option enforces the mean of all transformations to be");
reg_print_info(exec, "\t\tidentity.");
reg_print_info(exec, "\t\tIf affine transformations are provided, only the non-rigid part is");
reg_print_info(exec, "\t\tconsidered after removing the rigid components.");
reg_print_info(exec, "\t\tIf non-linear transformation are provided the mean (euclidean) is ");
reg_print_info(exec, "\t\tremoved from all input transformations.");
reg_print_info(exec, "\t\tIf velocity field non-linear parametrisations are used, the affine");
reg_print_info(exec, "\t\tcomponent is discarded and the mean in the log space is removed.");
reg_print_info(exec, "");
reg_print_info(exec, "\t-demean_noaff <referenceImage> <AffineMat1> <NonRigidTrans1> <floatingImage1> ... <AffineMatN> <NonRigidTransN> <floatingImageN>");
reg_print_info(exec, "\t\tSame as -demean expect that the specified affine is removed from the");
reg_print_info(exec, "\t\tnon-linear (euclidean) transformation.");
reg_print_info(exec, "\t--NN\t\tUse nearest neighbour interpolation - cubic is default");
reg_print_info(exec, "\t--LIN\t\tUse linear interpolation - cubic is default");
reg_print_info(exec, "\t--version\t\tPrint current version and exit");
sprintf(text, "\t\t\t\t(%s)",NR_VERSION);
reg_print_info(exec, text);
reg_print_info(exec, "");
reg_print_info(exec, "alternative usage:");
sprintf(text, "\t%s --cmd_file <textFile>", exec);
reg_print_info(exec, text);
reg_print_info(exec, "\t\tA text file that contains the full command is provided");
reg_print_info(exec, "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
NR_INFO("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
NR_INFO("usage:");
NR_INFO("\t" << exec << " <outputFileName> [OPTIONS]");
NR_INFO("\t-avg <inputAffineName1> <inputAffineName2> ... <inputAffineNameN>");
NR_INFO("\t\tIf the input are images, the intensities are averaged");
NR_INFO("\t\tIf the input are affine matrices, out=expm((logm(M1)+logm(M2)+...+logm(MN))/N)");
NR_INFO("");
NR_INFO("\t-avg_lts <AffineMat1> <AffineMat2> ... <AffineMatN> ");
NR_INFO("\t\tIt will estimate the robust average affine matrix by considering half of the matrices as ouliers.");
NR_INFO("");
NR_INFO("\t-avg_tran <referenceImage> <transformationFileName1> <floatingImage1> ... <transformationFileNameN> <floatingImageN> ");
NR_INFO("\t\tAll input images are resampled into the space of <reference image> and averaged");
NR_INFO("\t\tA cubic spline interpolation scheme is used for resampling");
NR_INFO("");
NR_INFO("\t-demean <referenceImage> <transformationFileName1> <floatingImage1> ... <transformationFileNameN> <floatingImageN>");
NR_INFO("\t\tThe demean option enforces the mean of all transformations to be");
NR_INFO("\t\tidentity.");
NR_INFO("\t\tIf affine transformations are provided, only the non-rigid part is");
NR_INFO("\t\tconsidered after removing the rigid components.");
NR_INFO("\t\tIf non-linear transformation are provided the mean (euclidean) is ");
NR_INFO("\t\tremoved from all input transformations.");
NR_INFO("\t\tIf velocity field non-linear parametrisations are used, the affine");
NR_INFO("\t\tcomponent is discarded and the mean in the log space is removed.");
NR_INFO("");
NR_INFO("\t-demean_noaff <referenceImage> <AffineMat1> <NonRigidTrans1> <floatingImage1> ... <AffineMatN> <NonRigidTransN> <floatingImageN>");
NR_INFO("\t\tSame as -demean expect that the specified affine is removed from the");
NR_INFO("\t\tnon-linear (euclidean) transformation.");
NR_INFO("\t--NN\t\tUse nearest neighbour interpolation - cubic is default");
NR_INFO("\t--LIN\t\tUse linear interpolation - cubic is default");
NR_INFO("\t--version\t\tPrint current version and exit");
NR_INFO("\t\t\t\t(" << NR_VERSION << ")");
NR_INFO("");
NR_INFO("alternative usage:");
NR_INFO("\t" << exec << " --cmd_file <textFile>");
NR_INFO("\t\tA text file that contains the full command is provided");
NR_INFO("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");
}

void average_norm_intensity(nifti_image *image)
Expand All @@ -93,7 +89,7 @@ int remove_nan_and_add(nifti_image *averageImage,
{
if(averageImage->nvox!=toAddImage->nvox || averageImage->nvox!=definedNumImage->nvox)
{
reg_print_msg_error(" All images must have the same size");
NR_ERROR("All images must have the same size");
return EXIT_FAILURE;
}
PrecisionType *avgImgPtr = static_cast<PrecisionType *>(averageImage->data);
Expand Down Expand Up @@ -303,8 +299,7 @@ int compute_nrr_demean(nifti_image *demean_field,
reg_spline_getFlowFieldFromVelocityGrid(transformation,deformationField);
break;
default:
reg_print_msg_error("Unsupported transformation parametrisation type:");
reg_print_msg_error(transformation->fname);
NR_ERROR("Unsupported transformation parametrisation type: " << transformation->fname);
return EXIT_FAILURE;
}
// The affine component is removed
Expand Down Expand Up @@ -359,9 +354,7 @@ int compute_average_image(nifti_image *averageImage,
nifti_image *demeanField = nullptr;
if(demean && inputAffName!=nullptr && inputNRRName==nullptr){
demeanMatrix = compute_affine_demean(imageNumber, inputAffName);
#ifndef NDEBUG
reg_print_msg_debug("Matrix to use for demeaning computed");
#endif
NR_DEBUG("Matrix to use for demeaning computed");
}
if(demean && inputNRRName!=nullptr){
demeanField=nifti_copy_nim_info(averageImage);
Expand All @@ -379,9 +372,7 @@ int compute_average_image(nifti_image *averageImage,
demeanField->intent_p1=DISP_FIELD;
demeanField->data=calloc(demeanField->nvox, demeanField->nbyper);
compute_nrr_demean(demeanField, imageNumber, inputNRRName, inputAffName);
#ifndef NDEBUG
reg_print_msg_debug("Displacement field to use for demeaning computed");
#endif
NR_DEBUG("Displacement field to use for demeaning computed");
}

// Set the average image to zero
Expand Down Expand Up @@ -430,8 +421,9 @@ int compute_average_image(nifti_image *averageImage,
case DEF_VEL_FIELD:
reg_defField_compose(current_transformation,deformationField,nullptr);
break;
default: reg_print_msg_error("Unsupported transformation type")
reg_exit();
default:
NR_ERROR("Unsupported transformation type");
return EXIT_FAILURE;
}
nifti_image_free(current_transformation);
if(demeanField!=nullptr){
Expand All @@ -446,19 +438,15 @@ int compute_average_image(nifti_image *averageImage,
nifti_image_free(tempDef);
}
else reg_tools_subtractImageFromImage(deformationField,demeanField,deformationField);
#ifndef NDEBUG
reg_print_msg_debug("Input non-linear transformation has been demeaned");
#endif
NR_DEBUG("Input non-linear transformation has been demeaned");
}
}
else if(inputAffName!=nullptr){
mat44 current_affine;
reg_tool_ReadAffineFile(&current_affine,inputAffName[i]);
if(demean && inputAffName!=nullptr && inputNRRName==nullptr){
current_affine = demeanMatrix * current_affine;
#ifndef NDEBUG
reg_print_msg_debug("Input affine transformation has been demeaned");
#endif
NR_DEBUG("Input affine transformation has been demeaned");
}
reg_affine_getDeformationField(&current_affine, deformationField);
}
Expand Down Expand Up @@ -500,7 +488,7 @@ int main(int argc, char **argv)
return EXIT_FAILURE;
}
#ifdef _OPENMP
// Set the default number of thread
// Set the default number of threads
int defaultOpenMPValue=omp_get_num_procs();
if(getenv("OMP_NUM_THREADS")!=nullptr)
defaultOpenMPValue=atoi(getenv("OMP_NUM_THREADS"));
Expand All @@ -526,14 +514,14 @@ int main(int argc, char **argv)
// Check if the --xml information is required
else if(strcmp(argv[i], "--xml")==0)
{
printf("%s",xml_average);
NR_COUT << xml_average;
return EXIT_SUCCESS;
}
else if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 || strcmp(argv[i], "--version")==0)
{
printf("%s\n",NR_VERSION);
NR_COUT << NR_VERSION << std::endl;
return EXIT_SUCCESS;
}
}
Expand All @@ -545,9 +533,8 @@ int main(int argc, char **argv)
char buffer[512];
FILE *cmd_file = fopen(argv[2], "r+");
if(cmd_file==nullptr){
reg_print_msg_error("Error when reading the provided command line file:");
reg_print_msg_error(argv[2]);
reg_exit();
NR_ERROR("Error when reading the provided command line file: " << argv[2]);
return EXIT_FAILURE;
}
// First path to extract the actual argument number
while(fscanf(cmd_file," %511s", buffer)==1)
Expand All @@ -563,15 +550,7 @@ int main(int argc, char **argv)
fscanf(cmd_file," %511s", buffer);
#ifdef _OPENMP
omp_set_num_threads(atoi(buffer));
#else
reg_print_msg_warn("OpenMP flag detected and ignored.");
#endif
#ifndef NDEBUG
reg_print_msg_debug("OpenMP flag detected");
#ifdef _OPENMP
reg_print_msg_debug("OpenMP core number set to:");
reg_print_msg_debug(buffer);
#endif
NR_DEBUG("OpenMP core number set to: " << buffer);
#endif
}
else{
Expand All @@ -587,13 +566,7 @@ int main(int argc, char **argv)
arg_num_command = argc;
}

#ifndef NDEBUG
reg_print_msg_debug("command");
for(int i=0;i<arg_num_command;++i){
printf("%s ", pointer_to_command[i]);
}
printf("\n");
#endif
PrintCmdLine(arg_num_command, pointer_to_command, true);

// Set a variable to store the interpolation order, cubic is used by default
int interpolation_order = 3;
Expand Down Expand Up @@ -663,9 +636,8 @@ int main(int argc, char **argv)
}
else
{
reg_print_msg_error("unknow operation. Options are \"-avg\", \"-avg_lts\", \"-avg_tran\", ");
reg_print_msg_error("\"-demean\" or \"-demean_noaff\". Specified argument:");
reg_print_msg_error(pointer_to_command[2]);
NR_ERROR("Unknown operation. Options are \"-avg\", \"-avg_lts\", \"-avg_tran\", ");
NR_ERROR("\"-demean\" or \"-demean_noaff\". Specified argument:" << pointer_to_command[2]);
usage(pointer_to_command[0]);
return EXIT_FAILURE;
}
Expand Down
Loading