Commit c928c0f3 authored by Marc Modat's avatar Marc Modat

Some 2D version function for aladin have been added - but not all yet

parent 9488e67d
......@@ -48,8 +48,8 @@ ENDIF(USE_SSE)
IF(USE_CUDA)
INCLUDE(${CMAKE_SOURCE_DIR}/CMake/cuda/FindCUDA.cmake)
ADD_DEFINITIONS(-D_USE_CUDA)
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-D_USE_CUDA")
ADD_DEFINITIONS(-D_USE_CUDA)
SET(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS};-D_USE_CUDA")
INCLUDE_DIRECTORIES(${CUDA_CUT_INCLUDE_DIR})
CUDA_INCLUDE_DIRECTORIES(${CUDA_CUT_INCLUDE_DIR})
CUDA_INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/nifti)
......
......@@ -87,6 +87,7 @@ typedef struct{
bool sourceSigmaFlag;
bool pyramidFlag;
bool useGPUFlag;
bool twoDimRegistration;
}FLAG;
void PetitUsage(char *exec)
{
......@@ -285,7 +286,22 @@ int main(int argc, char **argv)
fprintf(stderr,"** ERROR Error when reading the source image: %s\n",param->sourceImageName);
return 1;
}
/* Flag for 2D registration */
if(sourceHeader->nz==1 || targetHeader->nz==1){
flag->twoDimRegistration=1;
printf("\n[WARNING] The 2D version has not been implemented yet [/WARNING]\n");
printf("[WARNING] >>> Exit <<< [/WARNING]\n\n");
return 1;
#ifdef _USE_CUDA
if(flag->useGPUFlag){
printf("\n[WARNING] The GPU 2D version has not been implemented yet [/WARNING]\n");
printf("[WARNING] >>> Exit <<< [/WARNING]\n\n");
return 1;
}
#endif
}
/* Check the source background index */
if(!flag->backgroundIndexFlag) param->sourceBGValue = 0.0;
else{
......@@ -344,7 +360,7 @@ int main(int argc, char **argv)
}
/* read and binarise the target mask image */
nifti_image *targetMaskImage;
nifti_image *targetMaskImage=NULL;
if(flag->targetMaskFlag){
targetMaskImage = nifti_image_read(param->targetMaskName,true);
if(targetMaskImage == NULL){
......@@ -409,12 +425,13 @@ int main(int argc, char **argv)
int activeVoxelNumber=0;
/* downsample the input images if appropriate */
nifti_image *tempMaskImage;
nifti_image *tempMaskImage=NULL;
if(flag->targetMaskFlag){
tempMaskImage = nifti_copy_nim_info(targetMaskImage);
tempMaskImage->data = (void *)malloc(tempMaskImage->nvox * tempMaskImage->nbyper);
memcpy( tempMaskImage->data, targetMaskImage->data, tempMaskImage->nvox*tempMaskImage->nbyper);
memcpy(tempMaskImage->data, targetMaskImage->data, tempMaskImage->nvox*tempMaskImage->nbyper);
}
for(int l=level; l<param->levelNumber-1; l++){
int ratio = (int)pow(2,param->levelNumber-param->levelNumber+l+1);
......@@ -434,17 +451,18 @@ int main(int argc, char **argv)
reg_downsampleImage<PrecisionTYPE>(tempMaskImage, 0, targetDownsampleAxis);
}
}
targetMask = (int *)malloc(targetImage->nvox*sizeof(int));
if(flag->targetMaskFlag){
reg_tool_binaryImage2int(tempMaskImage, targetMask, activeVoxelNumber);
nifti_image_free(tempMaskImage);
}
else{
for(unsigned i=0; i<targetImage->nvox; i++) targetMask[i]=i;
for(unsigned int i=0; i<targetImage->nvox; i++)
targetMask[i]=i;
activeVoxelNumber=targetImage->nvox;
}
/* smooth the input image if appropriate */
if(flag->targetSigmaFlag){
bool smoothAxis[8]={true,true,true,true,true,true,true,true};
......@@ -455,21 +473,29 @@ int main(int argc, char **argv)
reg_gaussianSmoothing<PrecisionTYPE>(sourceImage, param->sourceSigmaValue, smoothAxis);
}
/* allocate the deformation Field image */
nifti_image *positionFieldImage = nifti_copy_nim_info(targetImage);
positionFieldImage->dim[0]=positionFieldImage->ndim=5;
positionFieldImage->dim[1]=positionFieldImage->nx=targetImage->nx;
positionFieldImage->dim[2]=positionFieldImage->ny=targetImage->ny;
positionFieldImage->dim[3]=positionFieldImage->nz=targetImage->nz;
positionFieldImage->dim[4]=positionFieldImage->nt=1;positionFieldImage->pixdim[4]=positionFieldImage->dt=1.0;
positionFieldImage->dim[5]=positionFieldImage->nu=3;positionFieldImage->pixdim[5]=positionFieldImage->du=1.0;
positionFieldImage->dim[6]=positionFieldImage->nv=1;positionFieldImage->pixdim[6]=positionFieldImage->dv=1.0;
positionFieldImage->dim[7]=positionFieldImage->nw=1;positionFieldImage->pixdim[7]=positionFieldImage->dw=1.0;
positionFieldImage->nvox=positionFieldImage->nx*positionFieldImage->ny*positionFieldImage->nz*positionFieldImage->nt*positionFieldImage->nu;
if(sizeof(PrecisionTYPE)==4) positionFieldImage->datatype = NIFTI_TYPE_FLOAT32;
else positionFieldImage->datatype = NIFTI_TYPE_FLOAT64;
positionFieldImage->nbyper = sizeof(PrecisionTYPE);
positionFieldImage->data = (void *)calloc(positionFieldImage->nvox, positionFieldImage->nbyper);
/* allocate the deformation Field image */
nifti_image *positionFieldImage = nifti_copy_nim_info(targetImage);
positionFieldImage->dim[0]=positionFieldImage->ndim=5;
positionFieldImage->dim[1]=positionFieldImage->nx=targetImage->nx;
positionFieldImage->dim[2]=positionFieldImage->ny=targetImage->ny;
positionFieldImage->dim[3]=positionFieldImage->nz=targetImage->nz;
positionFieldImage->dim[4]=positionFieldImage->nt=1;positionFieldImage->pixdim[4]=positionFieldImage->dt=1.0;
if(flag->twoDimRegistration) positionFieldImage->dim[5]=positionFieldImage->nu=2;
else positionFieldImage->dim[5]=positionFieldImage->nu=3;
positionFieldImage->pixdim[5]=positionFieldImage->du=1.0;
positionFieldImage->dim[6]=positionFieldImage->nv=1;positionFieldImage->pixdim[6]=positionFieldImage->dv=1.0;
positionFieldImage->dim[7]=positionFieldImage->nw=1;positionFieldImage->pixdim[7]=positionFieldImage->dw=1.0;
positionFieldImage->nvox=positionFieldImage->nx*positionFieldImage->ny*positionFieldImage->nz*positionFieldImage->nt*positionFieldImage->nu;
if(sizeof(PrecisionTYPE)==4) positionFieldImage->datatype = NIFTI_TYPE_FLOAT32;
else positionFieldImage->datatype = NIFTI_TYPE_FLOAT64;
positionFieldImage->nbyper = sizeof(PrecisionTYPE);
#ifdef _USE_CUDA
if(flag->useGPUFlag){
positionFieldImage->data=NULL;
}
else
#endif
positionFieldImage->data = (void *)calloc(positionFieldImage->nvox, positionFieldImage->nbyper);
/* allocate the result image */
nifti_image *resultImage = nifti_copy_nim_info(targetImage);
......@@ -502,12 +528,13 @@ int main(int argc, char **argv)
/* initialise the block matching */
_reg_blockMatchingParam blockMatchingParams;
initialise_block_matching_method( targetImage,
initialise_block_matching_method( targetImage,
&blockMatchingParams,
param->block_percent_to_use, // percentage of block kept
param->inlier_lts, // percentage of inlier in the optimisation process
targetMask,
flag->useGPUFlag);
mat44 updateAffineMatrix;
#ifdef _USE_CUDA
......@@ -551,7 +578,9 @@ int main(int argc, char **argv)
targetImage->nx, targetImage->ny, targetImage->nz, targetImage->dx, targetImage->dy, targetImage->dz);
printf("Source image size: \t%ix%ix%i voxels\t%gx%gx%g mm\n",
sourceImage->nx, sourceImage->ny, sourceImage->nz, sourceImage->dx, sourceImage->dy, sourceImage->dz);
printf("Block size = [4 4 4]\n");
if(flag->twoDimRegistration)
printf("Block size = [4 4 1]\n");
else printf("Block size = [4 4 4]\n");
printf("Block number = [%i %i %i]\n", blockMatchingParams.blockNumber[0],
blockMatchingParams.blockNumber[1], blockMatchingParams.blockNumber[2]);
#ifdef _VERBOSE
......@@ -616,14 +645,18 @@ int main(int argc, char **argv)
1,
param->sourceBGValue);
/* Compute the correspondances between blocks */
block_matching_method<PrecisionTYPE>( targetImage,
resultImage,
&blockMatchingParams,
targetMask);
if(flag->twoDimRegistration){
block_matching_method<PrecisionTYPE>( targetImage,
resultImage,
&blockMatchingParams,
targetMask);
}
else{
}
/* update the affine transformation matrix */
optimize( &blockMatchingParams,
&updateAffineMatrix,
RIGID);
&updateAffineMatrix,
RIGID);
#ifdef _USE_CUDA
}
#endif
......@@ -736,18 +769,26 @@ int main(int argc, char **argv)
/* OUTPUT THE RESULTS */
/* ****************** */
if(param->level2Perform != param->levelNumber){
free(positionFieldImage->data);
positionFieldImage->dim[1]=positionFieldImage->nx=targetHeader->nx;
positionFieldImage->dim[2]=positionFieldImage->ny=targetHeader->ny;
positionFieldImage->dim[3]=positionFieldImage->nz=targetHeader->nz;
positionFieldImage->dim[4]=positionFieldImage->nt=1;positionFieldImage->pixdim[4]=positionFieldImage->dt=1.0;
positionFieldImage->dim[5]=positionFieldImage->nu=3;positionFieldImage->pixdim[5]=positionFieldImage->du=1.0;
positionFieldImage->dim[6]=positionFieldImage->nv=1;positionFieldImage->pixdim[6]=positionFieldImage->dv=1.0;
positionFieldImage->dim[7]=positionFieldImage->nw=1;positionFieldImage->pixdim[7]=positionFieldImage->dw=1.0;
positionFieldImage->nvox=positionFieldImage->nx*positionFieldImage->ny*positionFieldImage->nz*positionFieldImage->nt*positionFieldImage->nu;
positionFieldImage->data = (void *)calloc(positionFieldImage->nvox, positionFieldImage->nbyper);
}
#ifdef _USE_CUDA
if(flag->useGPUFlag && param->level2Perform==param->levelNumber)
positionFieldImage->data = (void *)calloc(positionFieldImage->nvox, positionFieldImage->nbyper);
else
#endif
if(param->level2Perform != param->levelNumber){
if(positionFieldImage->data)free(positionFieldImage->data);
positionFieldImage->dim[1]=positionFieldImage->nx=targetHeader->nx;
positionFieldImage->dim[2]=positionFieldImage->ny=targetHeader->ny;
positionFieldImage->dim[3]=positionFieldImage->nz=targetHeader->nz;
positionFieldImage->dim[4]=positionFieldImage->nt=1;positionFieldImage->pixdim[4]=positionFieldImage->dt=1.0;
if(flag->twoDimRegistration)
positionFieldImage->dim[5]=positionFieldImage->nu=2;
else positionFieldImage->dim[5]=positionFieldImage->nu=3;
positionFieldImage->pixdim[5]=positionFieldImage->du=1.0;
positionFieldImage->dim[6]=positionFieldImage->nv=1;positionFieldImage->pixdim[6]=positionFieldImage->dv=1.0;
positionFieldImage->dim[7]=positionFieldImage->nw=1;positionFieldImage->pixdim[7]=positionFieldImage->dw=1.0;
positionFieldImage->nvox=positionFieldImage->nx*positionFieldImage->ny*positionFieldImage->nz*positionFieldImage->nt*positionFieldImage->nu;
positionFieldImage->data = (void *)calloc(positionFieldImage->nvox, positionFieldImage->nbyper);
}
/* The corresponding deformation field is evaluated and saved */
reg_affine_positionField( affineTransformation,
......
......@@ -174,7 +174,7 @@ void Usage(char *exec)
// printf("\t-fullJL\t\t\tThe JL is compute using the full resolution image [no]\n");
// printf("\t-gradJL\t\t\tTo use the gradient of the Jacobian determinant [no]\n");
printf("\t-bgi <int> <int> <int>\tForce the background value during\n\t\t\t\tresampling to have the same value as this voxel in the source image [none]\n");
printf("\t-bgi <int> <int> <int>\tForce the background value during\n\t\t\t\tresampling to have the same value than this voxel in the source image [none]\n");
// printf("\t-ssd\t\t\tTo use the SSD as the similiarity measure [no]\n");
printf("\t-noConj\t\t\tTo not use the conjuage gradient optimisation but a simple gradient ascent/descent\n");
printf("\t-mem\t\t\tDisplay an approximate memory requierment and exit\n");
......@@ -325,7 +325,7 @@ int main(int argc, char **argv)
param->sourceUpThresholdValue=(float)(atof(argv[++i]));
flag->sourceUpThresholdFlag=1;
}
else if(strcmp(argv[i], "-nmiGradSM") == 0){
else if(strcmp(argv[i], "-smoothGrad") == 0){
param->gradientSmoothingValue=(float)(atof(argv[++i]));
flag->gradientSmoothingFlag=1;
}
......@@ -392,6 +392,7 @@ int main(int argc, char **argv)
if(!flag->binningFlag) param->binning=64;
param->binning += 4; //This is due to the extrapolation of the joint histogram using the Parzen window
/* inactive the BE flag if the weight is 0 */
if(param->bendingEnergyWeight==0.0f)flag->bendingEnergyFlag=0;
nifti_image *targetHeader = nifti_image_read(param->targetImageName,false);
......@@ -455,7 +456,7 @@ int main(int argc, char **argv)
#endif
/* Read the affine tranformation is defined otherwise assign it to identity */
mat44 *affineTransformation;
mat44 *affineTransformation=NULL;
if(!flag->inputCPPFlag){
affineTransformation = (mat44 *)calloc(1,sizeof(mat44));
affineTransformation->m[0][0]=1.0;
......@@ -483,7 +484,7 @@ int main(int argc, char **argv)
}
/* read the control point image */
nifti_image *controlPointImage;
nifti_image *controlPointImage=NULL;
if(flag->inputCPPFlag){
controlPointImage = nifti_image_read(param->inputCPPName,true);
if(controlPointImage == NULL){
......@@ -494,7 +495,7 @@ int main(int argc, char **argv)
if(!flag->outputCPPFlag) param->outputCPPName=(char *)"outputCPP.nii";
/* read and binarise the target mask image */
nifti_image *targetMaskImage;
nifti_image *targetMaskImage=NULL;
if(flag->targetMaskFlag){
targetMaskImage = nifti_image_read(param->targetMaskName,true);
if(targetMaskImage == NULL){
......@@ -607,7 +608,7 @@ int main(int argc, char **argv)
/* downsample the input images if appropriate */
if(flag->pyramidFlag){
nifti_image *tempMaskImage;
nifti_image *tempMaskImage=NULL;
if(flag->targetMaskFlag){
tempMaskImage = nifti_copy_nim_info(targetMaskImage);
tempMaskImage->data = (void *)malloc(tempMaskImage->nvox * tempMaskImage->nbyper);
......@@ -862,37 +863,37 @@ int main(int argc, char **argv)
}
/* the gradient images are allocated */
nifti_image *resultGradientImage;
nifti_image *voxelNMIGradientImage;
nifti_image *nodeNMIGradientImage;
nifti_image *resultGradientImage=NULL;
nifti_image *voxelNMIGradientImage=NULL;
nifti_image *nodeNMIGradientImage=NULL;
/* Conjugate gradient */
PrecisionTYPE *conjugateG;
PrecisionTYPE *conjugateH;
PrecisionTYPE *conjugateG=NULL;
PrecisionTYPE *conjugateH=NULL;
/* joint histogram related variables */
double *probaJointHistogram = (double *)malloc(param->binning*(param->binning+2)*sizeof(double));
double *logJointHistogram = (double *)malloc(param->binning*(param->binning+2)*sizeof(double));
double *entropies = (double *)malloc(4*sizeof(double));
PrecisionTYPE *bestControlPointPosition;
PrecisionTYPE *bestControlPointPosition=NULL;
#ifdef _USE_CUDA
float *targetImageArray_d;
cudaArray *sourceImageArray_d;
float4 *controlPointImageArray_d;
float *resultImageArray_d;
float4 *positionFieldImageArray_d;
int *targetMask_d;
float *targetImageArray_d=NULL;
cudaArray *sourceImageArray_d=NULL;
float4 *controlPointImageArray_d=NULL;
float *resultImageArray_d=NULL;
float4 *positionFieldImageArray_d=NULL;
int *targetMask_d=NULL;
float4 *resultGradientArray_d;
float4 *voxelNMIGradientArray_d;
float4 *nodeNMIGradientArray_d;
float4 *resultGradientArray_d=NULL;
float4 *voxelNMIGradientArray_d=NULL;
float4 *nodeNMIGradientArray_d=NULL;
float4 *conjugateG_d;
float4 *conjugateH_d;
float4 *conjugateG_d=NULL;
float4 *conjugateH_d=NULL;
float4 *bestControlPointPosition_d;
float4 *bestControlPointPosition_d=NULL;
float *logJointHistogram_d;
float *logJointHistogram_d=NULL;
if(flag->useGPUFlag){
if(!flag->noConjugateGradient){
......@@ -921,7 +922,7 @@ int main(int argc, char **argv)
// Index of the active voxel is stored
int *targetMask_h;CUDA_SAFE_CALL(cudaMallocHost((void **)&targetMask_h, activeVoxelNumber*sizeof(int)));
int *targetMask_h_ptr = &targetMask_h[0];
for(int i=0;i<targetImage->nvox;i++){
for(unsigned int i=0;i<targetImage->nvox;i++){
if(targetMask[i]!=-1) *targetMask_h_ptr++=i;
}
CUDA_SAFE_CALL(cudaMalloc((void **)&targetMask_d, activeVoxelNumber*sizeof(int)));
......
......@@ -198,7 +198,7 @@ int main(int argc, char **argv)
flag->outputPosFlag)
positionFieldNeeded=true;
nifti_image *positionFieldImage;
nifti_image *positionFieldImage=NULL;
if(positionFieldNeeded==true){
positionFieldImage = nifti_copy_nim_info(targetImage);
positionFieldImage->cal_min=0;
......
......@@ -215,7 +215,7 @@ int main(int argc, char **argv)
}
if(flag->addImageFlag || flag->subImageFlag || flag->mulImageFlag || flag->divImageFlag){
nifti_image *image2;
nifti_image *image2=NULL;
if(flag->addImageFlag) image2 = nifti_image_read(param->addImageName,true);
if(flag->subImageFlag) image2 = nifti_image_read(param->subImageName,true);
if(flag->mulImageFlag) image2 = nifti_image_read(param->mulImageName,true);
......
......@@ -62,23 +62,58 @@ void reg_mat44_disp(mat44 *mat, char * title)
/* *************************************************************** */
/* *************************************************************** */
template <class FieldTYPE>
void reg_affine_positionField1(mat44 *affineTransformation,
nifti_image *targetImage,
nifti_image *positionFieldImage)
void reg_affine_positionField2D(mat44 *affineTransformation,
nifti_image *targetImage,
nifti_image *positionFieldImage)
{
FieldTYPE *positionFieldPtr = static_cast<FieldTYPE *>(positionFieldImage->data);
unsigned int positionFieldXIndex=0;
unsigned int positionFieldYIndex=targetImage->nvox;
unsigned int positionFieldZIndex=2*targetImage->nvox;
mat44 *targetMatrix;
if(targetImage->sform_code>0){
targetMatrix=&(targetImage->sto_xyz);
}
else targetMatrix=&(targetImage->qto_xyz);
mat44 voxelToRealDeformed = reg_mat44_mul(affineTransformation, targetMatrix);
FieldTYPE *positionFieldPtr = static_cast<FieldTYPE *>(positionFieldImage->data);
unsigned int positionFieldXIndex=0;
unsigned int positionFieldYIndex=targetImage->nvox;
mat44 *targetMatrix;
if(targetImage->sform_code>0){
targetMatrix=&(targetImage->sto_xyz);
}
else targetMatrix=&(targetImage->qto_xyz);
mat44 voxelToRealDeformed = reg_mat44_mul(affineTransformation, targetMatrix);
float index[3];
float position[3];
index[2]=0;
for(int y=0; y<targetImage->ny; y++){
index[1]=(float)y;
for(int x=0; x<targetImage->nx; x++){
index[0]=(float)x;
reg_mat44_mul(&voxelToRealDeformed, index, position);
/* the deformation field (real coordinates) is stored */
positionFieldPtr[positionFieldXIndex++] = position[0];
positionFieldPtr[positionFieldYIndex++] = position[1];
}
}
}
/* *************************************************************** */
template <class FieldTYPE>
void reg_affine_positionField3D(mat44 *affineTransformation,
nifti_image *targetImage,
nifti_image *positionFieldImage)
{
FieldTYPE *positionFieldPtr = static_cast<FieldTYPE *>(positionFieldImage->data);
unsigned int positionFieldXIndex=0;
unsigned int positionFieldYIndex=targetImage->nvox;
unsigned int positionFieldZIndex=2*targetImage->nvox;
mat44 *targetMatrix;
if(targetImage->sform_code>0){
targetMatrix=&(targetImage->sto_xyz);
}
else targetMatrix=&(targetImage->qto_xyz);
mat44 voxelToRealDeformed = reg_mat44_mul(affineTransformation, targetMatrix);
float index[3];
float position[3];
......@@ -94,29 +129,42 @@ void reg_affine_positionField1(mat44 *affineTransformation,
/* the deformation field (real coordinates) is stored */
positionFieldPtr[positionFieldXIndex++] = position[0];
positionFieldPtr[positionFieldYIndex++] = position[1];
if(targetImage->nz>1)
positionFieldPtr[positionFieldZIndex++] = position[2];
positionFieldPtr[positionFieldZIndex++] = position[2];
}
}
}
}
/* *************************************************************** */
void reg_affine_positionField(mat44 *affineTransformation,
nifti_image *targetImage,
nifti_image *positionFieldImage)
{
switch(positionFieldImage->datatype){
case NIFTI_TYPE_FLOAT32:
reg_affine_positionField1<float>(affineTransformation, targetImage, positionFieldImage);
break;
case NIFTI_TYPE_FLOAT64:
reg_affine_positionField1<double>(affineTransformation, targetImage, positionFieldImage);
break;
default:
printf("err\treg_affine_positionField\tThe deformation field data type is not supported\n");
return;
}
if(targetImage->nz==1){
switch(positionFieldImage->datatype){
case NIFTI_TYPE_FLOAT32:
reg_affine_positionField2D<float>(affineTransformation, targetImage, positionFieldImage);
break;
case NIFTI_TYPE_FLOAT64:
reg_affine_positionField2D<double>(affineTransformation, targetImage, positionFieldImage);
break;
default:
printf("err\treg_affine_positionField\tThe deformation field data type is not supported\n");
return;
}
}
else{
switch(positionFieldImage->datatype){
case NIFTI_TYPE_FLOAT32:
reg_affine_positionField3D<float>(affineTransformation, targetImage, positionFieldImage);
break;
case NIFTI_TYPE_FLOAT64:
reg_affine_positionField3D<double>(affineTransformation, targetImage, positionFieldImage);
break;
default:
printf("err\treg_affine_positionField\tThe deformation field data type is not supported\n");
return;
}
}
}
/* *************************************************************** */
/* *************************************************************** */
......
This diff is collapsed.
......@@ -20,6 +20,7 @@
#define MAX_ITERATIONS 20
#define BLOCK_WIDTH 4
#define BLOCK_2D_SIZE 16
#define BLOCK_SIZE 64
#define OVERLAP_SIZE 3
#define STEP_SIZE 1
......
......@@ -1300,10 +1300,10 @@ double reg_tools_getMeanRMS2(nifti_image *imageA, nifti_image *imageB)
{
ATYPE *imageAPtrX = static_cast<ATYPE *>(imageA->data);
BTYPE *imageBPtrX = static_cast<BTYPE *>(imageB->data);
ATYPE *imageAPtrY;
BTYPE *imageBPtrY;
ATYPE *imageAPtrZ;
BTYPE *imageBPtrZ;
ATYPE *imageAPtrY=NULL;
BTYPE *imageBPtrY=NULL;
ATYPE *imageAPtrZ=NULL;
BTYPE *imageBPtrZ=NULL;
if(imageA->dim[5]>1){
imageAPtrY = &imageAPtrX[imageA->nx*imageA->ny*imageA->nz];
imageBPtrY = &imageBPtrX[imageA->nx*imageA->ny*imageA->nz];
......
......@@ -37,7 +37,8 @@ void reg_affine_positionField_gpu( mat44 *affineMatrix,
mat44 transformationMatrix = reg_mat44_mul(affineMatrix, targetMatrix);
// The transformation matrix is binded to a texture
float4 *transformationMatrix_h;CUDA_SAFE_CALL(cudaMallocHost((void **)&transformationMatrix_h, 3*sizeof(float4)));
float4 *transformationMatrix_h;
CUDA_SAFE_CALL(cudaMallocHost((void **)&transformationMatrix_h, 3*sizeof(float4)));
float4 *transformationMatrix_d;
CUDA_SAFE_CALL(cudaMalloc((void **)&transformationMatrix_d, 3*sizeof(float4)));
for(int i=0; i<3; i++){
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment