[MINC-development] mincresample using ftol based on the input file stepsizes

Matthijs Van Eede matthijs at mouseimaging.ca
Tue Jun 11 15:59:00 EDT 2013


Greetings!

I was going through my todo list, and saw that there was an issue I wanted to address for a long time which I should really tackle properly. When using mincresample, the error tolerance for determining where a voxel comes from (ftol) is based on the step sizes of the deformation grid used for the resampling. Especially when using animal data, there can be a big difference between that step size and the step size of the actual input file, potentially causing resampling inaccuracies. A possible solution to this is to artificially change the stepsize of the input data (which I remember Andrew saying at some point), but as Jason mentioned, it would be nice to have "normal" sized mouse brains even on the southern hemisphere :-) 

In order to do this, mincresample needs to pass along the step size information of the input file being resampled. I've made changes to the libminc and minc-tools repositories from GitHub which I forked from BIC-MNI. For libminc, I worked on Vladimir's develop branch which is used for his minc-toolkit repository. I made changes to the following files:

libminc/volume_io/Include/volume_io/vol_io_prototypes.h
libminc/volume_io/MNI_formats/gen_xfs.c
libminc/volume_io/MNI_formats/grid_transforms.c

and

minc-tools/progs/mincresample/mincresample.c
minc-tools/progs/mincresample/mincresample.h
minc-tools/progs/mincresample/resample_volumes.c

Here are the specific changes:

https://github.com/mcvaneede/libminc/commit/784f6a01036c2c1d38924eea363e1aa7a0638673
https://github.com/mcvaneede/minc-tools/commit/89bcfe73b705ebc84d7442cec0cff78aa7217e15

Would it be possible to merge these changes back into the main branch at BIC-MNI?
Thanks in advance,
Matthijs

PS The way I addressed this issue overall, is to create two functions out of the original function that needed to pass along the input step size information as follows:

Original function:
VIOAPI VIO_Status grid_inverse_transform_point(
    VIO_General_transform *transform,
    VIO_Real x,
    VIO_Real y,
    VIO_Real z,
    VIO_Real *x_transformed,
    VIO_Real *y_transformed,
    VIO_Real *z_transformed )
{
...
...
}

And split it up into the two following (main):
VIOAPI VIO_Status grid_inverse_transform_point_with_input_steps(
    VIO_General_transform *transform,
    VIO_Real x,
    VIO_Real y,
    VIO_Real z,
    VIO_Real *input_volume_steps,
    VIO_Real *x_transformed,
    VIO_Real *y_transformed,
    VIO_Real *z_transformed )
{
...
...
}

and the now "dummy":

VIOAPI VIO_Status grid_inverse_transform_point(
    VIO_General_transform *transform,
    VIO_Real x,
    VIO_Real y,
    VIO_Real z,
    VIO_Real *x_transformed,
    VIO_Real *y_transformed,
    VIO_Real *z_transformed )
{
    return grid_inverse_transform_point_with_input_steps(transform, x, y, z,
                                           NULL,
                                           x_transformed, y_transformed, z_transformed );
}


More information about the MINC-development mailing list