MINC/Tutorials/Programming02

The two MINC coordinate systems.
MINC has two coordinate systems: a voxel and a world coordinate system. Voxel coordinates are like arrays, with the origin fixed in one corner of the image and incrementing to the length - 1 of that dimension. World coordinates, on the other hand, reflect the position in real world units of each voxel. Within a particular space, such as Talairach space, each particular coordinate thus has a meaning and is often shared across volumes.

The previous example just obtained a voxel using voxel coordinates - below is the same code modified to obtain a voxel at the origin of the world coordinate system.

So far, so good - this is almost the same code as in the first example with the addition of some extra variables.

This is where the actual conversion happens, taken care of by the miconvert_world_to_voxel function. There are three arguments: the volume struct (initialized by miopen_volume), an array of doubles containing the world coordinates that are to be converted (initialized to be zeros across the board in the line above), and an array of doubles which will hold the corresponding voxel coordinates.

The rest of the code should once again seem fairly familiar. There is one slightly awkward cast in there, as miconvert_world_to_voxel assigns the converted voxel coordinates to an array of doubles, but miget_real_value needs an array of unsigned longs. We could do some real interpolation, but we'll be lazy and just cast the double back to the unsigned long.