Fix off-by-one error in computing XYZ2RCS transform#25
Conversation
|
This looks like a good catch, though the logistics of existing data will raise some difficult questions. The maximum error should be 1 voxel in each dimension, so for isotropic, 1.732 voxels in the worst corner (where there isn't any tissue anyway). Maybe 1.5 voxels worst case in tissue? If this is only in the coordinates that are used for evaluating spherical harmonics (and not for, say, deformation convention conversion), then this error would get multiplied by the (very small) gradient of the nonlinearity error, resulting in much less than a voxel of difference in displacement. What is the actual magnitude of the effect on the warpfields? |
|
I don't think there's a clean upper bound on the maximum error in displacement per voxel. The maximum sampling offset is the lattice spacing (10mm default); the maximal displacement error depends on how much the field can change along that distance based on the gradient coefficients. The following is for default estimation: lattice [-300, 300]mm with 60 points. Unnamed vendor & scanner. 1mm voxel grids centred around isocentre of different sizes. Norms of differences in deformation fields pre & post correction. Numbers would likely be worse for HCP data due to tolerance of greater nonlinearities during hardware design and not centering the brain at scanner isocentre. |
Bug in field estimation that dates back to at least 275b888 (I've not bothered to test before that).
Construction of the transformation between voxelspace and realspace has an off-by-one error in its interaction with
numpy.linspace(), compressing the whole field estimate toward the point [-fovmin, -fovmin, -fovmin].I have not tested the correspondence between correction with this software and the vendor-applied correction.
Experiment: 1mm isotropic image containing unit deformation field (each voxel contains its own realspace position); apply correction; convert deformation field to displacement field. Repeat for different lattice densities. Ideally an increased lattice resolution should yield a higher resolution estimation of the field, not result in the field moving in space.
Before fix:
After fix: