int
unmask_volume(header *hdr, void** data, header *maskhdr, char *mask) {
The volume is expanded into memory accoring to the binary mask *mask.
The new volume has the dimensions of the mask and consists of the volume data points inserted where the mask volume is non-zero.
This function effectively reverses the effect of mask_volume().
The header hdr is changed in hdr->cmpix, hdr->size and hdr->rank to match the mask.
Returns OK on success, ERROR if e.g. the n.o. data points in the volume is different than the n.o. non-zero mask entries.
Fill in required size and data type into a header struct (obtained from new_header(). Allocate data using
header *hdr1, *hdr2; void *data, *mask; read_volume( "myvolume", hdr1, &data ); // A big volume read_volume( "mymask", hdr2, &mask ); // A binary mask mask_volume(hdr1, &data, mask); // Now the volume is smaller.. unmask_volume(hdr1, &data, hdr2, mask); // Now the volume is original size ..
1.0 20/7-98 Ulrik Kjems