diff --git a/niftyreg_build_version.txt b/niftyreg_build_version.txt index 18fdcb2a..3860ed91 100644 --- a/niftyreg_build_version.txt +++ b/niftyreg_build_version.txt @@ -1 +1 @@ -322 +323 diff --git a/reg-io/_reg_ReadWriteMatrix.cpp b/reg-io/_reg_ReadWriteMatrix.cpp index 48f8316d..baf0a6f5 100644 --- a/reg-io/_reg_ReadWriteMatrix.cpp +++ b/reg-io/_reg_ReadWriteMatrix.cpp @@ -27,7 +27,7 @@ void reg_tool_ReadAffineFile(mat44 *mat, } affineFile.close(); - NR_MAT44(*mat, "Read affine transformation"); + NR_MAT44_DEBUG(*mat, "Read affine transformation"); if (flirtFile) { mat44 absoluteReference; @@ -61,11 +61,11 @@ void reg_tool_ReadAffineFile(mat44 *mat, absoluteReference.m[3][3] = absoluteFloating.m[3][3] = 1.0; NR_DEBUG("An flirt affine file is assumed and is converted to a real word affine matrix"); - NR_MAT44(*mat, "Matrix read from the input file"); - NR_MAT44(*referenceMatrix, "Reference Matrix"); - NR_MAT44(*floatingMatrix, "Floating Matrix"); - NR_MAT44(absoluteReference, "Reference absolute Matrix"); - NR_MAT44(absoluteFloating, "Floating absolute Matrix"); + NR_MAT44_DEBUG(*mat, "Matrix read from the input file"); + NR_MAT44_DEBUG(*referenceMatrix, "Reference Matrix"); + NR_MAT44_DEBUG(*floatingMatrix, "Floating Matrix"); + NR_MAT44_DEBUG(absoluteReference, "Reference absolute Matrix"); + NR_MAT44_DEBUG(absoluteFloating, "Floating absolute Matrix"); absoluteFloating = nifti_mat44_inverse(absoluteFloating); *mat = nifti_mat44_inverse(*mat); @@ -77,7 +77,7 @@ void reg_tool_ReadAffineFile(mat44 *mat, *mat = reg_mat44_mul(mat, &tmp); } - NR_MAT44(*mat, "Affine matrix"); + NR_MAT44_DEBUG(*mat, "Affine matrix"); } /* *************************************************************** */ void reg_tool_ReadAffineFile(mat44 *mat, char *fileName) { @@ -223,7 +223,7 @@ mat44* reg_tool_ReadMat44File(char *fileName) { } matrixFile.close(); - NR_MAT44(*mat, "mat44 matrix"); + NR_MAT44_DEBUG(*mat, "mat44 matrix"); return mat; } diff --git a/reg-io/_reg_ReadWriteMatrix.h b/reg-io/_reg_ReadWriteMatrix.h index 01e6a5b2..7ad758e8 100644 --- a/reg-io/_reg_ReadWriteMatrix.h +++ b/reg-io/_reg_ReadWriteMatrix.h @@ -31,7 +31,6 @@ * @param flirtFile If this flag is set to true the matrix is converted * from a Flirt (FSL) parametrisation to a standard parametrisation */ -extern "C++" void reg_tool_ReadAffineFile(mat44 *mat, nifti_image *referenceImage, nifti_image *floatingImage, @@ -44,7 +43,6 @@ void reg_tool_ReadAffineFile(mat44 *mat, * @param mat structure that store the affine transformation matrix * @param filename Filename of the text file that contains the matrix to read **/ -extern "C++" void reg_tool_ReadAffineFile(mat44 *mat, char *filename); @@ -54,14 +52,12 @@ void reg_tool_ReadAffineFile(mat44 *mat, * @param filename Filename of the text file that contains the matrix to read * @return mat44 structure that store the matrix **/ -extern "C++" mat44* reg_tool_ReadMat44File(char *fileName); /** @brief This function save a 4-by-4 matrix to the disk as a text file * @param mat Matrix to be saved on the disk * @param filename Name of the text file to save on the disk */ -extern "C++" void reg_tool_WriteAffineFile(const mat44 *mat, const char *fileName); @@ -70,7 +66,6 @@ void reg_tool_WriteAffineFile(const mat44 *mat, * @param filename Filename of the text file that contains the matrix to read * @return pair of values that contains the matrix size **/ -extern "C++" std::pair reg_tool_sizeInputMatrixFile(char *filename); /** * @brief Read a file that contains a m-by-n matrix and store it into @@ -80,7 +75,7 @@ std::pair reg_tool_sizeInputMatrixFile(char *filename); * @param nbColumn number of column of the input matrix * @return a pointer to a 2D array that points the read matrix **/ -extern "C++" template +template T** reg_tool_ReadMatrixFile(char *filename, size_t nbLine, size_t nbColumn); @@ -92,7 +87,7 @@ T** reg_tool_ReadMatrixFile(char *filename, * @param nbLine number of line of the input matrix * @param nbColumn number of column of the input matrix **/ -extern "C++" template +template void reg_tool_WriteMatrixFile(char *filename, T **mat, size_t nbLine, diff --git a/reg-lib/Content.cpp b/reg-lib/Content.cpp index 0ecbce6f..ca340144 100644 --- a/reg-lib/Content.cpp +++ b/reg-lib/Content.cpp @@ -74,7 +74,6 @@ void Content::AllocateDeformationField(size_t bytes) { deformationField->scl_slope = 1; deformationField->scl_inter = 0; deformationField->data = calloc(deformationField->nvox, deformationField->nbyper); - reg_tools_multiplyValueToImage(deformationField, deformationField, 0.f); // Convert to an identity deformation field reg_getDeformationFromDisplacement(deformationField); } diff --git a/reg-lib/Debug.hpp b/reg-lib/Debug.hpp index 6980a3cb..95d1292a 100644 --- a/reg-lib/Debug.hpp +++ b/reg-lib/Debug.hpp @@ -77,10 +77,9 @@ inline std::string StripFunctionName(const std::string& funcName) { #else #define NR_MAT33(mat, title) reg_mat33_disp(mat, title) #define NR_MAT44(mat, title) reg_mat44_disp(mat, title) -#define NR_MAT33_DEBUG(mat, title) -#define NR_MAT44_DEBUG(mat, title) +#define NR_MAT33_DEBUG(mat, title) +#define NR_MAT44_DEBUG(mat, title) #define NR_MAT33_VERBOSE(mat, title) if (this->verbose) NR_MAT33(mat, "[NiftyReg INFO] "s + (title)) #define NR_MAT44_VERBOSE(mat, title) if (this->verbose) NR_MAT44(mat, "[NiftyReg INFO] "s + (title)) - #endif /* *************************************************************** */ diff --git a/reg-lib/_reg_aladin.cpp b/reg-lib/_reg_aladin.cpp index 60543ebe..37e3619c 100644 --- a/reg-lib/_reg_aladin.cpp +++ b/reg-lib/_reg_aladin.cpp @@ -329,7 +329,7 @@ template void reg_aladin::UpdateTransformationMatrix(int type) { this->blockMatchingKernel->template castTo()->Calculate(); this->ltsKernel->template castTo()->Calculate(type); - NR_MAT44(*this->affineTransformation, "The updated forward matrix"); + NR_MAT44_DEBUG(*this->affineTransformation, "The updated forward matrix"); } /* *************************************************************** */ template @@ -381,11 +381,11 @@ void reg_aladin::Run() { this->DebugPrintLevelInfoStart(); if (this->con->Content::GetReference()->sform_code > 0) - NR_MAT44(this->con->Content::GetReference()->sto_xyz, "Reference image matrix (sform sto_xyz)"); - else NR_MAT44(this->con->Content::GetReference()->qto_xyz, "Reference image matrix (qform qto_xyz)"); + NR_MAT44_DEBUG(this->con->Content::GetReference()->sto_xyz, "Reference image matrix (sform sto_xyz)"); + else NR_MAT44_DEBUG(this->con->Content::GetReference()->qto_xyz, "Reference image matrix (qform qto_xyz)"); if (this->con->Content::GetFloating()->sform_code > 0) - NR_MAT44(this->con->Content::GetFloating()->sto_xyz, "Floating image matrix (sform sto_xyz)"); - else NR_MAT44(this->con->Content::GetFloating()->qto_xyz, "Floating image matrix (qform qto_xyz)"); + NR_MAT44_DEBUG(this->con->Content::GetFloating()->sto_xyz, "Floating image matrix (sform sto_xyz)"); + else NR_MAT44_DEBUG(this->con->Content::GetFloating()->qto_xyz, "Floating image matrix (qform qto_xyz)"); /* ****************** */ /* Rigid registration */ diff --git a/reg-lib/_reg_f3d.cpp b/reg-lib/_reg_f3d.cpp index c17acd9a..9c4722c0 100644 --- a/reg-lib/_reg_f3d.cpp +++ b/reg-lib/_reg_f3d.cpp @@ -181,9 +181,8 @@ void reg_f3d::Initialise() { reg_createControlPointGrid(controlPointGrid, this->referencePyramid[0], gridSpacing); // The control point grid is updated with an identity transformation - if (this->affineTransformation) { + if (this->affineTransformation) reg_affine_getDeformationField(this->affineTransformation.get(), controlPointGrid); - } } else { // The control point grid image is initialised with the provided grid controlPointGrid = inputControlPointGrid; diff --git a/reg-lib/cpu/_reg_blockMatching.h b/reg-lib/cpu/_reg_blockMatching.h index cedadd9b..9639f43c 100755 --- a/reg-lib/cpu/_reg_blockMatching.h +++ b/reg-lib/cpu/_reg_blockMatching.h @@ -88,7 +88,6 @@ struct _reg_blockMatchingParam * image to consider for the registration * @param runningOnGPU Has to be set to true if the registration has to be performed on the GPU */ -extern "C++" void initialise_block_matching_method(nifti_image * referenceImage, _reg_blockMatchingParam *params, int percentToKeep_block, @@ -104,7 +103,6 @@ void initialise_block_matching_method(nifti_image * referenceImage, * relevant information * @param mask Mask array where only voxel defined as active are considered */ -extern "C++" void block_matching_method(nifti_image * referenceImage, nifti_image * warpedImage, _reg_blockMatchingParam *params, diff --git a/reg-lib/cpu/_reg_dti.h b/reg-lib/cpu/_reg_dti.h index 3ef169e0..1f96c167 100755 --- a/reg-lib/cpu/_reg_dti.h +++ b/reg-lib/cpu/_reg_dti.h @@ -59,7 +59,7 @@ class reg_dti: public reg_measure { * should be considered. If set to nullptr, all voxels are considered * @return Returns an L2 measure of the distance between the anisotropic components of the diffusion tensors */ -extern "C++" template +template double reg_getDtiMeasureValue(const nifti_image *referenceImage, const nifti_image *warpedImage, const int *mask, @@ -74,7 +74,7 @@ double reg_getDtiMeasureValue(const nifti_image *referenceImage, * @param mask Array that contains a mask to specify which voxel * should be considered. If set to nullptr, all voxels are considered */ -extern "C++" template +template void reg_getVoxelBasedDtiMeasureGradient(nifti_image *referenceImage, nifti_image *warpedImage, nifti_image *warpedGradient, diff --git a/reg-lib/cpu/_reg_globalTrans.h b/reg-lib/cpu/_reg_globalTrans.h index dd771a3b..591ec0ca 100755 --- a/reg-lib/cpu/_reg_globalTrans.h +++ b/reg-lib/cpu/_reg_globalTrans.h @@ -75,7 +75,6 @@ typedef struct _reg_sorted_point2D _reg_sorted_point2D; * @param deformationField Image that contains the deformation field * that is being updated */ -extern "C++" void reg_affine_getDeformationField(mat44 *affine, nifti_image *deformationField, bool compose=false, diff --git a/reg-lib/cpu/_reg_localTrans.cpp b/reg-lib/cpu/_reg_localTrans.cpp index 8fc4871f..41d8a6f5 100755 --- a/reg-lib/cpu/_reg_localTrans.cpp +++ b/reg-lib/cpu/_reg_localTrans.cpp @@ -35,15 +35,13 @@ void reg_createControlPointGrid(NiftiImage& controlPointGridImage, controlPointGridImage->cal_min = 0; controlPointGridImage->cal_max = 0; controlPointGridImage->pixdim[0] = 1.0f; - controlPointGridImage->pixdim[1] = controlPointGridImage->dx = spacing[0]; - controlPointGridImage->pixdim[2] = controlPointGridImage->dy = spacing[1]; - if (referenceImage->nz == 1) { - controlPointGridImage->pixdim[3] = controlPointGridImage->dz = 1.0f; - } else controlPointGridImage->pixdim[3] = controlPointGridImage->dz = spacing[2]; - controlPointGridImage->pixdim[4] = controlPointGridImage->dt = 1.0f; - controlPointGridImage->pixdim[5] = controlPointGridImage->du = 1.0f; - controlPointGridImage->pixdim[6] = controlPointGridImage->dv = 1.0f; - controlPointGridImage->pixdim[7] = controlPointGridImage->dw = 1.0f; + controlPointGridImage.setPixDim(NiftiDim::X, spacing[0]); + controlPointGridImage.setPixDim(NiftiDim::Y, spacing[1]); + controlPointGridImage.setPixDim(NiftiDim::Z, referenceImage->nz > 1 ? spacing[2] : 1.0f); + controlPointGridImage.setPixDim(NiftiDim::T, 1.0f); + controlPointGridImage.setPixDim(NiftiDim::U, 1.0f); + controlPointGridImage.setPixDim(NiftiDim::V, 1.0f); + controlPointGridImage.setPixDim(NiftiDim::W, 1.0f); // Reproduce the orientation of the reference image and add a one voxel shift if (referenceImage->qform_code + referenceImage->sform_code > 0) { @@ -80,7 +78,7 @@ void reg_createControlPointGrid(NiftiImage& controlPointGridImage, originIndex[1] = -1.0f; originIndex[2] = 0.0f; if (referenceImage->nz > 1) originIndex[2] = -1.0f; - reg_mat44_mul(&(controlPointGridImage->qto_xyz), originIndex, originReal); + reg_mat44_mul(&controlPointGridImage->qto_xyz, originIndex, originReal); controlPointGridImage->qto_xyz.m[0][3] = controlPointGridImage->qoffset_x = originReal[0]; controlPointGridImage->qto_xyz.m[1][3] = controlPointGridImage->qoffset_y = originReal[1]; controlPointGridImage->qto_xyz.m[2][3] = controlPointGridImage->qoffset_z = originReal[2]; @@ -112,7 +110,7 @@ void reg_createControlPointGrid(NiftiImage& controlPointGridImage, controlPointGridImage->sto_xyz.m[3][3] = referenceImage->sto_xyz.m[3][3]; // Origin is shifted from 1 control point in the sform - reg_mat44_mul(&(controlPointGridImage->sto_xyz), originIndex, originReal); + reg_mat44_mul(&controlPointGridImage->sto_xyz, originIndex, originReal); controlPointGridImage->sto_xyz.m[0][3] = originReal[0]; controlPointGridImage->sto_xyz.m[1][3] = originReal[1]; controlPointGridImage->sto_xyz.m[2][3] = originReal[2]; @@ -120,11 +118,9 @@ void reg_createControlPointGrid(NiftiImage& controlPointGridImage, } // The grid is initialised with an identity transformation - reg_tools_multiplyValueToImage(controlPointGridImage, controlPointGridImage, 0.f); reg_getDeformationFromDisplacement(controlPointGridImage); controlPointGridImage->intent_code = NIFTI_INTENT_VECTOR; - memset(controlPointGridImage->intent_name, 0, 16); - strcpy(controlPointGridImage->intent_name, "NREG_TRANS"); + controlPointGridImage.setIntentName("NREG_TRANS"s); controlPointGridImage->intent_p1 = CUB_SPLINE_GRID; } template void reg_createControlPointGrid(NiftiImage&, const NiftiImage&, const float*); @@ -142,12 +138,12 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, mat44 referenceImageSpace = referenceImage->qto_xyz; if (referenceImage->sform_code > 0) referenceImageSpace = referenceImage->sto_xyz; - NR_MAT44(referenceImageSpace, "Input reference image orientation"); + NR_MAT44_DEBUG(referenceImageSpace, "Input reference image orientation"); // // Get the floating image space mat44 floatingImageSpace = floatingImage->qto_xyz; if (floatingImage->sform_code > 0) floatingImageSpace = floatingImage->sto_xyz; - NR_MAT44(floatingImageSpace, "Input floating image orientation"); + NR_MAT44_DEBUG(floatingImageSpace, "Input floating image orientation"); // Check if an affine transformation is specified mat44 halfForwardAffine, halfBackwardAffine; if (forwardAffineTrans != nullptr) { @@ -290,10 +286,12 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, backwardGridImage = NiftiImage(dims, sizeof(DataType) == sizeof(float) ? NIFTI_TYPE_FLOAT32 : NIFTI_TYPE_FLOAT64); // Set the control point grid spacing - forwardGridImage->pixdim[1] = forwardGridImage->dx = backwardGridImage->pixdim[1] = backwardGridImage->dx = spacing[0]; - forwardGridImage->pixdim[2] = forwardGridImage->dy = backwardGridImage->pixdim[2] = backwardGridImage->dy = spacing[1]; - if (referenceImage->nz > 1) - forwardGridImage->pixdim[3] = forwardGridImage->dz = backwardGridImage->pixdim[3] = backwardGridImage->dz = spacing[2]; + forwardGridImage.setPixDim(NiftiDim::X, spacing[0]); + backwardGridImage.setPixDim(NiftiDim::X, spacing[0]); + forwardGridImage.setPixDim(NiftiDim::Y, spacing[1]); + backwardGridImage.setPixDim(NiftiDim::Y, spacing[1]); + forwardGridImage.setPixDim(NiftiDim::Z, referenceImage->nz > 1 ? spacing[2] : 1.0f); + backwardGridImage.setPixDim(NiftiDim::Z, referenceImage->nz > 1 ? spacing[2] : 1.0f); // Set the control point grid image orientation forwardGridImage->qform_code = backwardGridImage->qform_code = 0; forwardGridImage->sform_code = backwardGridImage->sform_code = 1; @@ -313,10 +311,8 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, forwardGridImage->sto_ijk = backwardGridImage->sto_ijk = nifti_mat44_inverse(forwardGridImage->sto_xyz); // Set the intent type forwardGridImage->intent_code = backwardGridImage->intent_code = NIFTI_INTENT_VECTOR; - memset(forwardGridImage->intent_name, 0, 16); - memset(backwardGridImage->intent_name, 0, 16); - strcpy(forwardGridImage->intent_name, "NREG_TRANS"); - strcpy(backwardGridImage->intent_name, "NREG_TRANS"); + forwardGridImage.setIntentName("NREG_TRANS"s); + backwardGridImage.setIntentName("NREG_TRANS"s); forwardGridImage->intent_p1 = backwardGridImage->intent_p1 = CUB_SPLINE_GRID; // Set the affine matrices mat44 identity; @@ -339,7 +335,7 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, forwardGridImage->ext_list[1].edata = (char*)calloc(forwardGridImage->ext_list[1].esize - 8, sizeof(float)); memcpy(forwardGridImage->ext_list[0].edata, &halfForwardAffine, sizeof(mat44)); memcpy(forwardGridImage->ext_list[1].edata, &halfForwardAffine, sizeof(mat44)); - NR_MAT44(halfForwardAffine, "Forward transformation half-affine"); + NR_MAT44_DEBUG(halfForwardAffine, "Forward transformation half-affine"); // Create extensions to store the affine parametrisations for the backward transformation backwardGridImage->num_ext = 2; backwardGridImage->ext_list = (nifti1_extension*)malloc(2 * sizeof(nifti1_extension)); @@ -351,11 +347,8 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, backwardGridImage->ext_list[1].edata = (char*)calloc(backwardGridImage->ext_list[1].esize - 8, sizeof(float)); memcpy(backwardGridImage->ext_list[0].edata, &halfBackwardAffine, sizeof(mat44)); memcpy(backwardGridImage->ext_list[1].edata, &halfBackwardAffine, sizeof(mat44)); - NR_MAT44(halfBackwardAffine, "Backward transformation half-affine"); + NR_MAT44_DEBUG(halfBackwardAffine, "Backward transformation half-affine"); } - // Initialise the grid with identity transformations - reg_tools_multiplyValueToImage(forwardGridImage, forwardGridImage, 0.f); - reg_tools_multiplyValueToImage(backwardGridImage, backwardGridImage, 0.f); // Convert the parametrisations into deformation fields reg_getDeformationFromDisplacement(forwardGridImage); reg_getDeformationFromDisplacement(backwardGridImage); @@ -363,11 +356,11 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, template void reg_createSymmetricControlPointGrids(NiftiImage&, NiftiImage&, const NiftiImage&, const NiftiImage&, const mat44*, const float*); template void reg_createSymmetricControlPointGrids(NiftiImage&, NiftiImage&, const NiftiImage&, const NiftiImage&, const mat44*, const float*); /* *************************************************************** */ -extern "C++" template +template void reg_createDeformationField(NiftiImage& deformationFieldImage, const nifti_image *referenceImage) { // The header information from the reference image are copied over - deformationFieldImage = nifti_copy_nim_info(referenceImage); + deformationFieldImage = NiftiImage(const_cast(referenceImage), NiftiImage::Copy::ImageInfo); // The dimension are updated to store the deformation vector along U index // in a 5D image deformationFieldImage.setDim(NiftiDim::NDim, 5); @@ -390,10 +383,8 @@ void reg_createDeformationField(NiftiImage& deformationFieldImage, deformationFieldImage->scl_slope = 1; deformationFieldImage->scl_inter = 0; - // The data is allocated given the new size + // The data is allocated given the new size and filled in with zero to represent an identity displacement field deformationFieldImage.realloc(); - // The image is filled in with zero to represent an identity displacement field - reg_tools_multiplyValueToImage(deformationFieldImage, deformationFieldImage, 0.f); deformationFieldImage->intent_p1 = DISP_FIELD; // The displacement field is converted into a deformation field reg_getDeformationFromDisplacement(deformationFieldImage); @@ -1699,7 +1690,6 @@ void reg_voxelCentric2NodeCentric(nifti_image *nodeImage, } // loop over z } /* *************************************************************** */ -extern "C++" void reg_voxelCentric2NodeCentric(nifti_image * nodeImage, nifti_image * voxelImage, float weight, @@ -2148,7 +2138,6 @@ void reg_spline_refineControlPointGrid3D(nifti_image *splineControlPoint, nifti_ free(oldGrid); } /* *************************************************************** */ -extern "C++" void reg_spline_refineControlPointGrid(nifti_image *controlPointGrid, nifti_image *referenceImage) { NR_DEBUG("Starting the refine the control point grid"); diff --git a/reg-lib/cpu/_reg_localTrans.h b/reg-lib/cpu/_reg_localTrans.h index 3e719aa0..d3d8d28c 100755 --- a/reg-lib/cpu/_reg_localTrans.h +++ b/reg-lib/cpu/_reg_localTrans.h @@ -16,14 +16,12 @@ #pragma once -#include "float.h" #include "_reg_globalTrans.h" #include "_reg_splineBasis.h" -/* *********************************************** */ -/* **** CUBIC SPLINE BASED FUNCTIONS **** */ -/* *********************************************** */ - +/* *************************************************************** */ +/* **** CUBIC SPLINE BASED FUNCTIONS **** */ +/* *************************************************************** */ /* *************************************************************** */ /** @brief Generate a control point grid image based on the dimension of a * reference image and on a spacing. @@ -35,12 +33,12 @@ * define the control point grid image space * @param spacing Control point spacing along each axis */ -extern "C++" template +template void reg_createControlPointGrid(NiftiImage& controlPointGridImage, const NiftiImage& referenceImage, const float *spacing); -extern "C++" template +template void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, NiftiImage& backwardGridImage, const NiftiImage& referenceImage, @@ -54,7 +52,7 @@ void reg_createSymmetricControlPointGrids(NiftiImage& forwardGridImage, * @param referenceImage Image used to specify the deformation field * size and orientation. */ -extern "C++" template +template void reg_createDeformationField(NiftiImage& deformationFieldImage, const nifti_image *referenceImage); /* *************************************************************** */ @@ -70,7 +68,6 @@ void reg_createDeformationField(NiftiImage& deformationFieldImage, * @param bspline A cubic B-Spline scheme is used if the value is set to true, * a cubic spline scheme is used otherwise (interpolant spline). */ -extern "C++" void reg_spline_getDeformationField(nifti_image *controlPointGridImage, nifti_image *deformationField, int *mask = nullptr, @@ -90,7 +87,6 @@ void reg_spline_getDeformationField(nifti_image *controlPointGridImage, * @param update The values in node image will be incremented if * update is set to true; a blank node image is considered otherwise */ -extern "C++" void reg_voxelCentric2NodeCentric(nifti_image *nodeImage, nifti_image *voxelImage, float weight, @@ -103,7 +99,6 @@ void reg_voxelCentric2NodeCentric(nifti_image *nodeImage, * @param controlPointGridImage This control point grid will be refined * by dividing the control point spacing by a ratio of 2 */ -extern "C++" void reg_spline_refineControlPointGrid(nifti_image *controlPointGridImage, nifti_image *referenceImage = nullptr); /* *************************************************************** */ @@ -121,7 +116,6 @@ void reg_spline_refineControlPointGrid(nifti_image *controlPointGridImage, * @param Cubic B-Spline can be used (bspline==true) * or cubic Spline (bspline==false) */ -extern "C++" int reg_spline_cppComposition(nifti_image *grid1, nifti_image *grid2, bool displacement1, @@ -140,7 +134,6 @@ int reg_spline_cppComposition(nifti_image *grid1, * within the mask will be updated. All positive values in the maks * are considered as belonging to the mask. */ -extern "C++" void reg_defField_compose(nifti_image *deformationField, nifti_image *dfToUpdate, int *mask); @@ -154,12 +147,10 @@ void reg_defField_compose(nifti_image *deformationField, * @param tolerance Tolerance value for the optimisation. Set to nan * for the default value. */ -extern "C++" void reg_defFieldInvert(nifti_image *inputDeformationField, nifti_image *outputDeformationField, float tolerance); /* *************************************************************** */ -extern "C++" void reg_defField_getDeformationFieldFromFlowField(nifti_image *flowFieldImage, nifti_image *deformationFieldImage, const bool updateStepNumber); @@ -171,25 +162,19 @@ void reg_defField_getDeformationFieldFromFlowField(nifti_image *flowFieldImage, * @param deformationFieldImage Deformation field image that will * be filled using the exponentiation of the velocity field. */ -extern "C++" void reg_spline_getDefFieldFromVelocityGrid(nifti_image *velocityFieldGrid, nifti_image *deformationFieldImage, const bool updateStepNumber); /* *************************************************************** */ -extern "C++" void reg_spline_getIntermediateDefFieldFromVelGrid(nifti_image *velocityFieldGrid, nifti_image **deformationFieldImage); /* *************************************************************** */ -extern "C++" void reg_spline_getFlowFieldFromVelocityGrid(nifti_image *velocityFieldGrid, nifti_image *flowField); /* *************************************************************** */ - - -/* *********************************************** */ -/* **** OTHER FUNCTIONS **** */ -/* *********************************************** */ - +/* *************************************************************** */ +/* **** OTHER FUNCTIONS **** */ +/* *************************************************************** */ /* *************************************************************** */ /** @brief This function compute the BCH update using an initial velocity field * and its gradient. @@ -204,7 +189,6 @@ void reg_spline_getFlowFieldFromVelocityGrid(nifti_image *velocityFieldGrid, * 3 - w=u+v+0.5*[u,v]+[u,[u,v]]/12-[v,[u,v]]/12 * 4 - w=u+v+0.5*[u,v]+[u,[u,v]]/12-[v,[u,v]]/12-[v,[u,[u,g]]]/24 */ -extern "C++" void compute_BCH_update(nifti_image *img1, nifti_image *img2, int type); @@ -213,6 +197,5 @@ void compute_BCH_update(nifti_image *img1, * in order to get cubic B-Spline coefficient * @param img Image to be deconvolved */ -extern "C++" void reg_spline_getDeconvolvedCoefficents(nifti_image *img); /* *************************************************************** */ diff --git a/reg-lib/cpu/_reg_localTrans_jac.cpp b/reg-lib/cpu/_reg_localTrans_jac.cpp index 62acf252..26678dde 100755 --- a/reg-lib/cpu/_reg_localTrans_jac.cpp +++ b/reg-lib/cpu/_reg_localTrans_jac.cpp @@ -1200,7 +1200,6 @@ void reg_cubic_spline_jacobian3D(nifti_image *splineControlPoint, return; } /* *************************************************************** */ -extern "C++" double reg_spline_getJacobianPenaltyTerm(nifti_image *splineControlPoint, nifti_image *referenceImage, bool approximation, @@ -1831,7 +1830,6 @@ void reg_spline_jacobianDetGradient3D(nifti_image *splineControlPoint, free(jacobianDeterminant); } /* *************************************************************** */ -extern "C++" void reg_spline_getJacobianPenaltyTermGradient(nifti_image *splineControlPoint, nifti_image *referenceImage, nifti_image *gradientImage, @@ -2435,7 +2433,6 @@ double reg_spline_correctFolding3D(nifti_image *splineControlPoint, return std::numeric_limits::quiet_NaN(); } /* *************************************************************** */ -extern "C++" double reg_spline_correctFolding(nifti_image *splineControlPoint, nifti_image *referenceImage, bool approx) diff --git a/reg-lib/cpu/_reg_localTrans_jac.h b/reg-lib/cpu/_reg_localTrans_jac.h index 0db8d485..990f3b92 100755 --- a/reg-lib/cpu/_reg_localTrans_jac.h +++ b/reg-lib/cpu/_reg_localTrans_jac.h @@ -20,12 +20,10 @@ * @param controlPointGridImage Image that contains the transformation * parametrisation. * @param jacobianImage Image that will be populated with the determinant - * of the Jacobian matrix of the transformation at every voxel posision. + * of the Jacobian matrix of the transformation at every voxel position. */ -extern "C++" void reg_spline_GetJacobianMap(nifti_image *controlPointGridImage, - nifti_image *jacobianImage - ); + nifti_image *jacobianImage); /* *************************************************************** */ /** @brief Compute the average Jacobian determinant * @param controlPointGridImage Image that contains the transformation @@ -36,12 +34,10 @@ void reg_spline_GetJacobianMap(nifti_image *controlPointGridImage, * only the information from the control point if the value is set to true; * all voxels are considered if the value is set to false. */ -extern "C++" double reg_spline_getJacobianPenaltyTerm(nifti_image *controlPointGridImage, nifti_image *referenceImage, bool approx, - bool useHeaderInformation=false - ); + bool useHeaderInformation=false); /* *************************************************************** */ /** @brief Compute the gradient at every control point position of the * Jacobian determinant based penalty term @@ -59,14 +55,12 @@ double reg_spline_getJacobianPenaltyTerm(nifti_image *controlPointGridImage, * from the control point if the value is set to true; all voxels are * considered if the value is set to false. */ -extern "C++" void reg_spline_getJacobianPenaltyTermGradient(nifti_image *controlPointGridImage, nifti_image *referenceImage, nifti_image *gradientImage, float weight, bool approx, - bool useHeaderInformation=false - ); + bool useHeaderInformation=false); /* *************************************************************** */ /** @brief Compute the Jacobian matrix at every voxel position * using a cubic b-spline parametrisation. This function does require @@ -78,11 +72,9 @@ void reg_spline_getJacobianPenaltyTermGradient(nifti_image *controlPointGridImag * @param jacobianImage Array that is filled with the Jacobian matrices * for every voxel. */ -extern "C++" void reg_spline_GetJacobianMatrix(nifti_image *referenceImage, nifti_image *controlPointGridImage, - mat33 *jacobianImage - ); + mat33 *jacobianImage); /* *************************************************************** */ /** @brief Correct the folding in the transformation parametrised through * cubic B-Spline @@ -92,11 +84,9 @@ void reg_spline_GetJacobianMatrix(nifti_image *referenceImage, * @param approx The function can be run be considering only the control * point position (approx==false) or every voxel (approx==true) */ -extern "C++" double reg_spline_correctFolding(nifti_image *controlPointGridImage, nifti_image *referenceImage, - bool approx - ); + bool approx); /* *************************************************************** */ /** @brief Compute the Jacobian determinant at every voxel position * from a deformation field. A linear interpolation is @@ -105,7 +95,6 @@ double reg_spline_correctFolding(nifti_image *controlPointGridImage, * @param jacobianImage This image will be fill with the Jacobian * determinant of the transformation of every voxel. */ -extern "C++" void reg_defField_getJacobianMap(nifti_image *deformationField, nifti_image *jacobianImage); /* *************************************************************** */ @@ -116,7 +105,6 @@ void reg_defField_getJacobianMap(nifti_image *deformationField, * @param jacobianMatrices This array will be fill with the Jacobian * matrices of the transformation of every voxel. */ -extern "C++" void reg_defField_getJacobianMatrix(nifti_image *deformationField, mat33 *jacobianMatrices); /* *************************************************************** */ @@ -129,14 +117,11 @@ void reg_defField_getJacobianMatrix(nifti_image *deformationField, * @param jacobianMatrices Array of matrices that will be filled with * the Jacobian matrices of the transformation */ -extern "C++" int reg_defField_GetJacobianMatFromFlowField(mat33* jacobianMatrices, nifti_image *flowFieldImage); -extern "C++" int reg_spline_GetJacobianMatFromVelocityGrid(mat33* jacobianMatrices, nifti_image *velocityGridImage, - nifti_image *referenceImage - ); + nifti_image *referenceImage); /* *************************************************************** */ /** @brief This function computed a Jacobian determinant map by integrating * the velocity grid @@ -145,11 +130,8 @@ int reg_spline_GetJacobianMatFromVelocityGrid(mat33* jacobianMatrices, * @param velocityFieldImage Image that contains a velocity field * parametrised using a grid of control points */ -extern "C++" int reg_defField_GetJacobianDetFromFlowField(nifti_image *jacobianDetImage, - nifti_image *flowFieldImage - ); -extern "C++" + nifti_image *flowFieldImage); int reg_spline_GetJacobianDetFromVelocityGrid(nifti_image *jacobianDetImage, nifti_image *velocityGridImage); /* *************************************************************** */ diff --git a/reg-lib/cpu/_reg_localTrans_regul.cpp b/reg-lib/cpu/_reg_localTrans_regul.cpp index 4ecd3c77..8edc51be 100755 --- a/reg-lib/cpu/_reg_localTrans_regul.cpp +++ b/reg-lib/cpu/_reg_localTrans_regul.cpp @@ -152,7 +152,6 @@ double reg_spline_approxBendingEnergyValue3D(const nifti_image *splineControlPoi return constraintValue / (double)splineControlPoint->nvox; } /* *************************************************************** */ -extern "C++" double reg_spline_approxBendingEnergy(const nifti_image *splineControlPoint) { if (splineControlPoint->nz == 1) { switch (splineControlPoint->datatype) { @@ -451,7 +450,6 @@ void reg_spline_approxBendingEnergyGradient3D(nifti_image *splineControlPoint, reg_getDeformationFromDisplacement(splineControlPoint); } /* *************************************************************** */ -extern "C++" void reg_spline_approxBendingEnergyGradient(nifti_image *splineControlPoint, nifti_image *gradientImage, float weight) { diff --git a/reg-lib/cpu/_reg_localTrans_regul.h b/reg-lib/cpu/_reg_localTrans_regul.h index 237a06c1..1c929167 100755 --- a/reg-lib/cpu/_reg_localTrans_regul.h +++ b/reg-lib/cpu/_reg_localTrans_regul.h @@ -23,7 +23,6 @@ * parametrisation * @return The normalised bending energy. Normalised by the number of voxel */ -extern "C++" double reg_spline_approxBendingEnergy(const nifti_image *controlPointGridImage); /* *************************************************************** */ /** @brief Compute and return the approximated (at the control point position) @@ -35,7 +34,6 @@ double reg_spline_approxBendingEnergy(const nifti_image *controlPointGridImage); * at every control point position. * @param weight Scalar which will be multiplied by the bending-energy gradient */ -extern "C++" void reg_spline_approxBendingEnergyGradient(nifti_image *controlPointGridImage, nifti_image *gradientImage, float weight); @@ -45,7 +43,6 @@ void reg_spline_approxBendingEnergyGradient(nifti_image *controlPointGridImage, * parametrisation * @return The normalised linear energy. Normalised by the number of voxel */ -extern "C++" double reg_spline_linearEnergy(const nifti_image *referenceImage, const nifti_image *controlPointGridImage); /* *************************************************************** */ @@ -55,7 +52,6 @@ double reg_spline_linearEnergy(const nifti_image *referenceImage, * parametrisation * @return The normalised linear energy. Normalised by the number of voxel */ -extern "C++" double reg_spline_approxLinearEnergy(const nifti_image *controlPointGridImage); /* *************************************************************** */ /** @brief Compute the gradient of the linear elastic energy terms @@ -69,7 +65,6 @@ double reg_spline_approxLinearEnergy(const nifti_image *controlPointGridImage); * current values * @param weight Weight to apply to the term of the penalty */ -extern "C++" void reg_spline_linearEnergyGradient(const nifti_image *referenceImage, const nifti_image *controlPointGridImage, nifti_image *gradientImage, @@ -85,7 +80,6 @@ void reg_spline_linearEnergyGradient(const nifti_image *referenceImage, * current values * @param weight Weight to apply to the term of the penalty */ -extern "C++" void reg_spline_approxLinearEnergyGradient(const nifti_image *controlPointGridImage, nifti_image *gradientImage, float weight); @@ -94,14 +88,12 @@ void reg_spline_approxLinearEnergyGradient(const nifti_image *controlPointGridIm * @param deformationField Image that contains the transformation. * @return The normalised linear energy. Normalised by the number of voxel */ -extern "C++" double reg_defField_linearEnergy(const nifti_image *deformationField); /* *************************************************************** */ /** @brief Compute and return the linear elastic energy terms. * @param deformationField Image that contains the transformation. * @param weight Weight to apply to the term of the penalty */ -extern "C++" void reg_defField_linearEnergyGradient(const nifti_image *deformationField, nifti_image *gradientImage, float weight); @@ -114,7 +106,6 @@ void reg_defField_linearEnergyGradient(const nifti_image *deformationField, * @param landmarkReference Landmark in the reference image * @param landmarkFloating Landmark in the floating image */ -extern "C++" double reg_spline_getLandmarkDistance(const nifti_image *controlPointImage, size_t landmarkNumber, float *landmarkReference, @@ -131,7 +122,6 @@ double reg_spline_getLandmarkDistance(const nifti_image *controlPointImage, * @param landmarkFloating Landmark in the floating image * @param weight weight to apply to the gradient */ -extern "C++" void reg_spline_getLandmarkDistanceGradient(const nifti_image *controlPointImage, nifti_image *gradientImage, size_t landmarkNumber, @@ -144,11 +134,9 @@ void reg_spline_getLandmarkDistanceGradient(const nifti_image *controlPointImage * parametrisation * @return The normalised pairwise energy. Normalised by the number of voxel */ -extern "C++" void reg_spline_approxLinearPairwiseGradient(nifti_image *controlPointGridImage, nifti_image *gradientImage, float weight); /* *************************************************************** */ -extern "C++" double reg_spline_approxLinearPairwise(nifti_image *controlPointGridImage); /* *************************************************************** */ diff --git a/reg-lib/cpu/_reg_maths.h b/reg-lib/cpu/_reg_maths.h index 2eac28f9..6a35bd6d 100644 --- a/reg-lib/cpu/_reg_maths.h +++ b/reg-lib/cpu/_reg_maths.h @@ -72,53 +72,53 @@ DEVICE inline int Round(const T& x) { /* *************************************************************** */ } // namespace NiftyReg /* *************************************************************** */ -extern "C++" template +template void reg_LUdecomposition(T *inputMatrix, size_t dim, size_t *index); /* *************************************************************** */ -extern "C++" template +template void reg_matrixMultiply(T *mat1, T *mat2, size_t *dim1, size_t *dim2, T * &res); /* *************************************************************** */ -extern "C++" template +template void reg_matrixInvertMultiply(T *mat, size_t dim, size_t *index, T *vec); /* *************************************************************** */ -extern "C++" template +template T* reg_matrix1DAllocate(size_t arraySize); /* *************************************************************** */ -extern "C++" template +template T* reg_matrix1DAllocateAndInitToZero(size_t arraySize); /* *************************************************************** */ -extern "C++" template +template void reg_matrix1DDeallocate(T* mat); /* *************************************************************** */ -extern "C++" template +template T** reg_matrix2DAllocate(size_t arraySizeX, size_t arraySizeY); /* *************************************************************** */ -extern "C++" template +template T** reg_matrix2DAllocateAndInitToZero(size_t arraySizeX, size_t arraySizeY); /* *************************************************************** */ -extern "C++" template +template void reg_matrix2DDeallocate(size_t arraySizeX, T** mat); /* *************************************************************** */ -extern "C++" template +template T** reg_matrix2DTranspose(T** mat, size_t arraySizeX, size_t arraySizeY); /* *************************************************************** */ -extern "C++" template +template T** reg_matrix2DMultiply(T** mat1, size_t mat1X, size_t mat1Y, T** mat2, size_t mat2X, size_t mat2Y, bool transposeMat2); -extern "C++" template +template void reg_matrix2DMultiply(T** mat1, size_t mat1X, size_t mat1Y, T** mat2, size_t mat2X, size_t mat2Y, T** res, bool transposeMat2); /* *************************************************************** */ -extern "C++" template +template T* reg_matrix2DVectorMultiply(T** mat, size_t m, size_t n, T* vect); -extern "C++" template +template void reg_matrix2DVectorMultiply(T** mat, size_t m, size_t n, T* vect, T* res); /* *************************************************************** */ /** @brief Add two 3-by-3 matrices @@ -165,10 +165,9 @@ void reg_mat33_to_nan(mat33 *A); /** @brief Transform a mat44 to a mat33 matrix */ mat33 reg_mat44_to_mat33(mat44 const* A); -extern "C++" void reg_heapSort(float *array_tmp, int *index_tmp, int blockNum); /* *************************************************************** */ -extern "C++" template +template void reg_heapSort(T *array_tmp,int blockNum); /* *************************************************************** */ bool operator==(mat44 A,mat44 B); diff --git a/reg-lib/cpu/_reg_maths_eigen.h b/reg-lib/cpu/_reg_maths_eigen.h index 16c079c4..ce326b47 100644 --- a/reg-lib/cpu/_reg_maths_eigen.h +++ b/reg-lib/cpu/_reg_maths_eigen.h @@ -8,13 +8,13 @@ /* *************************************************************** */ /* *************************************************************** */ -extern "C++" template +template void svd(T **in, size_t m, size_t n, T * w, T **v); /* *************************************************************** */ -extern "C++" template +template void svd(T **in, size_t m, size_t n, T ***U, T ***S, T ***V); /* *************************************************************** */ -extern "C++" template +template T reg_matrix2DDet(T** mat, size_t m, size_t n); /* *************************************************************** */ /** @brief Compute the inverse of a 4-by-4 matrix diff --git a/reg-lib/cpu/_reg_mind.h b/reg-lib/cpu/_reg_mind.h index c1db52e6..92e08eeb 100644 --- a/reg-lib/cpu/_reg_mind.h +++ b/reg-lib/cpu/_reg_mind.h @@ -71,14 +71,12 @@ class reg_mindssc: public reg_mind { virtual ~reg_mindssc(); }; /* *************************************************************** */ -extern "C++" void GetMindImageDescriptor(const nifti_image *inputImage, nifti_image *mindImage, const int *mask, const int& descriptorOffset, const int& currentTimepoint); /* *************************************************************** */ -extern "C++" void GetMindSscImageDescriptor(const nifti_image *inputImage, nifti_image *mindSscImage, const int *mask, diff --git a/reg-lib/cpu/_reg_mrf.h b/reg-lib/cpu/_reg_mrf.h index 75a91ea4..9471d41a 100644 --- a/reg-lib/cpu/_reg_mrf.h +++ b/reg-lib/cpu/_reg_mrf.h @@ -102,23 +102,18 @@ class reg_mrf bool initialised; ///< Variable to access if the object has been initialised }; /********************************************************************************************************/ -extern "C++" template void GetGraph_core3D(nifti_image* controlPointGridImage, float* edgeWeightMatrix, float* index_neighbours, nifti_image *refImage, int *mask); -extern "C++" template void GetGraph_core2D(nifti_image* controlPointGridImage, float* edgeWeightMatrix, float* index_neighbours, nifti_image *refImage, int *mask); - -extern "C++" void dt1sq(float *val,int* ind,int len,float offset,int k,int* v,float* z,float* f,int* ind1); -extern "C++" void dt3x(float* r,int* indr,int rl,float dx,float dy,float dz); /********************************************************************************************************/ diff --git a/reg-lib/cpu/_reg_nmi.cpp b/reg-lib/cpu/_reg_nmi.cpp index e3eee290..cd309712 100755 --- a/reg-lib/cpu/_reg_nmi.cpp +++ b/reg-lib/cpu/_reg_nmi.cpp @@ -225,8 +225,8 @@ void reg_getNMIValue(const nifti_image *referenceImage, // No approximation is used for the Parzen windowing for (size_t voxel = 0; voxel < voxelNumber; ++voxel) { if (referenceMask[voxel] > -1) { - const DataType refValue = refPtr[voxel]; - const DataType warValue = warPtr[voxel]; + const DataType& refValue = refPtr[voxel]; + const DataType& warValue = warPtr[voxel]; if (refValue == refValue && warValue == warValue) { for (int r = int(refValue - 1); r < int(refValue + 3); ++r) { if (0 <= r && r < referenceBinNumber[t]) { @@ -242,8 +242,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, } } } - } - else { + } else { // An approximation is used for the Parzen windowing. First intensities are binarised then // the histogram is convolved with a spine kernel function. for (size_t voxel = 0; voxel < voxelNumber; ++voxel) { @@ -267,12 +266,11 @@ void reg_getNMIValue(const nifti_image *referenceImage, for (int r = 0; r < referenceBinNumber[t]; ++r) { double value = 0; int index = r - 1; - double* ptrHisto = &jointHistoProPtr[index + referenceBinNumber[t] * f]; + double *ptrHisto = &jointHistoProPtr[index + referenceBinNumber[t] * f]; for (int it = 0; it < 3; it++) { - if (-1 < index && index < referenceBinNumber[t]) { + if (-1 < index && index < referenceBinNumber[t]) value += *ptrHisto * kernel[it]; - } ++ptrHisto; ++index; } @@ -282,14 +280,13 @@ void reg_getNMIValue(const nifti_image *referenceImage, // Histogram is then smooth along the warped floating axis for (int r = 0; r < referenceBinNumber[t]; ++r) { for (int f = 0; f < floatingBinNumber[t]; ++f) { - double value = 0.; + double value = 0; int index = f - 1; - double* ptrHisto = &jointHistoLogPtr[r + referenceBinNumber[t] * index]; + double *ptrHisto = &jointHistoLogPtr[r + referenceBinNumber[t] * index]; for (int it = 0; it < 3; it++) { - if (-1 < index && index < floatingBinNumber[t]) { + if (-1 < index && index < floatingBinNumber[t]) value += *ptrHisto * kernel[it]; - } ptrHisto += referenceBinNumber[t]; ++index; } @@ -298,7 +295,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, } } // Normalise the histogram - double activeVoxel = 0.f; + double activeVoxel = 0; for (int i = 0; i < totalBinNumber[t]; ++i) activeVoxel += jointHistoProPtr[i]; entropyValues[t][3] = activeVoxel; @@ -306,7 +303,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, jointHistoProPtr[i] /= activeVoxel; // Marginalise over the reference axis for (int r = 0; r < referenceBinNumber[t]; ++r) { - double sum = 0.; + double sum = 0; int index = r; for (int f = 0; f < floatingBinNumber[t]; ++f) { sum += jointHistoProPtr[index]; @@ -317,7 +314,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, } // Marginalise over the warped floating axis for (int f = 0; f < floatingBinNumber[t]; ++f) { - double sum = 0.; + double sum = 0; int index = referenceBinNumber[t] * f; for (int r = 0; r < referenceBinNumber[t]; ++r) { sum += jointHistoProPtr[index]; @@ -328,7 +325,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, // Set the log values to zero memset(jointHistoLogPtr, 0, totalBinNumber[t] * sizeof(double)); // Compute the entropy of the reference image - double referenceEntropy = 0.; + double referenceEntropy = 0; for (int r = 0; r < referenceBinNumber[t]; ++r) { double valPro = jointHistoProPtr[referenceBinNumber[t] * floatingBinNumber[t] + r]; if (valPro > 0) { @@ -339,7 +336,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, } entropyValues[t][0] = referenceEntropy; // Compute the entropy of the warped floating image - double warpedEntropy = 0.; + double warpedEntropy = 0; for (int f = 0; f < floatingBinNumber[t]; ++f) { double valPro = jointHistoProPtr[referenceBinNumber[t] * floatingBinNumber[t] + referenceBinNumber[t] + f]; @@ -351,7 +348,7 @@ void reg_getNMIValue(const nifti_image *referenceImage, } entropyValues[t][1] = warpedEntropy; // Compute the joint entropy - double jointEntropy = 0.; + double jointEntropy = 0; for (int i = 0; i < referenceBinNumber[t] * floatingBinNumber[t]; ++i) { double valPro = jointHistoProPtr[i]; if (valPro > 0) { @@ -375,7 +372,7 @@ double GetSimilarityMeasureValue(const nifti_image *referenceImage, double **jointHistogramPro, double **entropyValues, const int *referenceMask, - const int& referenceTimePoint, + const int referenceTimePoint, const bool approximatePW) { std::visit([&](auto&& refImgDataType) { using RefImgDataType = std::decay_t; @@ -440,8 +437,8 @@ void reg_getVoxelBasedNmiGradient2d(const nifti_image *referenceImage, const nifti_image *warpedGradient, nifti_image *measureGradientImage, const int *referenceMask, - const int& currentTimepoint, - const double& timepointWeight) { + const int currentTimepoint, + const double timepointWeight) { #ifdef WIN32 long i; const long voxelNumber = (long)NiftiImage::calcVoxelNumber(referenceImage, 2); @@ -526,8 +523,8 @@ void reg_getVoxelBasedNmiGradient3d(const nifti_image *referenceImage, const nifti_image *warpedGradient, nifti_image *measureGradientImage, const int *referenceMask, - const int& currentTimepoint, - const double& timepointWeight) { + const int currentTimepoint, + const double timepointWeight) { #ifdef WIN32 long i; const long voxelNumber = (long)NiftiImage::calcVoxelNumber(referenceImage, 3); @@ -619,8 +616,8 @@ void GetVoxelBasedSimilarityMeasureGradient(const nifti_image *referenceImage, const nifti_image *warpedGradient, nifti_image *voxelBasedGradient, const int *referenceMask, - const int& currentTimepoint, - const double& timepointWeight) { + const int currentTimepoint, + const double timepointWeight) { std::visit([&](auto&& refImgDataType) { using RefImgDataType = std::decay_t; auto GetVoxelBasedNmiGradient = referenceImage->nz > 1 ? reg_getVoxelBasedNmiGradient3d : reg_getVoxelBasedNmiGradient2d; diff --git a/reg-lib/cpu/_reg_nmi.h b/reg-lib/cpu/_reg_nmi.h index 0599a70b..41040e48 100755 --- a/reg-lib/cpu/_reg_nmi.h +++ b/reg-lib/cpu/_reg_nmi.h @@ -65,9 +65,6 @@ class reg_nmi: public reg_measure { virtual unsigned short* GetFloatingBinNumber() { return this->floatingBinNumber; } - virtual void SetApproximatePW(bool val) { - this->approximatePW = val; - } virtual void ApproximatePW() { this->approximatePW = true; } @@ -76,10 +73,10 @@ class reg_nmi: public reg_measure { } protected: + bool approximatePW; unsigned short referenceBinNumber[255]; unsigned short floatingBinNumber[255]; unsigned short totalBinNumber[255]; - bool approximatePW; double **jointHistogramPro; double **jointHistogramLog; double **entropyValues; @@ -90,7 +87,7 @@ class reg_nmi: public reg_measure { void DeallocateHistogram(); }; /* *************************************************************** */ -extern "C++" template +template void reg_getNMIValue(const nifti_image *referenceImage, const nifti_image *warpedImage, const double *timePointWeight, @@ -251,7 +248,6 @@ class reg_multichannel_nmi: public reg_measure { }; /* *************************************************************** */ /// Multi channel NMI version - Entropy -extern "C++" void reg_getMultiChannelNmiValue(nifti_image *referenceImages, nifti_image *warpedImages, unsigned *referenceBins, // should be an array of size num_reference_volumes @@ -263,7 +259,6 @@ void reg_getMultiChannelNmiValue(nifti_image *referenceImages, bool approx); /* *************************************************************** */ /// Multi channel NMI version - Gradient -extern "C++" void reg_getVoxelBasedMultiChannelNmiGradient2D(nifti_image *referenceImages, nifti_image *warpedImages, nifti_image *warpedImageGradient, @@ -276,7 +271,6 @@ void reg_getVoxelBasedMultiChannelNmiGradient2D(nifti_image *referenceImages, bool approx); /* *************************************************************** */ /// Multi channel NMI version - Gradient -extern "C++" void reg_getVoxelBasedMultiChannelNmiGradient3D(nifti_image *referenceImages, nifti_image *warpedImages, nifti_image *warpedImageGradient, diff --git a/reg-lib/cpu/_reg_resampling.h b/reg-lib/cpu/_reg_resampling.h index f69c4cf4..ab39078f 100755 --- a/reg-lib/cpu/_reg_resampling.h +++ b/reg-lib/cpu/_reg_resampling.h @@ -33,7 +33,6 @@ * @param dtIndicies Array of 6 integers that correspond to the "time" indicies of the diffusion tensor * components in the order xx,yy,zz,xy,xz,yz. If there are no DT images, pass an array of -1's */ -extern "C++" void reg_resampleImage(nifti_image *floatingImage, nifti_image *warpedImage, const nifti_image *deformationField, @@ -43,7 +42,6 @@ void reg_resampleImage(nifti_image *floatingImage, const bool *dtiTimepoint = nullptr, const mat33 *jacMat = nullptr); /* *************************************************************** */ -extern "C++" void reg_resampleImage_PSF(const nifti_image *floatingImage, nifti_image *warpedImage, const nifti_image *deformationField, @@ -53,14 +51,12 @@ void reg_resampleImage_PSF(const nifti_image *floatingImage, const mat33 *jacMat, const char& algorithm); /* *************************************************************** */ -extern "C++" void reg_resampleGradient(const nifti_image *gradientImage, nifti_image *warpedGradient, const nifti_image *deformationField, const int& interp, const float& paddingValue); /* *************************************************************** */ -extern "C++" void reg_getImageGradient(nifti_image *floatingImage, nifti_image *warpedGradient, const nifti_image *deformationField, @@ -72,13 +68,11 @@ void reg_getImageGradient(nifti_image *floatingImage, const mat33 *jacMat = nullptr, const nifti_image *warpedImage = nullptr); /* *************************************************************** */ -extern "C++" void reg_getImageGradient_symDiff(const nifti_image *img, nifti_image *gradImg, const int *mask, const float& paddingValue, const int& timepoint); /* *************************************************************** */ -extern "C++" nifti_image* reg_makeIsotropic(nifti_image*, int); /* *************************************************************** */ diff --git a/reg-lib/cpu/_reg_splineBasis.h b/reg-lib/cpu/_reg_splineBasis.h index 5436ea7e..8a0afe2d 100755 --- a/reg-lib/cpu/_reg_splineBasis.h +++ b/reg-lib/cpu/_reg_splineBasis.h @@ -16,50 +16,50 @@ #include "_reg_tools.h" -extern "C++" template +template void get_BSplineBasisValues(DataType basis, DataType *values); -extern "C++" template +template void get_BSplineBasisValues(DataType basis, DataType *values, DataType *first); -extern "C++" template +template void get_BSplineBasisValues(DataType basis, DataType *values, DataType *first, DataType *second); -extern "C++" template +template void get_BSplineBasisValue(DataType basis, int index, DataType &value); -extern "C++" template +template void get_BSplineBasisValue(DataType basis, int index, DataType &value, DataType &first); -extern "C++" template +template void get_BSplineBasisValue(DataType basis, int index, DataType &value, DataType &first, DataType &second); -extern "C++" template +template void set_first_order_basis_values(DataType *basisX, DataType *basisY); -extern "C++" template +template void set_first_order_basis_values(DataType *basisX, DataType *basisY, DataType *basisZ); -extern "C++" template +template void set_second_order_bspline_basis_values(DataType *basisXX, DataType *basisYY, DataType *basisXY); -extern "C++" template +template void set_second_order_bspline_basis_values(DataType *basisXX, DataType *basisYY, DataType *basisZZ, @@ -68,20 +68,20 @@ void set_second_order_bspline_basis_values(DataType *basisXX, DataType *basisXZ); -extern "C++" template +template void get_SplineBasisValues(DataType basis, DataType *values); -extern "C++" template +template void get_SplineBasisValues(DataType basis, DataType *values, DataType *first); -extern "C++" template +template void get_SplineBasisValues(DataType basis, DataType *values, DataType *first, DataType *second); -extern "C++" template +template void get_SlidedValues(DataType &defX, DataType &defY, int X, @@ -91,7 +91,7 @@ void get_SlidedValues(DataType &defX, mat44 *df_voxel2Real, int *dim, bool displacement); -extern "C++" template +template void get_SlidedValues(DataType &defX, DataType &defY, DataType &defZ, @@ -106,7 +106,7 @@ void get_SlidedValues(DataType &defX, bool displacement); -extern "C++" template +template void get_GridValues(int startX, int startY, nifti_image *splineControlPoint, @@ -116,7 +116,7 @@ void get_GridValues(int startX, DataType *dispY, bool approx, bool displacement); -extern "C++" template +template void get_GridValues(int startX, int startY, int startZ, diff --git a/reg-lib/cpu/_reg_ssd.h b/reg-lib/cpu/_reg_ssd.h index 9a27c185..008178a4 100755 --- a/reg-lib/cpu/_reg_ssd.h +++ b/reg-lib/cpu/_reg_ssd.h @@ -70,7 +70,7 @@ class reg_ssd: public reg_measure { * @param localWeightSim Image that contains the local weight similarity * @return Returns the computed sum squared difference */ -extern "C++" template +template double reg_getSsdValue(const nifti_image *referenceImage, const nifti_image *warpedImage, const double *timePointWeight, @@ -94,7 +94,7 @@ double reg_getSsdValue(const nifti_image *referenceImage, * @param timepointWeight Weight of the specified time point * @param localWeightSim Image that contains the local weight similarity */ -extern "C++" template +template void reg_getVoxelBasedSsdGradient(const nifti_image *referenceImage, const nifti_image *warpedImage, const nifti_image *warpedGradient, diff --git a/reg-lib/cpu/_reg_tools.h b/reg-lib/cpu/_reg_tools.h index 8b246513..d776017f 100755 --- a/reg-lib/cpu/_reg_tools.h +++ b/reg-lib/cpu/_reg_tools.h @@ -46,7 +46,6 @@ typedef enum { * both qform_code and sform_code are set to zero. * @param image Input image to check and correct if necessary */ -extern "C++" void reg_checkAndCorrectDimension(nifti_image *image); /* *************************************************************** */ /** @brief Check if the specified filename corresponds to an image. @@ -54,7 +53,6 @@ void reg_checkAndCorrectDimension(nifti_image *image); * @return True is the specified filename corresponds to an image, * false otherwise. */ -extern "C++" bool reg_isAnImageFileName(const char *name); /* *************************************************************** */ /** @brief Rescale an input image between two user-defined values. @@ -65,7 +63,6 @@ bool reg_isAnImageFileName(const char *name); * @param lowThr Intensity to use as lower threshold * @param upThr Intensity to use as higher threshold */ -extern "C++" void reg_intensityRescale(nifti_image *image, int timepoint, float newMin, @@ -75,14 +72,12 @@ void reg_intensityRescale(nifti_image *image, * the intensity values * @param image Image to be updated */ -extern "C++" void reg_tools_removeSCLInfo(nifti_image *img); /* *************************************************************** */ /** @brief reg_getRealImageSpacing * @param image image * @param spacingValues spacingValues */ -extern "C++" void reg_getRealImageSpacing(nifti_image *image, float *spacingValues); /* *************************************************************** */ @@ -93,7 +88,6 @@ void reg_getRealImageSpacing(nifti_image *image, * @param axis Boolean array to specify which axis have to be * smoothed. The array follow the dim array of the nifti header. */ -extern "C++" void reg_tools_kernelConvolution(nifti_image *image, const float *sigma, const int& kernelType, @@ -110,7 +104,6 @@ void reg_tools_kernelConvolution(nifti_image *image, * @param timePoint Boolean array to specify which timepoints have to be * smoothed. */ -extern "C++" void reg_tools_labelKernelConvolution(nifti_image *image, float varianceX, float varianceY, @@ -126,7 +119,7 @@ void reg_tools_labelKernelConvolution(nifti_image *image, * @param axis Boolean array to specify which axis have to be * downsampled. The array follow the dim array of the nifti header. */ -extern "C++" template +template void reg_downsampleImage(nifti_image *image, int type, bool *axis); @@ -137,7 +130,7 @@ void reg_downsampleImage(nifti_image *image, * @return Scalar value that corresponds to the longest * euclidean distance */ -extern "C++" template +template PrecisionType reg_getMaximalLength(const nifti_image *image, const bool& optimiseX, const bool& optimiseY, @@ -146,7 +139,7 @@ PrecisionType reg_getMaximalLength(const nifti_image *image, /** @brief Change the datatype of a nifti image * @param image Image to be updated. */ -extern "C++" template +template void reg_tools_changeDatatype(nifti_image *image, int type = -1); /* *************************************************************** */ @@ -156,7 +149,6 @@ void reg_tools_changeDatatype(nifti_image *image, * @param out Result image that contains the result of the operation * between the first and second image. */ -extern "C++" void reg_tools_addImageToImage(const nifti_image *img1, const nifti_image *img2, nifti_image *out); @@ -167,7 +159,6 @@ void reg_tools_addImageToImage(const nifti_image *img1, * @param out Result image that contains the result of the operation * between the first and second image. */ -extern "C++" void reg_tools_subtractImageFromImage(const nifti_image *img1, const nifti_image *img2, nifti_image *out); @@ -178,7 +169,6 @@ void reg_tools_subtractImageFromImage(const nifti_image *img1, * @param out Result image that contains the result of the operation * between the first and second image. */ -extern "C++" void reg_tools_multiplyImageToImage(const nifti_image *img1, const nifti_image *img2, nifti_image *out); @@ -189,7 +179,6 @@ void reg_tools_multiplyImageToImage(const nifti_image *img1, * @param out Result image that contains the result of the operation * between the first and second image. */ -extern "C++" void reg_tools_divideImageToImage(const nifti_image *img1, const nifti_image *img2, nifti_image *out); @@ -199,7 +188,6 @@ void reg_tools_divideImageToImage(const nifti_image *img1, * @param out Result image that contains the result of the operation. * @param val Value to be added to input image */ -extern "C++" void reg_tools_addValueToImage(const nifti_image *img, nifti_image *out, const double& val); @@ -209,7 +197,6 @@ void reg_tools_addValueToImage(const nifti_image *img, * @param out Result image that contains the result of the operation. * @param val Value to be subtracted from input image */ -extern "C++" void reg_tools_subtractValueFromImage(const nifti_image *img, nifti_image *out, const double& val); @@ -219,7 +206,6 @@ void reg_tools_subtractValueFromImage(const nifti_image *img, * @param out Result image that contains the result of the operation. * @param val Value to be multiplied to input image */ -extern "C++" void reg_tools_multiplyValueToImage(const nifti_image *img, nifti_image *out, const double& val); @@ -229,7 +215,6 @@ void reg_tools_multiplyValueToImage(const nifti_image *img, * @param out Result image that contains the result of the operation. * @param val Value to be divided to input image */ -extern "C++" void reg_tools_divideValueToImage(const nifti_image *img, nifti_image *out, const double& val); @@ -238,7 +223,6 @@ void reg_tools_divideValueToImage(const nifti_image *img, * from 0 are set to 1, 0 otherwise. * @param img Image that will be binarise inline */ -extern "C++" void reg_tools_binarise_image(nifti_image *img); /* *************************************************************** */ /** @brief Binarise an input image. The binarisation is @@ -249,7 +233,6 @@ void reg_tools_binarise_image(nifti_image *img); * All values bellow thr are set to 0. All values equal * or bellow thr are set to 1 */ -extern "C++" void reg_tools_binarise_image(nifti_image *img, float thr); /* *************************************************************** */ @@ -260,7 +243,6 @@ void reg_tools_binarise_image(nifti_image *img, * @param array The data array from the input nifti image * is binarised and stored in this array. */ -extern "C++" void reg_tools_binaryImage2int(const nifti_image *img, int *array); /* *************************************************************** */ @@ -270,7 +252,6 @@ void reg_tools_binaryImage2int(const nifti_image *img, * @param imgB Input vector image * @return Mean root mean squared error values returned */ -extern "C++" double reg_tools_getMeanRMS(const nifti_image *imgA, const nifti_image *imgB); /* *************************************************************** */ @@ -281,7 +262,6 @@ double reg_tools_getMeanRMS(const nifti_image *imgA, * have to be set to NaN * @param res Output image */ -extern "C++" int reg_tools_nanMask_image(const nifti_image *img, const nifti_image *mask, nifti_image *res); @@ -291,7 +271,6 @@ int reg_tools_nanMask_image(const nifti_image *img, * @param img Input image * @param mask Input mask which is updated in place */ -extern "C++" int reg_tools_removeNanFromMask(const nifti_image *image, int *mask); /* *************************************************************** */ /** @brief Get the minimal value of an image @@ -299,7 +278,6 @@ int reg_tools_removeNanFromMask(const nifti_image *image, int *mask); * @param timepoint active time point. All time points are used if set to -1 * @return min value */ -extern "C++" float reg_tools_getMinValue(const nifti_image *img, int timepoint); /* *************************************************************** */ /** @brief Get the maximal value of an image @@ -307,21 +285,18 @@ float reg_tools_getMinValue(const nifti_image *img, int timepoint); * @param timepoint active time point. All time points are used if set to -1 * @return max value */ -extern "C++" float reg_tools_getMaxValue(const nifti_image *img, int timepoint); /* *************************************************************** */ /** @brief Get the mean value of an image * @param img Input image * @return mean value */ -extern "C++" float reg_tools_getMeanValue(const nifti_image *img); /* *************************************************************** */ /** @brief Get the std value of an image * @param img Input image * @return std value */ -extern "C++" float reg_tools_getSTDValue(const nifti_image *img); /* *************************************************************** */ /** @brief Generate a pyramid from an input image. @@ -333,7 +308,7 @@ float reg_tools_getSTDValue(const nifti_image *img); * @param levelToPerform Number to level that will be perform during * the registration. */ -extern "C++" template +template void reg_createImagePyramid(const NiftiImage& input, vector& pyramid, unsigned levelNumber, @@ -348,7 +323,7 @@ void reg_createImagePyramid(const NiftiImage& input, * @param levelToPerform Number to level that will be perform during * the registration. */ -extern "C++" template +template void reg_createMaskPyramid(const NiftiImage& input, vector>& pyramid, unsigned levelNumber, @@ -364,7 +339,7 @@ void reg_createMaskPyramid(const NiftiImage& input, * @param upThr Upper threshold value. All Value above the threshold * are set to the threshold value. */ -extern "C++" template +template void reg_thresholdImage(nifti_image *image, T lowThr, T upThr); @@ -376,7 +351,6 @@ void reg_thresholdImage(nifti_image *image, * @param cmd String that contains the letter(s) of the axis * to flip (xyztuvw) */ -extern "C++" void reg_flipAxis(const nifti_image *image, void **outputArray, const std::string& cmd); @@ -387,7 +361,6 @@ void reg_flipAxis(const nifti_image *image, * @param image Image that contains a deformation field and will be * converted into a displacement field */ -extern "C++" int reg_getDisplacementFromDeformation(nifti_image *image); /* *************************************************************** */ /** @brief This function converts an image containing a displacement field @@ -396,7 +369,6 @@ int reg_getDisplacementFromDeformation(nifti_image *image); * @param image Image that contains a deformation field and will be * converted into a displacement field */ -extern "C++" int reg_getDeformationFromDisplacement(nifti_image *image); /* *************************************************************** */ /** @brief Set the gradient value along specified direction to zero @@ -405,7 +377,6 @@ int reg_getDeformationFromDisplacement(nifti_image *image); * @param yAxis Boolean to specified if the y-axis has to be zeroed * @param zAxis Boolean to specified if the z-axis has to be zeroed */ -extern "C++" void reg_setGradientToZero(nifti_image *image, bool xAxis, bool yAxis, @@ -416,7 +387,7 @@ void reg_setGradientToZero(nifti_image *image, * The returned value is the largest value computed as ((A/B)-1) * If A or B are zeros then the (A-B) value is returned. */ -extern "C++" template +template double reg_test_compare_arrays(const DataType *ptrA, const DataType *ptrB, size_t nvox); @@ -425,31 +396,25 @@ double reg_test_compare_arrays(const DataType *ptrA, * The returned value is the largest value computed as ((A/B)-1) * If A or B are zeros then the (A-B) value is returned. */ -extern "C++" double reg_test_compare_images(const nifti_image *imgA, const nifti_image *imgB); /* *************************************************************** */ /** @brief The absolute operator is applied to the input image */ -extern "C++" void reg_tools_abs_image(nifti_image *img); /* *************************************************************** */ -extern "C++" void mat44ToCptr(const mat44& mat, float *cMat); /* *************************************************************** */ -extern "C++" void cPtrToMat44(mat44 *mat, const float *cMat); /* *************************************************************** */ -extern "C++" void mat33ToCptr(const mat33 *mat, float *cMat, const unsigned numMats); /* *************************************************************** */ -extern "C++" void cPtrToMat33(mat33 *mat, const float *cMat); /* *************************************************************** */ -extern "C++" template +template void matmnToCptr(const T **mat, T *cMat, unsigned m, unsigned n); /* *************************************************************** */ -extern "C++" template +template void cPtrToMatmn(T **mat, const T *cMat, unsigned m, unsigned n); /* *************************************************************** */ void coordinateFromLinearIndex(int index, int maxValue_x, int maxValue_y, int& x, int& y, int& z); diff --git a/reg-lib/cuda/_reg_resampling_gpu.h b/reg-lib/cuda/_reg_resampling_gpu.h index 9d720006..0fe28ea4 100755 --- a/reg-lib/cuda/_reg_resampling_gpu.h +++ b/reg-lib/cuda/_reg_resampling_gpu.h @@ -15,7 +15,6 @@ #include "CudaCommon.hpp" /* *************************************************************** */ -extern "C++" void reg_resampleImage_gpu(const nifti_image *floatingImage, float *warpedImageCuda, const cudaArray *floatingImageCuda, @@ -24,7 +23,6 @@ void reg_resampleImage_gpu(const nifti_image *floatingImage, const size_t& activeVoxelNumber, const float& paddingValue); /* *************************************************************** */ -extern "C++" void reg_getImageGradient_gpu(const nifti_image *floatingImage, const cudaArray *floatingImageCuda, const float4 *deformationFieldCuda, diff --git a/reg-lib/cuda/blockMatchingKernel.h b/reg-lib/cuda/blockMatchingKernel.h index f341ff81..f1eb0943 100644 --- a/reg-lib/cuda/blockMatchingKernel.h +++ b/reg-lib/cuda/blockMatchingKernel.h @@ -27,7 +27,6 @@ * @param maskCuda The mask image on the device. * @param refMatCuda The reference image transformation matrix on the device. */ -extern "C++" void block_matching_method_gpu(const nifti_image *referenceImage, _reg_blockMatchingParam *params, const float *referenceImageCuda, diff --git a/reg-lib/cuda/optimizeKernel.h b/reg-lib/cuda/optimizeKernel.h index cfb7cb2c..c2d95bbc 100644 --- a/reg-lib/cuda/optimizeKernel.h +++ b/reg-lib/cuda/optimizeKernel.h @@ -3,28 +3,21 @@ #include "RNifti.h" /* -extern "C++" void optimize_gpu(_reg_blockMatchingParam *blockMatchingParams, mat44 *updateAffineMatrix, float **targetPosition_d, float **resultPosition_d, bool affine = true); -extern "C++" void affineLocalSearch3DCuda(mat44 *cpuMat, float* final_d, float *A_d, float* Sigma_d, float* U_d, float* VT_d, float * newResultPos_d, float* targetPos_d, float* resultPos_d, float* lengths_d, const unsigned numBlocks, const unsigned num_to_keep, const unsigned m, const unsigned n); */ -extern "C++" void cusolverSVD(float* A_d, unsigned m, unsigned n, float* S_d, float* VT_d, float* U_d); -extern "C++" void optimize_affine3D_cuda(mat44* cpuMat, float* final_d, float* A_d, float* U_d, float* Sigma_d, float* VT_d, float* lengths_d, float* reference_d, float* warped_d, float* newWarped_d, unsigned m, unsigned n, const unsigned numToKeep, bool ilsIn, bool isAffine); /* -extern "C++" void getAffineMat3D(float* A_d, float* Sigma_d, float* VT_d, float* U_d, float* target_d, float* result_d, float* r_d, float *transformation, const unsigned numBlocks, unsigned m, unsigned n); -extern "C++" void downloadMat44(mat44 *lastTransformation, float* transform_d); -extern "C++" void uploadMat44(mat44 lastTransformation, float* transform_d); */