## AmitkRoi AmitkRoi |

## Synopsis

    #define             AMITK_ROI_TYPE                      (roi)
    #define             AMITK_ROI_ISOCONTOUR_MIN_VALUE      (roi)
    #define             AMITK_ROI_ISOCONTOUR_MAX_VALUE      (roi)
    #define             AMITK_ROI_ISOCONTOUR_RANGE          (roi)
    #define             AMITK_ROI_VOXEL_SIZE                (roi)
    #define             AMITK_ROI_UNDRAWN                   (roi)
    #define             AMITK_ROI_TYPE_ISOCONTOUR           (roi)
    #define             AMITK_ROI_TYPE_FREEHAND             (roi)
    #define             AMITK_ROI_GRANULARITY
    enum                AmitkRoiType;
    enum                AmitkRoiIsocontourRange;
                        AmitkRoi;
    AmitkRoi*           amitk_roi_new                       (AmitkRoiType type);
    GSList*             amitk_roi_get_intersection_line     (const AmitkRoi *roi,
                                                             const AmitkVolume *canvas_slice,
                                                             const amide_real_t pixel_dim);
    GSList*             amitk_roi_free_points_list          (GSList *list);
    AmitkDataSet*       amitk_roi_get_intersection_slice    (const AmitkRoi *roi,
                                                             const AmitkVolume *canvas_slice,
                                                             const amide_real_t pixel_dim,
                                                             const gboolean fill_map_roi);
    void                amitk_roi_set_voxel_size            (AmitkRoi *roi,
                                                             AmitkPoint voxel_size);
    void                amitk_roi_calc_far_corner           (AmitkRoi *roi);
    void                amitk_roi_set_isocontour            (AmitkRoi *roi,
                                                             AmitkDataSet *ds,
                                                             AmitkVoxel start_voxel,
                                                             amide_data_t isocontour_min_value,
                                                             amide_data_t isocontour_max_value,
                                                             AmitkRoiIsocontourRange isocontour_range);
    void                amitk_roi_manipulate_area           (AmitkRoi *roi,
                                                             gboolean erase,
                                                             AmitkVoxel erase_voxel,
                                                             gint area_size);
    AmitkPoint          amitk_roi_get_center_of_mass        (AmitkRoi *roi);
    void                amitk_roi_set_type                  (AmitkRoi *roi,
                                                             AmitkRoiType new_type);
    void                amitk_roi_calculate_on_data_set     (const AmitkRoi *roi,
                                                             const AmitkDataSet *ds,
                                                             const guint frame,
                                                             const guint gate,
                                                             const gboolean inverse,
                                                             const gboolean accurate,
                                                             void (*calculation) (),
                                                             gpointer data);
    void                amitk_roi_erase_volume              (const AmitkRoi *roi,
                                                             AmitkDataSet *ds,
                                                             const gboolean outside,
                                                             AmitkUpdateFunc update_func,
                                                             gpointer update_data);
    const gchar*        amitk_roi_type_get_name             (const AmitkRoiType roi_type);
    amide_real_t        amitk_rois_get_max_min_voxel_size   (GList *objects);

## Description

## Details

### AMITK_ROI_TYPE()

    #define AMITK_ROI_TYPE(roi)                  (AMITK_ROI(roi)->type)

`roi` : |

### AMITK_ROI_ISOCONTOUR_MIN_VALUE()

    #define AMITK_ROI_ISOCONTOUR_MIN_VALUE(roi)  (AMITK_ROI(roi)->isocontour_min_value)

`roi` : |

### AMITK_ROI_ISOCONTOUR_MAX_VALUE()

    #define AMITK_ROI_ISOCONTOUR_MAX_VALUE(roi)  (AMITK_ROI(roi)->isocontour_max_value)

`roi` : |

### AMITK_ROI_ISOCONTOUR_RANGE()

    #define AMITK_ROI_ISOCONTOUR_RANGE(roi)      (AMITK_ROI(roi)->isocontour_range)

`roi` : |

### AMITK_ROI_VOXEL_SIZE()

    #define AMITK_ROI_VOXEL_SIZE(roi)            (AMITK_ROI(roi)->voxel_size)

`roi` : |

### AMITK_ROI_UNDRAWN()

    #define AMITK_ROI_UNDRAWN(roi)               (!AMITK_VOLUME_VALID(roi))

`roi` : |

### AMITK_ROI_TYPE_ISOCONTOUR()

    #define             AMITK_ROI_TYPE_ISOCONTOUR(roi)

`roi` : |

### AMITK_ROI_TYPE_FREEHAND()

    #define             AMITK_ROI_TYPE_FREEHAND(roi)

`roi` : |

### AMITK_ROI_GRANULARITY

    #define AMITK_ROI_GRANULARITY 4 /* # subvoxels in one dimension, so 1/64 is grain size */

### enum AmitkRoiType

    typedef enum {
      AMITK_ROI_TYPE_ELLIPSOID,
      AMITK_ROI_TYPE_CYLINDER,
      AMITK_ROI_TYPE_BOX,
      AMITK_ROI_TYPE_ISOCONTOUR_2D,
      AMITK_ROI_TYPE_ISOCONTOUR_3D,
      AMITK_ROI_TYPE_FREEHAND_2D,
      AMITK_ROI_TYPE_FREEHAND_3D,
      AMITK_ROI_TYPE_NUM
    } AmitkRoiType;

### enum AmitkRoiIsocontourRange

    typedef enum {
      AMITK_ROI_ISOCONTOUR_RANGE_ABOVE_MIN,
      AMITK_ROI_ISOCONTOUR_RANGE_BELOW_MAX,
      AMITK_ROI_ISOCONTOUR_RANGE_BETWEEN_MIN_MAX,
      AMITK_ROI_ISOCONTOUR_RANGE_NUM
    } AmitkRoiIsocontourRange;

### AmitkRoi

    typedef struct {
      AmitkVolume parent;

      AmitkRoiType type;

      /* isocontour and freehand specific stuff */
      AmitkPoint voxel_size;
      AmitkRawData * map_data; /* raw data */
      gboolean center_of_mass_calculated;
      AmitkPoint center_of_mass;

      /* isocontour specific stuff */
      amide_data_t isocontour_min_value; /* note, min and max are what were specified for the isocontour */
      amide_data_t isocontour_max_value; /* what the user draws may lie outside of this range */
      AmitkRoiIsocontourRange isocontour_range;
    } AmitkRoi;

### amitk_roi_new ()

    AmitkRoi*           amitk_roi_new                       (AmitkRoiType type);

`type` : |
Returns : |

### amitk_roi_get_intersection_line ()

    GSList*             amitk_roi_get_intersection_line     (const AmitkRoi *roi,
                                                             const AmitkVolume *canvas_slice,
                                                             const amide_real_t pixel_dim);

`roi` : |
`canvas_slice` : |
`pixel_dim` : |
Returns : |

### amitk_roi_free_points_list ()

    GSList*             amitk_roi_free_points_list          (GSList *list);

`list` : |
Returns : |

### amitk_roi_get_intersection_slice ()

    AmitkDataSet*       amitk_roi_get_intersection_slice    (const AmitkRoi *roi,
                                                             const AmitkVolume *canvas_slice,
                                                             const amide_real_t pixel_dim,
                                                             const gboolean fill_map_roi);

`roi` : |
`canvas_slice` : |
`pixel_dim` : |
`fill_map_roi` : |
Returns : |

### amitk_roi_set_voxel_size ()

    void                amitk_roi_set_voxel_size            (AmitkRoi *roi,
                                                             AmitkPoint voxel_size);

`roi` : |
`voxel_size` : |

### amitk_roi_calc_far_corner ()

    void                amitk_roi_calc_far_corner           (AmitkRoi *roi);

`roi` : |

### amitk_roi_set_isocontour ()

    void                amitk_roi_set_isocontour            (AmitkRoi *roi,
                                                             AmitkDataSet *ds,
                                                             AmitkVoxel start_voxel,
                                                             amide_data_t isocontour_min_value,
                                                             amide_data_t isocontour_max_value,
                                                             AmitkRoiIsocontourRange isocontour_range);

`roi` : |
`ds` : |
`start_voxel` : |
`isocontour_min_value` : |
`isocontour_max_value` : |
`isocontour_range` : |

### amitk_roi_manipulate_area ()

    void                amitk_roi_manipulate_area           (AmitkRoi *roi,
                                                             gboolean erase,
                                                             AmitkVoxel erase_voxel,
                                                             gint area_size);

`roi` : |
`erase` : |
`erase_voxel` : |
`area_size` : |

### amitk_roi_get_center_of_mass ()

    AmitkPoint          amitk_roi_get_center_of_mass        (AmitkRoi *roi);

`roi` : |
Returns : |

### amitk_roi_set_type ()

    void                amitk_roi_set_type                  (AmitkRoi *roi,
                                                             AmitkRoiType new_type);

`roi` : |
`new_type` : |

### amitk_roi_calculate_on_data_set ()

    void                amitk_roi_calculate_on_data_set     (const AmitkRoi *roi,
                                                             const AmitkDataSet *ds,
                                                             const guint frame,
                                                             const guint gate,
                                                             const gboolean inverse,
                                                             const gboolean accurate,
                                                             void (*calculation) (),
                                                             gpointer data);

`roi` : |
`ds` : |
`frame` : |
`gate` : |
`inverse` : |
`accurate` : |
`calculation` : |
`data` : |

### amitk_roi_erase_volume ()

    void                amitk_roi_erase_volume              (const AmitkRoi *roi,
                                                             AmitkDataSet *ds,
                                                             const gboolean outside,
                                                             AmitkUpdateFunc update_func,
                                                             gpointer update_data);

`roi` : |
`ds` : |
`outside` : |
`update_func` : |
`update_data` : |

### amitk_roi_type_get_name ()

    const gchar*        amitk_roi_type_get_name             (const AmitkRoiType roi_type);

`roi_type` : |
Returns : |

### amitk_rois_get_max_min_voxel_size ()

    amide_real_t        amitk_rois_get_max_min_voxel_size   (GList *objects);

`objects` : |
Returns : |