Commit 19ee5a31 authored by Marc Modat's avatar Marc Modat

(1) I inserted an error in the 3D composition function in a previous commit...

(1) I inserted an error in the 3D composition function in a previous commit when adding the WIN32 flag for openmp
parent d65b765e
......@@ -93,16 +93,16 @@ void reg_f3d2<T>::GetDeformationField()
// By default the number of steps is automatically updated
bool updateStepNumber=true;
// The provided step number is used for the final resampling
if(this->optimiser==false)
if(this->optimiser==NULL)
updateStepNumber=false;
#ifndef NDEBUG
printf("[NiftyReg DEBUG] Velocity integration forward. Step number update=%i\n",updateStepNumber);
#endif
// The forward transformation is computed using the scaling-and-squaring approach
reg_spline_getDefFieldFromVelocityGrid(this->controlPointGrid,
this->deformationFieldImage,
updateStepNumber
);
this->deformationFieldImage,
updateStepNumber
);
#ifndef NDEBUG
printf("[NiftyReg DEBUG] Velocity integration backward. Step number update=%i\n",updateStepNumber);
#endif
......@@ -110,9 +110,9 @@ void reg_f3d2<T>::GetDeformationField()
this->backwardControlPointGrid->intent_p2=this->controlPointGrid->intent_p2;
// The backward transformation is computed using the scaling-and-squaring approach
reg_spline_getDefFieldFromVelocityGrid(this->backwardControlPointGrid,
this->backwardDeformationFieldImage,
false
);
this->backwardDeformationFieldImage,
false
);
return;
}
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
......@@ -145,8 +145,7 @@ void reg_f3d2<T>::GetVoxelBasedGradient()
reg_f3d_sym<T>::GetVoxelBasedGradient();
// Exponentiate the gradients if required
if(this->useGradientCumulativeExp)
this->ExponentiateGradient();
this->ExponentiateGradient();
}
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
......@@ -254,6 +253,7 @@ void reg_f3d2<T>::ExponentiateGradient()
this->backwardVoxelBasedMeasureGradientImage, // out
powf(2.f,fabsf(this->controlPointGrid->intent_p2))); // value
return;
}
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
......@@ -296,6 +296,7 @@ void reg_f3d2<T>::UpdateParameters(float scale)
// Clean the temporary nifti_images
nifti_image_free(forwardScaledGradient);
forwardScaledGradient=NULL;
/************************/
/**** Backward update ***/
/************************/
......
......@@ -902,11 +902,9 @@ void reg_f3d_sym<T>::GetSimilarityMeasureGradient()
false, // no update
&reorientation // voxel to mm conversion
);
return;
#ifndef NDEBUG
reg_print_fct_debug("reg_f3d_sym<T>::GetSimilarityMeasureGradient");
#endif
return;
}
/* \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ */
......
......@@ -2565,10 +2565,12 @@ void reg_defField_compose3D(nifti_image *deformationField,
const size_t DFVoxelNumber=(size_t)DefFieldDim[0]*DefFieldDim[1]*DefFieldDim[2];
#ifdef _WIN32
long i;
long warVoxelNumber=(size_t)dfToUpdate->nx*dfToUpdate->ny;
long warVoxelNumber=(size_t)dfToUpdate->nx*
dfToUpdate->ny*dfToUpdate->nz;
#else
size_t i;
size_t warVoxelNumber=(size_t)dfToUpdate->nx*dfToUpdate->ny;
size_t warVoxelNumber=(size_t)dfToUpdate->nx*
dfToUpdate->ny*dfToUpdate->nz;
#endif
DTYPE *defPtrX = static_cast<DTYPE *>(deformationField->data);
......
......@@ -531,22 +531,25 @@ double reg_nmi::GetSimilarityMeasureValue()
}
}
double nmi_value=0.;
double nmi_value_forward=0.;
double nmi_value_backward=0.;
for(int t=0; t<this->referenceTimePoint; ++t)
{
if(this->activeTimePoint[t])
{
nmi_value += (this->forwardEntropyValues[t][0] + this->forwardEntropyValues[t][1] ) /
this->forwardEntropyValues[t][2];
nmi_value_forward += (this->forwardEntropyValues[t][0] +
this->forwardEntropyValues[t][1] ) /
this->forwardEntropyValues[t][2];
if(this->isSymmetric)
nmi_value += (this->backwardEntropyValues[t][0] + this->backwardEntropyValues[t][1] ) /
this->backwardEntropyValues[t][2];
nmi_value_backward += (this->backwardEntropyValues[t][0] +
this->backwardEntropyValues[t][1] ) /
this->backwardEntropyValues[t][2];
}
}
#ifndef NDEBUG
printf("[NiftyReg DEBUG] reg_nmi::GetSimilarityMeasureValue called\n");
#endif
return nmi_value;
return nmi_value_forward+nmi_value_backward;
}
/* *************************************************************** */
template <class DTYPE>
......
......@@ -1038,6 +1038,11 @@ void reg_tools_kernelConvolution_core(nifti_image *image,
bool *timePoint,
bool *axis)
{
if(image->nx>2048 || image->ny>2048 || image->nz>2048){
reg_print_fct_error("reg_tools_kernelConvolution_core");
reg_print_msg_error("This function does not support images with dimension > 2048");
reg_exit(1);
}
#ifdef WIN32
long index;
long voxelNumber = (long)image->nx*image->ny*image->nz;
......@@ -1098,7 +1103,7 @@ void reg_tools_kernelConvolution_core(nifti_image *image,
if(radius>0)
{
// Allocate the kernel
float kernel[2024];
float kernel[2048];
double kernelSum=0;
// Fill the kernel
if(kernelType==1)
......
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