takes three values - two of which are optional:
II is the cost function (required)
wt is the weight matrix, used to provide weighted direction. If none is specified a 3x3x... matrix of ones is created for the weights.
dm is the dimension through which the path is to be found. If none is specified, dm is set to the last dimension.
returns a linearly indexed 1D line through the cost function starting at the first surface in the dmth dimension and finishing at the last surface in the dmth dimension. The line corresponds to the line that can be found with the maximum sum of values along that line, with constraints specified by the weight function.
min path can be found, instead of max path, by setting II = -II