MINC/SoftwareDevelopment/MINC1-voxel-loop-example

=this is a dump of an old doc from Peter Neelin from yonks ago=

The basic idea is that you call voxel_loop with a list of input files, a list of output files and a function to call:

This causes voxel_loop to call the voxel function with only one buffer (but once for each file). The idea is that you take the ibuff loop and put it on the outside. However, now you need to keep track of sum1 and sum2 in buffers - well, just use the output buffers for that purpose. What if you only have one output file and need two buffers? Then set num_extra_buffers to 1 - added to the one output buffer gives two available buffers (only the first buffer is written out). The functions start_function and end_function are used to initialize and do final computation on the output buffers. Remember to make sure that your final data is in the first num_outputs buffers after end_function because that is what is written out.