From matthijs at phenogenomics.ca Tue Dec 21 13:50:55 2010 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Tue, 21 Dec 2010 13:50:55 -0500 Subject: [MINC-development] mincresample issue/bug at smaller voxel sizes using concatenated transforms Message-ID: <4D10F70F.1030504@phenogenomics.ca> Hi all, We recently ran into an interesting resampling issue using 60 micron data. We have a concatenated transform that uses a few non linear transformation grids, and created a equivalent transformation with a single transformation grid from it (using minc_displacement written by Jason). However, resampling using the concatenated transform gave a visually noticeable different result from resampling with the transform with a single non linear grid. In many places there was a discrepancy of about a voxel. Main note about all this is that (understandably) the more transforms are being concatenated, the larger the error in the resampling. Looking at the function grid_inverse_transform_point in grid_transforms.c, we found that there is a tolerance variable (ftol at line 254) set to 0.05 (defined in mm). Assuming that the default voxel size is 1mm, we adjusted the value of ftol to 0.06*0.05=0.003. This mostly eliminated the differences between resampling with concatenated/single transformation grids. Setting the value smaller still, removed any remaining differences. A fix for this problem would be to have the ftol variable be dependent on the voxel size of the input file, i.e., ftol = voxelsize*0.05 (or an even smaller value), but the function does not receive any information about the volume, so to be able to do that the api would need to be changed. Not sure whether that is a desired solution, or whether there is an alternative solution. Any input would be appreciated, Matthijs From claude at bic.mni.mcgill.ca Tue Dec 21 15:23:28 2010 From: claude at bic.mni.mcgill.ca (Claude LEPAGE) Date: Tue, 21 Dec 2010 15:23:28 -0500 Subject: [MINC-development] mincresample issue/bug at smaller voxel sizes using concatenated transforms In-Reply-To: <4D10F70F.1030504@phenogenomics.ca> Message-ID: <201012212023.oBLKNSa3032658@cassio.bic.mni.mcgill.ca> Hi, Have a look at what I did in minc-2.1.00 - which I use with histology data at 10 microns. I based the ftol as a function of the grid size used in the non-linear transform. It's better the previous hard-coded value of 0.05 (fine at 1mm). Ideally, as you say, ftol should be based on voxel size. However, good luck at obtaining this information in this piece of code. Claude From matthijs at phenogenomics.ca Thu Dec 23 11:48:29 2010 From: matthijs at phenogenomics.ca (Matthijs van Eede) Date: Thu, 23 Dec 2010 11:48:29 -0500 Subject: [MINC-development] mincresample issue/bug at smaller voxel sizes using concatenated transforms In-Reply-To: <201012212023.oBLKNSa3032658@cassio.bic.mni.mcgill.ca> References: <201012212023.oBLKNSa3032658@cassio.bic.mni.mcgill.ca> Message-ID: <4D137D5D.5050803@phenogenomics.ca> Hi Claude, Initially I thought the current solution in minc 2.1 would work for use, but we quite frequently use transformation grids with resolutions that are a lot coarser than the volumes we transform with them, so we would still run into the same problem. Is it possible to have an environment variable that can override the value that is set for ftol? Cheers, Matthijs Claude LEPAGE wrote: > Hi, > > Have a look at what I did in minc-2.1.00 - which I use with histology > data at 10 microns. I based the ftol as a function of the grid size > used in the non-linear transform. It's better the previous hard-coded > value of 0.05 (fine at 1mm). Ideally, as you say, ftol should be based > on voxel size. However, good luck at obtaining this information in > this piece of code. > > Claude > _______________________________________________ > MINC-development mailing list > MINC-development at bic.mni.mcgill.ca > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-development >