next up previous
Next: alloc_volume() Up: Brain Volume I/O Handling Previous: mask_volume()

unmask_volume()  

Unmask and reallocate volume from binary mask



Synopsis


int 
unmask_volume(header *hdr, void** data, header *maskhdr, char *mask) {


Description
Call this function to reallocate the memory for the volume described in hdr and data.

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.

Usage

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 ..

Revision


1.0  20/7-98   Ulrik Kjems


Program listing






Ulrik Kjems
6/3/1998