Commit baa6adec authored by Pankaj Daga's avatar Pankaj Daga

Get rid of some annoying warning messages during windows compilation.

parent 5672414f
......@@ -212,11 +212,11 @@ int main(int argc, char **argv)
flag->level2PerformFlag=1;
}
else if(strcmp(argv[i], "-smooT") == 0){
param->targetSigmaValue=atof(argv[++i]);
param->targetSigmaValue=(float)(atof(argv[++i]));
flag->targetSigmaFlag=1;
}
else if(strcmp(argv[i], "-smooS") == 0){
param->sourceSigmaValue=atof(argv[++i]);
param->sourceSigmaValue=(float)(atof(argv[++i]));
flag->sourceSigmaFlag=1;
}
else if(strcmp(argv[i], "-rigOnly") == 0){
......@@ -434,7 +434,7 @@ int main(int argc, char **argv)
index[2] /= 2;
}
}
param->sourceBGValue = reg_tool_GetIntensityValue(sourceImage, index);
param->sourceBGValue = (float)(reg_tool_GetIntensityValue(sourceImage, index));
}
else param->sourceBGValue = 0;
......@@ -729,8 +729,8 @@ int main(int argc, char **argv)
free(param);
time_t end; time(&end);
int minutes=(int)floorf((end-start)/60.0);
int seconds=end-start - 60*minutes;
int minutes=(int)floorf((end-start)/60.0f);
int seconds=(int)(end-start - 60*minutes);
printf("Registration Performed in %i min %i sec\n", minutes, seconds);
printf("Have a good day !\n");
......
......@@ -211,15 +211,15 @@ int main(int argc, char **argv)
flag->maxIterationFlag=1;
}
else if(strcmp(argv[i], "-sx") == 0){
param->spacing[0]=atof(argv[++i]);
param->spacing[0]=(float)(atof(argv[++i]));
flag->spacingFlag[0]=1;
}
else if(strcmp(argv[i], "-sy") == 0){
param->spacing[1]=atof(argv[++i]);
param->spacing[1]=(float)(atof(argv[++i]));
flag->spacingFlag[1]=1;
}
else if(strcmp(argv[i], "-sz") == 0){
param->spacing[2]=atof(argv[++i]);
param->spacing[2]=(float)(atof(argv[++i]));
flag->spacingFlag[2]=1;
}
else if(strcmp(argv[i], "-bin") == 0){
......@@ -234,7 +234,7 @@ int main(int argc, char **argv)
flag->pyramidFlag=0;
}
else if(strcmp(argv[i], "-be") == 0){
param->bendingEnergyWeight=atof(argv[++i]);
param->bendingEnergyWeight=(float)(atof(argv[++i]));
}
else if(strcmp(argv[i], "-appBE") == 0){
flag->appBendingEnergyFlag=0;
......@@ -243,7 +243,7 @@ int main(int argc, char **argv)
flag->beGradFlag=0;
}
else if(strcmp(argv[i], "-jl") == 0){
param->jacobianWeight=atof(argv[++i]);
param->jacobianWeight=(float)(atof(argv[++i]));
flag->jacobianWeightFlag=1;
}
else if(strcmp(argv[i], "-appJL") == 0){
......@@ -259,11 +259,11 @@ int main(int argc, char **argv)
flag->noConjugateGradient=1;
}
else if(strcmp(argv[i], "-smooT") == 0){
param->targetSigmaValue=atof(argv[++i]);
param->targetSigmaValue=(float)(atof(argv[++i]));
flag->targetSigmaFlag=1;
}
else if(strcmp(argv[i], "-smooS") == 0){
param->sourceSigmaValue=atof(argv[++i]);
param->sourceSigmaValue=(float)(atof(argv[++i]));
flag->sourceSigmaFlag=1;
}
else if(strcmp(argv[i], "-mpad") == 0){
......@@ -664,8 +664,8 @@ int main(int argc, char **argv)
float smallestSize = maxStepSize / 100.0f;
/* the target and source are resampled between 0 and bin-1 */
reg_intensityRescale(targetImage,0.0f,(float)param->binning-1.0);
reg_intensityRescale(sourceImage,0.0f,(float)param->binning-1.0);
reg_intensityRescale(targetImage,0.0f,(float)param->binning-1.0f);
reg_intensityRescale(sourceImage,0.0f,(float)param->binning-1.0f);
if(flag->backgroundIndexFlag){
int index[3];
......@@ -679,7 +679,7 @@ int main(int argc, char **argv)
index[2] /= 2;
}
}
param->sourceBGValue = reg_tool_GetIntensityValue(sourceImage, index);
param->sourceBGValue = (float)(reg_tool_GetIntensityValue(sourceImage, index));
}
/* the gradient images are allocated */
......@@ -1039,9 +1039,9 @@ int main(int argc, char **argv)
conjGPtrX[i] = - gradientValuesX[i];
conjGPtrY[i] = - gradientValuesY[i];
conjGPtrZ[i] = - gradientValuesZ[i];
conjHPtrX[i] = conjGPtrX[i] + gam * conjHPtrX[i];
conjHPtrY[i] = conjGPtrY[i] + gam * conjHPtrY[i];
conjHPtrZ[i] = conjGPtrZ[i] + gam * conjHPtrZ[i];
conjHPtrX[i] = (float)(conjGPtrX[i] + gam * conjHPtrX[i]);
conjHPtrY[i] = (float)(conjGPtrY[i] + gam * conjHPtrY[i]);
conjHPtrZ[i] = (float)(conjGPtrZ[i] + gam * conjHPtrZ[i]);
gradientValuesX[i] = - conjHPtrX[i];
gradientValuesY[i] = - conjHPtrY[i];
gradientValuesZ[i] = - conjHPtrZ[i];
......@@ -1208,7 +1208,7 @@ int main(int argc, char **argv)
bestWBE = currentWBE;
bestWJac = currentWJac;
addedStep += currentSize;
currentSize*=1.1;
currentSize*=1.1f;
currentSize = (currentSize<maxStepSize)?currentSize:maxStepSize;
}
else{
......@@ -1336,8 +1336,8 @@ int main(int argc, char **argv)
free( param );
time_t end; time( &end );
int minutes = (int)floorf( (end-start)/60 );
int seconds = end-start - 60*minutes;
int minutes = (int)floorf(float(end-start)/60.0f);
int seconds = (int)(end-start - 60*minutes);
printf("Registration Performed in %i min %i sec\n", minutes, seconds);
printf("Have a good day !\n");
......
......@@ -83,11 +83,11 @@ void reg_affine_positionField1(mat44 *affineTransformation,
float index[3];
float position[3];
for(int z=0; z<targetImage->nz; z++){
index[2]=z;
index[2]=(float)z;
for(int y=0; y<targetImage->ny; y++){
index[1]=y;
index[1]=(float)y;
for(int x=0; x<targetImage->nx; x++){
index[0]=x;
index[0]=(float)x;
reg_mat44_mul(&voxelToRealDeformed, index, position);
......
......@@ -91,7 +91,7 @@ void _reg_set_active_blocks(nifti_image *targetImage, _reg_blockMatchingParam *p
if(x<targetImage->nx){
DTYPE value = *targetPtrXYZ;
if(value!=0.0){
mean += value;
mean += (float)value;
voxelNumber++;
}
}
......@@ -115,7 +115,7 @@ void _reg_set_active_blocks(nifti_image *targetImage, _reg_blockMatchingParam *p
if(x<targetImage->nx){
DTYPE value = *targetPtrXYZ;
if(value!=0.0)
variance += (mean - *targetPtrXYZ)*(mean - *targetPtrXYZ);
variance += (mean - (float)(*targetPtrXYZ))*(mean - float(*targetPtrXYZ));
}
targetPtrXYZ++;
}
......@@ -332,8 +332,8 @@ void real_block_matching_method(nifti_image * target,
for(int a=0; a<BLOCK_SIZE; a++){
if(targetOverlap[a] && resultOverlap[a]){
PrecisionTYPE targetTemp=targetValues[a]-targetMean;
PrecisionTYPE resultTemp=resultValues[a]-resultMean;
PrecisionTYPE targetTemp=(PrecisionTYPE)(targetValues[a]-targetMean);
PrecisionTYPE resultTemp=(PrecisionTYPE)(resultValues[a]-resultMean);
targetVar += (targetTemp)*(targetTemp);
resultVar += (resultTemp)*(resultTemp);
localCC += (targetTemp)*(resultTemp);
......@@ -346,9 +346,9 @@ void real_block_matching_method(nifti_image * target,
if(localCC>bestCC){
bestCC=localCC;
bestDisplacement[0] = l;
bestDisplacement[1] = m;
bestDisplacement[2] = n;
bestDisplacement[0] = (float)l;
bestDisplacement[1] = (float)m;
bestDisplacement[2] = (float)n;
}
}
}
......@@ -356,9 +356,9 @@ void real_block_matching_method(nifti_image * target,
}
float targetPosition_temp[3];
targetPosition_temp[0] = i*BLOCK_WIDTH;
targetPosition_temp[1] = j*BLOCK_WIDTH;
targetPosition_temp[2] = k*BLOCK_WIDTH;
targetPosition_temp[0] = (float)(i*BLOCK_WIDTH);
targetPosition_temp[1] = (float)(j*BLOCK_WIDTH);
targetPosition_temp[2] = (float)(k*BLOCK_WIDTH);
bestDisplacement[0] += targetPosition_temp[0];
bestDisplacement[1] += targetPosition_temp[1];
......@@ -1114,8 +1114,8 @@ float pythag(float a, float b)
absa = fabs(a);
absb = fabs(b);
if (absa > absb) return absa * sqrt(1.0f+SQR(absb/absa));
else return (absb == 0.0f ? 0.0f : absb * sqrt(1.0f+SQR(absa/absb)));
if (absa > absb) return (float)(absa * sqrt(1.0f+SQR(absb/absa)));
else return (absb == 0.0f ? 0.0f : (float)(absb * sqrt(1.0f+SQR(absa/absb))));
}
void svd(float ** in, int m, int n, float * w, float ** v)
......@@ -1301,7 +1301,7 @@ void svd(float ** in, int m, int n, float * w, float ** v)
g = rv1[nm-1];
h = rv1[k-1];
f = ((y-z)*(y+z)+(g-h)*(g+h))/(2.0*h*y);
f = ((y-z)*(y+z)+(g-h)*(g+h))/(2.0f*h*y);
g = pythag(f, 1.0f);
f = ((x-z)*(x+z)+h*((y/(f+SIGN(g,f)))-h))/x;
c = s = 1.0f;
......
This diff is collapsed.
......@@ -22,7 +22,7 @@ PrecisionTYPE GetBasisSplineValue(PrecisionTYPE x)
PrecisionTYPE value=0.0;
if(x<2.0)
if(x<1.0)
value = 2.0f/3.0f + (0.5f*x-1.0)*x*x;
value = (PrecisionTYPE)(2.0f/3.0f + (0.5f*x-1.0)*x*x);
else{
x-=2.0f;
value = -x*x*x/6.0f;
......@@ -37,7 +37,7 @@ PrecisionTYPE GetBasisSplineDerivativeValue(PrecisionTYPE ori)
PrecisionTYPE value=0.0;
if(x<2.0)
if(x<1.0)
value = (1.5f*x-2.0)*ori;
value = (PrecisionTYPE)((1.5f*x-2.0)*ori);
else{
x-=2.0f;
value = -0.5f * x * x;
......@@ -96,8 +96,8 @@ void reg_getEntropies3( nifti_image *targetImage,
for(unsigned int index=0; index<targetImage->nvox; index++){
TargetTYPE targetInt = *targetPtr++;
ResultTYPE resultInt = *resultPtr++;
if(targetInt>(TargetTYPE)0 && targetInt<(TargetTYPE) binning && resultInt>(ResultTYPE)0 && resultInt<(ResultTYPE)binning){
probaJointHistogram[(unsigned int)((floorf(targetInt) * binning + floorf(resultInt)))]++;
if(targetInt>(TargetTYPE)(0) && targetInt<(TargetTYPE)(binning) && resultInt>(ResultTYPE)(0) && resultInt<(ResultTYPE)(binning)){
probaJointHistogram[(unsigned int)((floorf((float)targetInt) * binning + floorf((float)resultInt)))]++;
voxelNumber++;
}
}
......@@ -131,7 +131,7 @@ void reg_getEntropies3( nifti_image *targetImage,
TargetTYPE targetInt = *targetPtr++;
ResultTYPE resultInt = *resultPtr++;
if((float)targetInt>=0 && targetInt<(TargetTYPE) binning && (float)resultInt>=0 && resultInt<(ResultTYPE)binning){
probaJointHistogram[(unsigned int)(floorf(targetInt) * binning + floorf(resultInt))]++;
probaJointHistogram[(unsigned int)(floorf((float)targetInt) * binning + floorf((float)resultInt))]++;
voxelNumber++;
}
}
......@@ -140,14 +140,14 @@ void reg_getEntropies3( nifti_image *targetImage,
if(type==2){ // parzen windows approximation by smoothing the classical approach
// the logJointHistogram array is used as a temporary array
PrecisionTYPE window[3];
window[0]=window[2]=GetBasisSplineValue(-1.0);
window[1]=GetBasisSplineValue(0.0);
window[0]=window[2]=GetBasisSplineValue((PrecisionTYPE)(-1.0));
window[1]=GetBasisSplineValue((PrecisionTYPE)(0.0));
//The joint histogram is smoothed along the target axis
for(int s=0; s<binning; s++){
for(int t=0; t<binning; t++){
PrecisionTYPE value=0.0;
PrecisionTYPE value=(PrecisionTYPE)(0.0);
targetIndex = t-1;
PrecisionTYPE *ptrHisto = &probaJointHistogram[targetIndex*binning+s];
......@@ -368,9 +368,9 @@ void reg_getVoxelBasedNMIGradientUsingPW4( nifti_image *targetImage,
if(targetValue && resultValue){
PrecisionTYPE resDeriv[3];
resDeriv[0] = *resultGradientPtrX / entropies[3];
resDeriv[1] = *resultGradientPtrY / entropies[3];
resDeriv[2] = *resultGradientPtrZ / entropies[3];
resDeriv[0] = (PrecisionTYPE)(*resultGradientPtrX / entropies[3]);
resDeriv[1] = (PrecisionTYPE)(*resultGradientPtrY / entropies[3]);
resDeriv[2] = (PrecisionTYPE)(*resultGradientPtrZ / entropies[3]);
PrecisionTYPE jointEntropyDerivative_X = 0.0;
PrecisionTYPE movingEntropyDerivative_X = 0.0;
......@@ -440,9 +440,9 @@ void reg_getVoxelBasedNMIGradientUsingPW4( nifti_image *targetImage,
ResultTYPE resultValue = *resultPtr++;
PrecisionTYPE resDeriv[3];
resDeriv[0] = *resultGradientPtrX / entropies[3];
resDeriv[1] = *resultGradientPtrY / entropies[3];
resDeriv[2] = *resultGradientPtrZ / entropies[3];
resDeriv[0] = (PrecisionTYPE)(*resultGradientPtrX / entropies[3]);
resDeriv[1] = (PrecisionTYPE)(*resultGradientPtrY / entropies[3]);
resDeriv[2] = (PrecisionTYPE)(*resultGradientPtrZ / entropies[3]);
PrecisionTYPE jointEntropyDerivative_X = 0.0;
PrecisionTYPE movingEntropyDerivative_X = 0.0;
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ PrecisionTYPE reg_getSSD2( nifti_image *targetImage,
TargetTYPE targetValue = *targetPtr++;
ResultTYPE resultValue = *resultPtr++;
if(targetValue!=0 && resultValue!=0){
SSD += (targetValue-resultValue)*(targetValue-resultValue);
SSD += (PrecisionTYPE)((targetValue-resultValue)*(targetValue-resultValue));
}
}
return SSD;
......@@ -135,10 +135,10 @@ void reg_getVoxelBasedSSDGradient4( nifti_image *targetImage,
PrecisionTYPE gradY=0;
PrecisionTYPE gradZ=0;
if(targetValue!=0 && resultValue!=0){
PrecisionTYPE common = - 2.0 * (targetValue - resultValue);
gradX = common * (*spatialGradPtrX);
gradY = common * (*spatialGradPtrY);
if(targetImage->nz>1) gradZ = common * (*spatialGradPtrZ);
PrecisionTYPE common = (PrecisionTYPE)(- 2.0 * (targetValue - resultValue));
gradX = (PrecisionTYPE)(common * (*spatialGradPtrX));
gradY = (PrecisionTYPE)(common * (*spatialGradPtrY));
if(targetImage->nz>1) gradZ = (PrecisionTYPE)(common * (*spatialGradPtrZ));
}
spatialGradPtrX++;
spatialGradPtrY++;
......
......@@ -136,9 +136,9 @@ void reg_smoothImageForCubicSpline1( nifti_image *image,
PrecisionTYPE *window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
//PrecisionTYPE coeffSum=0.0;
for(int it=-radius[0]; it<=radius[0]; it++){
PrecisionTYPE coeff = fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[0]);
if(coeff<1.0) window[it+radius[0]] = 2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff;
else window[it+radius[0]] = -(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0;
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[0]));
if(coeff<1.0) window[it+radius[0]] = (PrecisionTYPE)(2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff);
else window[it+radius[0]] = (PrecisionTYPE)(-(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0);
//coeffSum += window[it+radius[0]];
}
// for(int it=0;it<windowSize;it++){
......@@ -185,9 +185,9 @@ void reg_smoothImageForCubicSpline1( nifti_image *image,
window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
//coeffSum=0.0;
for(int it=-radius[1]; it<=radius[1]; it++){
PrecisionTYPE coeff = fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[1]);
if(coeff<1.0) window[it+radius[1]] = 2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff;
else window[it+radius[1]] = -(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0;
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[1]));
if(coeff<1.0) window[it+radius[1]] = (PrecisionTYPE)(2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff);
else window[it+radius[1]] = (PrecisionTYPE)(-(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0);
//coeffSum += window[it+radius[1]];
}
//for(int it=0;it<windowSize;it++)window[it] /= coeffSum;
......@@ -230,9 +230,9 @@ void reg_smoothImageForCubicSpline1( nifti_image *image,
window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
//coeffSum=0.0;
for(int it=-radius[2]; it<=radius[2]; it++){
PrecisionTYPE coeff = fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[2]);
if(coeff<1.0) window[it+radius[2]] = 2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff;
else window[it+radius[2]] = -(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0;
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(2.0*(PrecisionTYPE)it/(PrecisionTYPE)radius[2]));
if(coeff<1.0) window[it+radius[2]] = (PrecisionTYPE)(2.0/3.0 - coeff*coeff + 0.5*coeff*coeff*coeff);
else window[it+radius[2]] = (PrecisionTYPE)(-(coeff-2.0)*(coeff-2.0)*(coeff-2.0)/6.0);
//coeffSum += window[it+radius[2]];
}
//for(int it=0;it<windowSize;it++)window[it] /= coeffSum;
......@@ -333,7 +333,7 @@ void reg_smoothImageForTrilinear1( nifti_image *image,
PrecisionTYPE *window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
PrecisionTYPE coeffSum=0.0;
for(int it=-radius[0]; it<=radius[0]; it++){
PrecisionTYPE coeff = fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] ));
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] )));
window[it+radius[0]] = coeff;
coeffSum += coeff;
}
......@@ -381,7 +381,7 @@ window[it] /= coeffSum;
window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
coeffSum=0.0;
for(int it=-radius[1]; it<=radius[1]; it++){
PrecisionTYPE coeff = fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] ));
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] )));
window[it+radius[1]] = coeff;
coeffSum += coeff;
}
......@@ -425,7 +425,7 @@ for(int it=0;it<windowSize;it++)window[it] /= coeffSum;
window = (PrecisionTYPE *)calloc(windowSize,sizeof(PrecisionTYPE));
coeffSum=0.0;
for(int it=-radius[2]; it<=radius[2]; it++){
PrecisionTYPE coeff = fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] ));
PrecisionTYPE coeff = (PrecisionTYPE)(fabs(1.0 -fabs((PrecisionTYPE)(it)/(PrecisionTYPE)radius[0] )));
window[it+radius[2]] = coeff;
coeffSum += coeff;
}
......@@ -516,10 +516,10 @@ PrecisionTYPE reg_getMaximalLength1(nifti_image *image)
PrecisionTYPE max=0.0;
for(int i=0; i<image->nx*image->ny*image->nz; i++){
PrecisionTYPE valX = *dataPtrX++;
PrecisionTYPE valY = *dataPtrY++;
PrecisionTYPE valZ = *dataPtrZ++;
PrecisionTYPE length = sqrt(valX*valX + valY*valY + valZ*valZ);
PrecisionTYPE valX = (PrecisionTYPE)(*dataPtrX++);
PrecisionTYPE valY = (PrecisionTYPE)(*dataPtrY++);
PrecisionTYPE valZ = (PrecisionTYPE)(*dataPtrZ++);
PrecisionTYPE length = (PrecisionTYPE)(sqrt(valX*valX + valY*valY + valZ*valZ));
max = (length>max)?length:max;
}
return max;
......@@ -768,9 +768,9 @@ void reg_gaussianSmoothing1( nifti_image *image,
int radius=(int)ceil(currentSigma*3.0f);
PrecisionTYPE *kernel = new PrecisionTYPE[2*radius+1];
PrecisionTYPE kernelSum=0;
for(float i=-radius; i<=radius; i++){
kernel[radius+(int)i]=exp( -(i*i)/(2.0*currentSigma*currentSigma)) / (currentSigma*2.506628274631); // 2.506... = sqrt(2*pi)
kernelSum += kernel[radius+(int)i];
for(int i=-radius; i<=radius; i++){
kernel[radius+i]=(PrecisionTYPE)(exp( -(i*i)/(2.0*currentSigma*currentSigma)) / (currentSigma*2.506628274631)); // 2.506... = sqrt(2*pi)
kernelSum += kernel[radius+i];
}
for(int i=-radius; i<=radius; i++) kernel[radius+i] /= kernelSum;
#ifdef _DEBUG
......@@ -793,7 +793,7 @@ void reg_gaussianSmoothing1( nifti_image *image,
PrecisionTYPE value=0;
for(int j=-radius; j<=radius; j++){
if(-1<current && current<(int)image->nvox){
value += imagePtr[current]*kernel[j+radius];
value += (PrecisionTYPE)(imagePtr[current]*kernel[j+radius]);
}
current += increment;
}
......@@ -850,7 +850,7 @@ template <class PrecisionTYPE, class ImageTYPE>
void reg_downsampleImage1(nifti_image *image)
{
/* the input image is first smooth */
reg_gaussianSmoothing<float>(image, -0.7);
reg_gaussianSmoothing<float>(image, -0.7f);
/* the values are copied */
ImageTYPE *oldValues = (ImageTYPE *)malloc(image->nvox * image->nbyper);
......@@ -862,7 +862,7 @@ void reg_downsampleImage1(nifti_image *image)
for(int i=1; i<4; i++){
oldDim[i]=image->dim[i];
if(image->dim[i]>1) image->dim[i]=(int)(image->dim[i]/2.0);
if(image->pixdim[i]>0) image->pixdim[i]=image->pixdim[i]*2.0;
if(image->pixdim[i]>0) image->pixdim[i]=image->pixdim[i]*2.0f;
}
image->nx=image->dim[1];
image->ny=image->dim[2];
......@@ -878,8 +878,8 @@ void reg_downsampleImage1(nifti_image *image)
for(int i=0; i<3; i++){
for(int j=0; j<3; j++){
oldMat.m[i][j]=image->qto_ijk.m[i][j];
image->qto_xyz.m[i][j]=image->qto_xyz.m[i][j]*2.0;
image->sto_xyz.m[i][j]=image->sto_xyz.m[i][j]*2.0;
image->qto_xyz.m[i][j]=image->qto_xyz.m[i][j]*2.0f;
image->sto_xyz.m[i][j]=image->sto_xyz.m[i][j]*2.0f;
}
}
oldMat.m[0][3]=image->qto_ijk.m[0][3];
......@@ -917,17 +917,17 @@ void reg_downsampleImage1(nifti_image *image)
// basis values along the x axis
relative=position[0]-(PrecisionTYPE)previous[0];
if(relative<0) relative=0.0; // rounding error correction
xBasis[0]= 1.0-relative;
xBasis[0]= (PrecisionTYPE)(1.0-relative);
xBasis[1]= relative;
// basis values along the y axis
relative=position[1]-(PrecisionTYPE)previous[1];
if(relative<0) relative=0.0; // rounding error correction
yBasis[0]= 1.0-relative;
yBasis[0]= (PrecisionTYPE)(1.0-relative);
yBasis[1]= relative;
// basis values along the z axis
relative=position[2]-(PrecisionTYPE)previous[2];
if(relative<0) relative=0.0; // rounding error correction
zBasis[0]= 1.0-relative;
zBasis[0]= (PrecisionTYPE)(1.0-relative);
zBasis[1]= relative;
intensity=0;
for(short c=0; c<2; c++){
......@@ -944,7 +944,7 @@ void reg_downsampleImage1(nifti_image *image)
for(short a=0; a<2; a++){
if(-1<(previous[0]+a) && (previous[0]+a)<oldDim[1]){
const ImageTYPE coeff = *xyzPointer;
xTempNewValue += coeff * xBasis[a];
xTempNewValue += (PrecisionTYPE)(coeff * xBasis[a]);
}
xyzPointer++;
}
......
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