~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/covira/slice.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* slice.c
  2  *
  3  * single slice handling
  4  *
  5  */
  6 #include <tina/all_tina.h>
  7 #include <tina/brain.h>
  8 #include <tina/brainfuncs.h>
  9 
 10 /*
 11 Allocate a slice with space for NVOI volumes of interest.
 12 */
 13 Slice *slice_alloc(double z)
 14 {
 15     Slice *slice = (Slice *) ralloc(sizeof(Slice));
 16     int i;
 17     slice->im = NULL;
 18     slice->pot = NULL;
 19     for (i = 0; i < NVOI; i++)
 20         slice->voi[i] = voi_alloc();
 21     slice->z = z;
 22     return (slice);
 23 }
 24 
 25 /*
 26 Free a slice.
 27 */
 28 void slice_free(Slice * slice)
 29 {
 30     int i;
 31     if (slice == NULL)
 32         return;
 33     im_free(slice->im);
 34     im_free(slice->pot);
 35     for (i = 0; i < NVOI; i++)
 36         voi_free(slice->voi[i]);
 37     rfree(slice);
 38 }
 39 
 40 /*
 41 Copy VOI labelled nvoi from oldslice to newslice.
 42 */
 43 void slice_voi_import(Slice * slice, Slice * oldslice, int nvoi)
 44 {
 45     if (slice == NULL || oldslice == NULL || slice == oldslice)
 46         return;
 47     voi_free(slice->voi[nvoi]);
 48     slice->voi[nvoi] = voi_copy(oldslice->voi[nvoi]);
 49 }
 50 
 51 /*
 52 Get image from current slice.
 53 */
 54 Imrect *slice_image_get(Slice * slice)
 55 {
 56     if (slice == NULL)
 57         return (NULL);
 58     return (slice->im);
 59 }
 60 
 61 /*
 62 Set image in current slice, freeing old image if allowed.
 63 Nasty: global handler ims_dofree_get should not be used at this slice level.
 64 */
 65 void slice_image_set(Slice * slice, Imrect * im)
 66 {
 67     Bool dofree = ims_dofree_get();
 68     if (slice == NULL)
 69         return;
 70     if(dofree == true)
 71         im_free(slice->im);
 72     slice->im = im;
 73 }
 74 
 75 /*
 76 Get potential image from current slice.
 77 */
 78 Imrect *slice_pot_get(Slice * slice)
 79 {
 80     if (slice == NULL)
 81         return (NULL);
 82     return (slice->pot);
 83 }
 84 
 85 /*
 86 Set potential image in current slice, freeing old potential.
 87 */
 88 void slice_pot_set(Slice * slice, Imrect * pot)
 89 {
 90     if (slice == NULL)
 91         return;
 92     im_free(slice->pot);
 93     slice->pot = pot;
 94 }
 95 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.