BIC-MNI / minc-tools

Basic minc-tools from former minc repository
Other
30 stars 25 forks source link

"mincresample -transform" diffusion gradients #43

Open ajwood opened 8 years ago

ajwood commented 8 years ago

Since diffusion gradients can be stored in the minc header in acquisition:direction_[xyz] and acquisition:bvalues, I was wondering if the core minc tools could be made to interpret them, where appropriate.

The first tools that come to mind are:

1) mincresample -transform lin.xfm Transform the directions along with the data

2) mincconcat -concat_dimension zspace slice1.mnc slice2.mnc slice3.mnc ... volume.mnc Refuse to concatenate slice that don't share a common direction and bvalue

andrewjanke commented 8 years ago

I'm not against this but I'd suggest we tread carefully, or if we do implement this make it only accessible via an argument as opposed to default (in a way hidden) behaviour.

Reasoning:

  1. There are times when you transform diffusion data in which you don't want to reorient.
  2. There are a number of different methods to reorient diffusion data, for a linear transform it's reasonably well understood but not so for nonlinear, so we're going to have to pick a winner, on what radius do we calculate the local rotation and scale for a nonlinear transformation? Do we preserve the mass of the tensor when changing local volume?
  3. This might be best achieved with a perl/python/shell script wrapper in which these options can be better exposed to the user.

Incidentally this is much the same problem as resampling a vector field.

ajwood commented 8 years ago

My concern with the current implementation is that after a transform, the gradients directions in the header are simply incorrect.

  1. I haven't come across a situation in which you don't want to reorient. Can you share an example? If this is an exceptional case, perhaps we could reorient by default, with an option to disable.
  2. For linear, reorienting seems straightforward. For nonlinear, since we'd need to write a separate "grid" file for the local directions, we could crash on -transform unless the additional grid file is provided via a new option (e.g. mincresample -transformation nl.xfm -gradients local_gradients4D.mnc). I think nonlinear transforms would need to scrub the global directions from the header, which could be implemented prior to the more complex problem of nonlinear reorienting.
  3. If we go this route, I think mincresample -transform nonetheless needs to remove the misleading directions from the output file's header.
andrewjanke commented 8 years ago

A case for #1 would be distortion correction (from gradients).

On #3 realise that having information that is no longer valid/of use in the header is not unique to diffusion data.