# tend-grads - Man Page

calculate balanced gradient directions for DWI acquisition

## Synopsis

**tend grads** [**-n** <*# dir*>] [**-i** <*grads*>] [**-seed** <*value*>] [**-step** <*step*>] [**-single**] [**-snap** <*interval*>] [**-jitter** <*jitter*>] [**-miniter** <*# iters*>] [**-maxiter** <*# iters*>] [**-minvelo** <*vel*>] [**-exp** <*exponent*>] [**-dp** <*potential change*>] [**-minimprov** <*delta*>] [**-minmean** <*len*>] [**-izv** <*insert*>] [**-o** <*filename*>]

## Description

Composites an RGBA *nrrd* over a background color (or image), after doing gamma correction, then quantizes to an 8-bit image. Actually, the input *nrrd* can have more than 4 values per pixel, but only the first four are used. If the RGBA *nrrd* s floating point, the values are taken at face value; if it is fixed point, the values interpreted as having been quantized (so that 8-bit RGBA images will act as you expect). When compositing with a background image, the given background image does not have to be the same size as the input image; it will be resampled (with linear interpolation) to fit.

## Options

- -n <
*# dir*> desired number of diffusion gradient directions (

*int*) default: “**6**”- -i <
*grads*> initial gradient directions to start with, instead of default random initial directions (overrides “

**-n**”); default: “”- -seed <
*value*> seed value to used with

**airSrandMT()**(*unsigned int*) default: “**42**”- -step <
*step*> time increment in solver (

*double*) default: “**1.0**”- -single
instead of the default behavior of tracking a pair of antipodal points (appropriate for determining DWI gradients), use only single points (appropriate for who knows what).

- -snap <
*interval*> specifies an interval between which snapshots of the point positions should be saved out. By default (not using this option), there is no such snapshot behavior (

*int*) default: “**0**”- -jitter <
*jitter*> amount by which to perturb points when given an input

*nrrd*(*double*) default: “**0.1**”- -miniter <
*# iters*> min number of iterations for which to run the simulation (

*int*) default: “**0**”- -maxiter <
*# iters*> max number of iterations for which to run the simulation (

*int*) default: “**1000000**”- -minvelo <
*vel*> low threshold on mean velocity of repelling points, at which point repulsion phase of algorithm terminates. (

*double*) default: “**0.00001**”- -exp <
*exponent*> the exponent n that determines the potential energy

**1/r^n**. (*double*) default: “**1**”- -dp <
*potential change*> low threshold on fractional change of potential at which point repulsion phase of algorithm terminates. (

*double*) default: “**0.000000001**”- -minimprov <
*delta*> in the second phase of the algorithm, when stochastically balancing the sign of the gradients, the (small) improvement in length of mean gradient which triggers termination (as further improvements are unlikely. (

*double*) default: “**0.00005**”- -minmean <
*len*> if length of mean gradient falls below this, finish the balancing phase (

*double*) default: “**0.0001**”- -izv <
*insert*> adding zero vector at beginning of grads (

*bool*) default: “**false**”- -o <
*filename*> file to write output

*nrrd*to (*string*); default: “**-**”