new Image::ThreadedLoop::apply() & Image::ThreadedLoop::apply_inplace() wrapper functions to allow easy coding of multi-threaded per-voxel operations by passing a simple function / functor that operates on values rather than a full-blown thread kernel. For example:
new Image::ThreadedLoop::apply() & Image::ThreadedLoop::apply_inplace() wrapper
functions to allow easy coding of multi-threaded per-voxel operations by
passing a simple function / functor that operates on values rather than a
full-blown thread kernel. For example:

float myadd (float in1, float in2) { return in1+in2; }

...
// vox_out.value() = vox_in1.value() + vox_in2.value():
Image::ThreadedLoop::apply ("adding...", vox_out, myadd, vox_in1, vox_in2);

// in-place version: vox_out.value() = vox_out.value() + vox_in1.value():
Image::ThreadedLoop::apply_inplace ("adding...", myadd, vox_out, vox_in1);




MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3,MRtrix3/mrtrix3