Commit 81efdd29 authored by Marc Modat's avatar Marc Modat

Merge branch 'master' of ssh://git.code.sf.net/p/niftyreg/git

Conflicts:
	reg-lib/CMakeLists.txt
parents 13ac5c10 06f2a4f3
......@@ -205,6 +205,7 @@ int main(int argc, char **argv)
tempImage=NULL;
}
reg_tools_divideValueToImage(averageImage,averageImage,(float)imageTotalNumber);
reg_io_WriteImageFile(averageImage,outputName);
nifti_image_free(averageImage);
}
......@@ -519,6 +520,12 @@ int main(int argc, char **argv)
// Create the average image without demeaning
if(operation==2)
{
// Throw an error
if ( (argc-4) % 2 != 0)
{
reg_print_msg_error("An odd number of transformation/image pairs was provided.");
return EXIT_FAILURE;
}
// Create an average image
nifti_image *averageImage = nifti_copy_nim_info(referenceImage);
averageImage->nbyper=sizeof(float);
......@@ -527,6 +534,7 @@ int main(int argc, char **argv)
averageImage->scl_inter=0.f;
averageImage->data=(void *)calloc(averageImage->nvox,
averageImage->nbyper);
for(int i=4;i<argc;i+=2){
mat44 *inputTransformationMatrix=NULL;
nifti_image *inputTransformationImage=NULL;
......@@ -644,7 +652,7 @@ int main(int argc, char **argv)
nifti_image_free(floatingImage);
nifti_image_free(deformationField);
// Normalise the warped image intensity
average_norm_intensity<float>(warpedImage);
//average_norm_intensity<float>(warpedImage);
// Accumulate the warped image
reg_tools_addImageToImage(averageImage,warpedImage,averageImage);
nifti_image_free(warpedImage);
......
......@@ -97,7 +97,8 @@ void reg_dti_resampling_preprocessing(nifti_image *floatingImage,
#endif
for(floatingIndex=0; floatingIndex<floatingVoxelNumber; ++floatingIndex)
{
if(floatingIntensityXX[floatingIndex] > 1e-2)
// Check that the tensor component is not extremely small or extremely large
if((floatingIntensityXX[floatingIndex] > 1e-10) && (floatingIntensityXX[floatingIndex] < 1e10))
{
// Fill a mat44 with the tensor components
reg_mat44_eye(&diffTensor);
......@@ -123,11 +124,14 @@ void reg_dti_resampling_preprocessing(nifti_image *floatingImage,
floatingIntensityYZ[floatingIndex] = static_cast<DTYPE>(diffTensor.m[1][2]);
floatingIntensityZZ[floatingIndex] = static_cast<DTYPE>(diffTensor.m[2][2]);
}
else // if junk diffusion data, log it
else // if junk diffusion data, set the diagonal to log the minimum value
{
floatingIntensityXX[floatingIndex] = static_cast<DTYPE>(-4.606f);
floatingIntensityYY[floatingIndex] = static_cast<DTYPE>(-4.606f);
floatingIntensityZZ[floatingIndex] = static_cast<DTYPE>(-4.606f);
floatingIntensityXX[floatingIndex] = static_cast<DTYPE>(-23.02585f);
floatingIntensityYY[floatingIndex] = static_cast<DTYPE>(-23.02585f);
floatingIntensityZZ[floatingIndex] = static_cast<DTYPE>(-23.02585f);
floatingIntensityXY[floatingIndex] = static_cast<DTYPE>(0.0f);
floatingIntensityXZ[floatingIndex] = static_cast<DTYPE>(0.0f);
floatingIntensityYZ[floatingIndex] = static_cast<DTYPE>(0.0f);
}
}
#ifndef NDEBUG
......
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