Logically, none of the values of the count[] array should ever be zero, since that would produce an overall hyperslab volume of zero. In other words, you would read no data.
Another constraint is that the start value plus the count value must always be less than or equal to the length of the dimension in voxels.
Each of the voxel read/write functions assumes that the coordinates and lengths specified in the start[] and count[] arrays are in the ``apparent'' order. By default the apparent order is the same as the file order.
By way of an contrived example, suppose you have a four-dimensional file structured according to the dimensions xspace,time,zspace,yspace with their respective lengths set to X, T, Z, and Y.
We use miset_apparent_dimension_order_by_name to assign a more conventional order to these dimensions:
static char *dimorder[] = { "time", "zspace","yspace","xspace" } miset_apparent_dimension_order_by_name(hvolume, 4, dimorder);
Now suppose we want to read the entire file in one operation. To do this, we might set up the following:
unsigned long start[4], count[4]; short buffer[T][Z][Y][X]; start[0] = start[1] = start[2] = start[3] = 0; count[0] = T; count[1] = Z; count[2] = Y; count[3] = X; miget_voxel_value_hyperslab(hvolume, MI_TYPE_SHORT, start, count, buffer);
Alternatively, we might just want to read the data from one time location into a three-dimensional array:
unsigned long start[4], count[4]; short buffer[Z][Y][X]; start[0] = t; /* The desired time value */ start[1] = start[2] = start[3] = 0; count[0] = 1; count[1] = Z; count[2] = Y; count[3] = X; miget_voxel_value_hyperslab(hvolume, MI_TYPE_SHORT, start, count, buffer);
Another possibility would be to read the entire timecourse of a specific spatial location:
unsigned long start[4], count[4]; short buffer[T]; start[0] = 0; /* Start at time=0 */ start[1] = z; /* z,y,x = spatial coordinate */ start[2] = y; start[3] = x; count[0] = T; count[1] = count[2] = count[3] = 1; miget_voxel_value_hyperslab(hvolume, MI_TYPE_SHORT, start, count, buffer);