TINA  4
TINAmachinevisionlibraries
Functions
brainfuncs.h File Reference

Go to the source code of this file.

Functions

void str2_align (Tstring *str1, Tstring *str2)
void hrs_solve (int n, double *a, double *b, double *c, double *y)
Tstringaivru_contour_get ()
void aivru_contour_set (Tstring *iccontour)
int aivru_get_voi_lbound ()
AvVoiSurfaceaivru_get_voi_surface ()
int aivru_get_voi_ubound ()
int aivru_get_working_slice ()
int aivru_image_set (Imrect **pImrectArray, int arraySize)
int aivru_multi_snake_interpolate_between (int lower_slice, int upper_slice)
int aivru_multi_snake_interpolate_one ()
int aivru_multi_snake_interpolate_tube ()
int aivru_multi_snake_set_occluding_boundary (Tstring *pContour)
void aivru_position_down (int x, int y)
void aivru_position_drag (int x, int y)
void aivru_position_up (int x, int y)
void aivru_quit ()
void aivru_set_working_slice (int slice_no)
int aivru_snake_convergence_achieved ()
int aivru_snake_force_mode_get ()
void aivru_snake_force_mode_set (int mode)
double aivru_snake_image_level_get ()
void aivru_snake_image_level_set (double newlevel)
double aivru_snake_image_window_get ()
void aivru_snake_image_window_set (double newwindow)
int aivru_snake_interact_mode_get ()
void aivru_snake_interact_mode_set (int mode)
Tstringaivru_snake_points_get ()
double aivru_snake_pressure_get ()
void aivru_snake_pressure_set (double newpressure)
double aivru_snake_region_level_get ()
void aivru_snake_region_level_set (double newlevel)
double aivru_snake_region_window_get ()
void aivru_snake_region_window_set (double newwindow)
int aivru_snake_rigidity_mode_get ()
void aivru_snake_rigidity_mode_set (int mode)
void aivru_snake_run ()
double aivru_snake_scale_get ()
void aivru_snake_scale_set (double newscale)
double aivru_snake_smoothness_get ()
void aivru_snake_smoothness_set (double newsmoothness)
void aivru_snake_stats_compute (double *mean, double *dev)
int aivru_snake_steps_get ()
void aivru_snake_steps_set (int newsteps)
int aivru_snake_transfer (int source_slice, int dest_slice)
void aivru_voi_set (aivru_snake_slice_info *sinfo, int size)
void create_front_display (void)
Bool front_changed (void)
Tv_mouse front_cursor_mouse (void)
Tvfront_tv_get (void)
void front_tv_set (Tv *tv)
void ims_snake_forcelaw_set (void(*forcelaw)())
void ims_bottom (void)
void ims_down (void)
Spline2ims_fixed_spline_get (int n)
void ims_free ()
Imrectims_image_get (void)
void ims_image_set (Imrect *im)
Imstackims_imstack_get (void)
void ims_imstack_set (Imstack *new_imstack)
void ims_voi_print (FILE *fp)
void ims_voi_read (FILE *fp)
void ims_init_cursor (void)
Bool ims_interpolate_all_splines_between (int lz, int uz)
void ims_interpolate_spline (void)
int ims_lz_get (void)
void ims_make (Vartype vtype, int lz, int uz, double zscale)
int ims_nvoi_get ()
void ims_nvoi_set (int nvoi)
Imrectims_pot_get (void)
void ims_pot_set (Imrect *pot)
void ims_pots_free ()
void ims_pots_get (void)
void ims_rescale_images (double gamma, double low, double high)
void ims_reverse_image_order ()
Imregionims_roi_get (void)
void ims_sagit_tube_set (Spline2 *spline1, Spline2 *spline2, double x)
void ims_snake_changed (void)
Snakeims_snake_get (void)
double ims_snake_run_all (double alpha, double beta, int steps)
double ims_snake_run_rot (int steps)
double ims_snake_run_rts (int steps)
double ims_snake_run_scale (int steps)
double ims_snake_run_trans (int steps)
void ims_snake_set (Snake *snake)
void ims_spline_changed (void)
Spline2ims_spline_get (void)
void ims_spline_set (Spline2 *spline)
Splinesurf3ims_splinesurf3_make ()
void ims_stat_snake_init ()
void ims_stat_snake_run (double alpha, double beta, double pressure, double k_s_d, int steps, int flag, int min_gap, int max_gap, double dt)
void ims_stat_snake_trans (double alpha, double beta, double pressure, double k_s_d, int steps, double dt)
void ims_string_changed (void)
Tstringims_string_get (void)
void ims_string_set (Tstring *string)
void ims_string_tube_set (Tstring *str)
void ims_top (void)
Tubeims_tube_get ()
void ims_tube_interp ()
void ims_tube_set (Tube *newtube)
void ims_up (void)
int ims_uz_get (void)
Bool ims_voi_bounds (int *lz, int *uz)
void ims_voi_empty (void)
Voiims_voi_get (void)
void ims_voi_import (void)
void ims_voi_mark (void)
void ims_voi_shift (Vec2 dp)
int ims_x_get (void)
void ims_x_set (int newx)
Imrectims_xslice (void)
int ims_y_get (void)
void ims_y_set (int newy)
Imrectims_yslice (void)
int ims_z_get (void)
void ims_z_set (int newz)
double ims_zscale_get (void)
void ims_zscale_set (double zscale)
double ims_zscaled_get (void)
Imrectims_zslice (void)
void ims_all_vois_draw (Tv *tv, void(*func)())
double ims_all_vois_area ()
void ims_all_snakes_draw (Tv *tv)
void ims_all_splines_draw (Tv *tv)
void ims_all_strings_draw (Tv *tv)
void ims_all_strings_draw3 (Tv *tv)
void ims_all_strings_front_draw3 (Tv *tv)
void ims_all_strings_sagit_draw3 (Tv *tv)
void ims_box_draw3 (Tv *tv, double s)
void ims_camera2 (Tv *tv)
void ims_image_draw (Tv *tv)
void ims_loop_draw (Tv *tv)
void ims_pot_draw (Tv *tv)
void ims_sagit_tube_draw (Tv *tv)
void ims_snake_draw (Tv *tv)
void ims_spline_draw (Tv *tv)
void ims_str2_draw3 (Tv *tv)
void ims_string_draw (Tv *tv)
void ims_string_front_draw3 (Tv *tv)
void ims_string_sagit_draw3 (Tv *tv)
void ims_string_skeldraw3 (Tv *tv, int space)
void ims_strings_draw3 (Tv *tv)
void ims_strings_front_draw3 (Tv *tv)
void ims_strings_sagit_draw3 (Tv *tv)
void ims_strings_skeldraw3 (Tv *tv, int space, int maxnum)
void ims_tube_draw (Tv *tv)
double ims_alpha_get (void)
void ims_alpha_set (double newalpha)
double ims_asnake_get (void)
void ims_asnake_set (double newasnake)
double ims_beta_get (void)
void ims_beta_set (double newbeta)
Bool ims_dofree_get (void)
void ims_dofree_set (Bool newdofree)
double ims_level_get (void)
void ims_level_set (double newlevel)
int ims_nspline_get (void)
double ims_pressure_get (void)
void ims_pressure_set (double newpressure)
double ims_scale_get (void)
void ims_scale_set (double newscale)
Statsims_stats_get ()
double ims_stats_mean_get ()
void ims_stats_mean_set (double mean)
void ims_stats_set (Stats *newstats)
double ims_stats_sigma_get ()
void ims_stats_sigma_set (double sigma)
double ims_window_get (void)
void ims_window_set (double newwindow)
void imstack_free (Imstack *imstack)
Imstackimstack_make (Vartype vtype, int lz, int uz, double zscale)
Imrectimstack_xslice (Imstack *imstack, int x)
Imrectimstack_yslice (Imstack *imstack, int y)
double imstack_zscaled (Imstack *imstack, int z)
int imstack_zunscaled (Imstack *imstack, double z)
Spline2imstack_interpolate_spline (Imstack *imstack, double z)
void imstack_uniform_splines (Imstack *imstack)
Imrectcanny_pot (Imrect *im, double sigma)
Imrectcanny_window_pot (Imrect *im, double sigma, double l, double w)
Imrectdark_pot (Imrect *im, double sigma)
Vec2 im_grad_vec2 (Imrect *im, Vec2 p)
Mat2 im_hess_mat2 (Imrect *im, Vec2 p)
Imrectlight_pot (Imrect *im, double range, double sigma)
void create_sagit_display (void)
Bool sagit_changed (void)
Tv_mouse sagit_cursor_mouse (void)
Tvsagit_tv_get (void)
void sagit_tv_set (Tv *tv)
Sliceslice_alloc (double z)
void slice_free (Slice *slice)
Imrectslice_image_get (Slice *slice)
void slice_image_set (Slice *slice, Imrect *im)
Imrectslice_pot_get (Slice *slice)
void slice_pot_set (Slice *slice, Imrect *pot)
void slice_voi_import (Slice *slice, Slice *oldslice, int nvoi)
void slice_image_draw (Tv *tv, Slice *slice)
void slice_pot_draw (Tv *tv, Slice *slice)
void smask_diff (int s, double *mask2, double *mask1)
void smask_diff2 (int s, double *mask2, double *mask1)
double smask_maxgradedge (int s, double *mask)
double smask_nearzeroedge (double *mask, int s)
void smask_normalise (int s, double *mask, double m)
void smask_smooth (int s, double *mask2, double *mask1)
Vec2 snake_centroid (Snake *snake)
double snake_chord (Snake *snake, int i)
Snakesnake_copy (Snake *snake)
Vec2 snake_eval (Snake *snake, double t)
void snake_free (Snake *snake)
Snakesnake_from_list (List *points)
double snake_length (Snake *snake)
Snakesnake_make (int n)
Snakesnake_of_str2 (Tstring *str, double gap)
Vec2 snake_perp (Snake *snake, int i)
void snake_shift (Snake *snake, Vec2 dp)
Tstringstr2_of_snake (Snake *snake)
void snake_draw (Tv *tv, Snake *snake)
void snake_draw3 (Tv *tv, Snake *snake, double z)
void snake_force_draw (Tv *tv, Snake *snake, double maxlength)
void snake_normal_graphs (Tv *tv, Snake *snake, Imrect *pot)
Tv_mouse snake_edit_mouse (void)
Tv_mouse string_draw_mouse (void)
void notv_snake_edit_down (Ipos pos)
void notv_snake_push_drag (Ipos pos)
void notv_snake_push_up (Ipos pos)
void notv_snake_shift_drag (Ipos pos)
void notv_snake_shift_up (Ipos pos)
void notv_snake_zoom_drag (Ipos pos)
void notv_snake_zoom_up (Ipos pos)
double snake_dist (Snake *s1, Snake *s2)
void snake_external_step (Snake *snake, double maxstep, double *pdt)
void snake_gradient_forces (Snake *snake, Imrect *pot)
void snake_hessian_forces (Snake *snake, Imrect *pot)
void snake_internal_step (Snake *snake, double alpha, double beta, double dt)
void snake_rot_force (Snake *snake)
void snake_rot_step (Snake *snake, double maxstep)
double snake_run_all (Snake *snake, Imrect *pot, double alpha, double beta, int steps)
double snake_run_rot (Snake *snake, Imrect *pot, int steps)
double snake_run_rts (Snake *snake, Imrect *pot, int steps)
double snake_run_scale (Snake *snake, Imrect *pot, int steps)
double snake_run_trans (Snake *snake, Imrect *pot, int steps)
void snake_scale_force (Snake *snake)
void snake_scale_step (Snake *snake, double maxstep)
void snake_trans_force (Snake *snake)
void snake_trans_step (Snake *snake, double maxstep)
void snake_normal_forces (Snake *snake, Imrect *pot)
void spline_add_point (Spline *spline, int ibelow, double p)
Splinespline_copy (Spline *spline)
void spline_delete_point (Spline *spline, int ip)
double spline_eval (Spline *spline, double t)
void spline_free (Spline *spline)
void spline_interpolate (Spline *spline, double *q)
Splinespline_make (int type, int n)
double spline_param (Spline *spline, double p)
void spline_replace_point (Spline *spline, int ip, double p)
Splinespline_stack_interp (int n, Spline **stack, double t)
void spline2_add_point (Spline2 *spline, int ibelow, Vec2 p)
Spline2spline2_alloc (int type, int n)
Spline2spline2_approx_str2 (Tstring *str, int *pn, double dmax)
Spline2spline2_copy (Spline2 *spline)
void spline2_print (FILE *pf, Spline2 *spline)
Spline2spline2_read (FILE *pf)
void spline2_delete_point (Spline2 *spline, int i)
double spline2_dist (Spline2 *spline, Vec2 p)
Vec2 spline2_closest (Spline2 *spline, Vec2 p)
Vec2 spline2_eval (Spline2 *spline, double t)
void spline2_free (Spline2 *spline)
void spline2_interpolate (Spline2 *spline, Vec2 *p)
Spline2spline2_interpolate_list (int type, List *points)
Spline2spline2_interpolate_ddlist (int type, List *points)
Spline2spline2_make (int type, int n)
double spline2_natural_param (Spline2 *spline, Vec2 p)
Spline2spline2_of_str2 (Tstring *str, int n)
double spline2_param (Spline2 *spline, Vec2 p)
void spline2_replace_point (Spline2 *spline, int ip, Vec2 p)
Spline2spline2_stack_interp (int n, Spline2 **spline, double t)
void spline3_print (FILE *fp, double z, Spline2 *spline)
Tstringstr2_of_spline2 (Spline2 *spline)
void spline2_draw (Tv *tv, Spline2 *spline)
void spline2_draw_points (Tv *tv, Spline2 *spline)
Tv_mouse spline_edit_mouse (void)
Tv_mouse spline_periodic_draw_mouse (void)
void spline_save_periodic (Tv *tv, Ipos pos)
void spline_save_tube (Tv *tv, Ipos pos)
Tv_mouse spline_tube_draw_mouse (void)
Splinesurfsplinesurf_copy (Splinesurf *ss)
double splinesurf_eval (Splinesurf *ss, double s, double t)
double splinesurf_eval_du (Splinesurf *ss, double s, double t)
double splinesurf_eval_dv (Splinesurf *ss, double s, double t)
void splinesurf_free (Splinesurf *ss)
void splinesurf_interpolate (Splinesurf *ss, double **data)
Splinesurfsplinesurf_make (int utype, int vtype, int nu, int nv)
Vec3 splinesurf3_control (Splinesurf3 *ss, int u, int v)
Splinesurf3splinesurf3_copy (Splinesurf3 *ss)
Vec3 splinesurf3_eval (Splinesurf3 *ss, double s, double t)
Vec3 splinesurf3_eval_du (Splinesurf3 *ss, double s, double t)
Vec3 splinesurf3_eval_dv (Splinesurf3 *ss, double s, double t)
Vec3 splinesurf3_eval_normal (Splinesurf3 *ss, double s, double t)
void splinesurf3_free (Splinesurf3 *ss)
void splinesurf3_interpolate (Splinesurf3 *ss, Vec3 **points)
Splinesurf3splinesurf3_make (int utype, int vtype, int nu, int nv)
void splinesurf3_print (FILE *fp, Splinesurf3 *ss)
Splinesurf3splinesurf3_read (FILE *fp)
void splinesurf3_controls_draw (Tv *tv, Splinesurf3 *ss)
void splinesurf3_draw (Tv *tv, Splinesurf3 *ss)
void splinesurf3_shade (Tv *tv, Splinesurf3 *ss)
void splinesurf3_uslice_draw (Tv *tv, Splinesurf3 *ss, double s)
void splinesurf3_uslices_draw (Tv *tv, Splinesurf3 *ss)
void splinesurf3_vslice_draw (Tv *tv, Splinesurf3 *ss, double t)
void splinesurf3_vslices_draw (Tv *tv, Splinesurf3 *ss)
Imrectaccum_make (Imrect *im, Tstring *ss)
Tstringss_copy (Tstring *ss)
double ss_dist (Tstring *ss1, Tstring *ss2)
void ss_free (Tstring *ss)
Tstringss_from_snake (Snake *snake)
Snakess_to_snake (Tstring *ss)
void stat_snake_edit (Tstring *ss, Imrect *accum, int min_gap, int max_gap)
void stat_snake_maxgap (Tstring *ss, Imrect *accum, int min_gap, int max_gap)
void stat_snake_mingap (Tstring *ss, Imrect *accum, int min_gap)
void stat_snake_step (Tstring *ss, Imrect *accum, Imrect *im, Stats *stats, double alpha, double beta, double pressure, double k_s_d, double dt)
void stat_snake_trans (Tstring *ss, Imrect *im, Stats *stats, double alpha, double beta, double pressure, double k_s_d, double dt)
Statsstats_make ()
void ss_draw (Tv *tv, Tstring *ss)
void create_trans_display (void)
Bool trans_changed (void)
Tv_mouse trans_cursor_mouse (void)
Tvtrans_tv_get (void)
void trans_tv_set (Tv *tv)
void tube_free (Tube *tube)
Tubetube_make (int z1, int z2)
void sagit_tube_draw (Tv *tv, Tube *tube)
void redraw_all (void)
void tv_crosshair (Tv *tv, Ipos pos)
void create_vis3d_display (void)
Tvvis3d_tv_get (void)
void vis3d_tv_set (Tv *tv)
Voivoi_alloc (void)
Voivoi_copy (Voi *oldvoi)
void voi_empty (Voi *voi)
Spline2voi_fixed_spline_get (Voi *voi, int n)
void voi_free (Voi *voi)
void voi_shift (Voi *voi, Vec2 dp)
void voi_snake_changed (Voi *voi)
Snakevoi_snake_get (Voi *voi)
void voi_snake_set (Voi *voi, Snake *snake)
void voi_spline_changed (Voi *voi)
Spline2voi_spline_get (Voi *voi)
void voi_spline_set (Voi *voi, Spline2 *spline)
void voi_string_changed (Voi *voi)
Tstringvoi_string_get (Voi *voi)
void voi_string_set (Voi *voi, Tstring *string)
void spline_draw (Tv *tv, Spline2 *spline)
void str2_draw3 (Tv *tv, Tstring *string, double z)
void string_front_draw3 (Tv *tv, Tstring *string, double z)
void string_sagit_draw3 (Tv *tv, Tstring *string, double z)
void string_skeldraw3 (Tv *tv, Tstring *string, double z, int space)
void create_work_display (void)
void work_cursor_mode_set (Bool flag)
Tv_mouse work_cursor_mouse (void)
void work_image_choice_proc (int val)
void work_init_proc (Tv *tv, Ipos pos)
Tvwork_tv_get (void)
void work_tv_set (Tv *tv)
void work_voi_choice_proc (int val)
void work_zoom_proc (Tv *tv, Ipos pos)

Function Documentation

Imrect* accum_make ( Imrect im,
Tstring ss 
)

Definition at line 383 of file statsnake.c.

Referenced by ims_stat_snake_run().

{
    Imrect *accum = im_alloc(im->height, im->width, NULL, char_v);
    List *ptr;

    for (ptr = ss->start;; ptr = ptr->next)
    {
        dd_string_plot(accum, ptr, ptr->next, 1);
        if (ptr == ss->end)
            break;
    }
    return (accum);
}

Here is the caller graph for this function:

Tstring* aivru_contour_get ( )

Definition at line 300 of file covira.c.

{
    Tstring *str = ims_string_get();
    return(str);
}
void aivru_contour_set ( Tstring iccontour)

Definition at line 310 of file covira.c.

int aivru_get_voi_lbound ( )

Definition at line 363 of file covira.c.

{
    int lz, uz;
    ims_voi_bounds(&lz, &uz);
    return(lz);
}
AvVoiSurface* aivru_get_voi_surface ( )

Definition at line 463 of file covira.c.

Referenced by aivru_print_voi_surface().

{
    AvVoiSurface *asurf = (AvVoiSurface *) malloc(sizeof(AvVoiSurface));
    Splinesurf3 *surf = ims_splinesurf3_make();
    Imstack *ims = ims_imstack_get();
    int u, v, k;

    asurf->nx = surf->nu+1;
    asurf->ny = surf->nv;
    asurf->cp = tvector_alloc(0, 3*asurf->nx*asurf->ny, float);

    k = 0;
    for(v = 0; v < surf->nv; v++)
        for(u = 0; u < surf->nu+1; u++)
        {
            asurf->cp[k++] = surf->x->p[u][v];
            asurf->cp[k++] = surf->y->p[u][v];
            asurf->cp[k++] = imstack_zunscaled(ims, surf->z->p[u][v]);
        }
    return(asurf);
}

Here is the caller graph for this function:

int aivru_get_voi_ubound ( )

Definition at line 374 of file covira.c.

{
    int lz, uz;
    ims_voi_bounds(&lz, &uz);
    return(uz-1);
}
int aivru_get_working_slice ( )

Definition at line 384 of file covira.c.

{
    return(ims_z_get());
}
int aivru_image_set ( Imrect **  pImrectArray,
int  arraySize 
)

Definition at line 332 of file covira.c.

{
    int i;
    ims_dofree_set(false);
    ims_make(short_v, 0, arraySize, 4.0);
    for(i = 0; i < arraySize; i++)
    {
        ims_z_set(i);
        ims_image_set(pImrectArray[i]);
    }
    return(1);
}
int aivru_multi_snake_interpolate_between ( int  lower_slice,
int  upper_slice 
)

Definition at line 425 of file covira.c.

{
    ims_interpolate_all_splines_between(lower_slice, upper_slice+1);
    return(1);
}
int aivru_multi_snake_interpolate_one ( )

Definition at line 413 of file covira.c.

{
    ims_interpolate_spline();
    return(1);
}
int aivru_multi_snake_interpolate_tube ( )

Definition at line 449 of file covira.c.

{
    ims_tube_interp();
    return(1);
}
int aivru_multi_snake_set_occluding_boundary ( Tstring pContour)

Definition at line 438 of file covira.c.

{
    ims_string_tube_set(pContour);
    return(1);
}
void aivru_position_down ( int  x,
int  y 
)

Definition at line 42 of file covira.c.

{
    Ipos p = ipos(x, y);
    switch(interact_mode)
    {
        case PUSH_CONTOUR:
        case SHIFT_CONTOUR:
        case ZOOM_CONTOUR:
            notv_snake_edit_down(p);
            break;
    }
        
}
void aivru_position_drag ( int  x,
int  y 
)

Definition at line 60 of file covira.c.

void aivru_position_up ( int  x,
int  y 
)

Definition at line 83 of file covira.c.

{
    Ipos p = ipos(x, y);
    switch(interact_mode)
    {
        case PUSH_CONTOUR:
            notv_snake_push_up(p);
            break;
        case SHIFT_CONTOUR:
            notv_snake_shift_up(p);
            break;
        case ZOOM_CONTOUR:
            notv_snake_zoom_up(p);
            break;
    }
}
void aivru_quit ( )

Definition at line 512 of file covira.c.

{
    ims_free();
}
void aivru_set_working_slice ( int  slice_no)

Definition at line 392 of file covira.c.

{
    ims_z_set(slice_no);
}
int aivru_snake_convergence_achieved ( )

Definition at line 574 of file covira.c.

{
    return(0);
}
int aivru_snake_force_mode_get ( )

Definition at line 125 of file covira.c.

{
    return(force_mode);
}
void aivru_snake_force_mode_set ( int  mode)

Definition at line 133 of file covira.c.

{
    force_mode = mode;
}
double aivru_snake_image_level_get ( )

Definition at line 265 of file covira.c.

{
    return(ims_level_get());
}
void aivru_snake_image_level_set ( double  newlevel)

Definition at line 273 of file covira.c.

{
    ims_level_set(newlevel);
}
double aivru_snake_image_window_get ( )

Definition at line 282 of file covira.c.

{
    return(ims_window_get());
}
void aivru_snake_image_window_set ( double  newwindow)

Definition at line 291 of file covira.c.

{
    ims_window_set(newwindow);
}
int aivru_snake_interact_mode_get ( )

Definition at line 25 of file covira.c.

{
    return(interact_mode);
}
void aivru_snake_interact_mode_set ( int  mode)

Definition at line 33 of file covira.c.

{
    interact_mode = mode;
}
Tstring* aivru_snake_points_get ( )

Definition at line 319 of file covira.c.

{
    Snake *snake = ims_snake_get();
    static Tstring *str = NULL;
    ss_free(str);
    str = ss_from_snake(snake);
    return(str);
}
double aivru_snake_pressure_get ( )

Definition at line 161 of file covira.c.

{
    return(ims_pressure_get());
}
void aivru_snake_pressure_set ( double  newpressure)

Definition at line 169 of file covira.c.

{
    ims_pressure_set(newpressure);
}
double aivru_snake_region_level_get ( )

Definition at line 210 of file covira.c.

Referenced by aivru_snake_stats_compute().

{
    return(ims_stats_mean_get());
}

Here is the caller graph for this function:

void aivru_snake_region_level_set ( double  newlevel)

Definition at line 218 of file covira.c.

{
    ims_stats_mean_set(newlevel);
}
double aivru_snake_region_window_get ( )

Definition at line 229 of file covira.c.

Referenced by aivru_snake_stats_compute().

{
    double kdev = 2.0;
    return(2.0*kdev*ims_stats_sigma_get());
}

Here is the caller graph for this function:

void aivru_snake_region_window_set ( double  newwindow)

Definition at line 239 of file covira.c.

{
    double kdev = 2.0;
    ims_stats_sigma_set(newwindow/(2.0*kdev));
}
int aivru_snake_rigidity_mode_get ( )

Definition at line 105 of file covira.c.

{
    return(rigidity_mode);
}
void aivru_snake_rigidity_mode_set ( int  mode)

Definition at line 113 of file covira.c.

{
    rigidity_mode = mode;
}
void aivru_snake_run ( )

Definition at line 533 of file covira.c.

{
    double tension = ims_alpha_get();
    double stiffness = ims_beta_get();
    double pressure = ims_pressure_get();
    if(force_mode == SEEK_EDGE)
    {
        if(rigidity_mode == RUN_RIGID)
            snake_run_rts(ims_snake_get(), ims_pot_get(), steps);
        else if(rigidity_mode == RUN_DYNAMIC)
            snake_run_all(ims_snake_get(), ims_pot_get(),
                stiffness, tension, steps);
        ims_snake_changed();
    }
    else if (force_mode == GROW_REGION)
    {
        int ss_min = 4;
        int ss_max = 7;
        int ss_flag = 1;
        double kdev = 2.0;

        if(rigidity_mode == RUN_DYNAMIC)
        {
        ims_stat_snake_run(tension, stiffness, pressure,
                kdev, steps, ss_flag, ss_min, ss_max, 1.0);
        ims_stat_snake_run(tension, stiffness, pressure,
                kdev, 4, ss_flag, ss_min, ss_max, 0.25);
        }
        else if(rigidity_mode == RUN_RIGID)
        {
        ims_stat_snake_trans(tension, stiffness, pressure,
                kdev, steps, 1.0);
        ims_stat_snake_trans(tension, stiffness, pressure,
                kdev, 4, 0.25);
        }
    }
}
double aivru_snake_scale_get ( )

Definition at line 143 of file covira.c.

{
    return(ims_scale_get());
}
void aivru_snake_scale_set ( double  newscale)

Definition at line 151 of file covira.c.

{
    ims_scale_set(newscale);
}
double aivru_snake_smoothness_get ( )

Definition at line 178 of file covira.c.

{
    return(smoothness);
}
void aivru_snake_smoothness_set ( double  newsmoothness)

Definition at line 186 of file covira.c.

{
    smoothness = newsmoothness;
    ims_pressure_set(1.0);
    ims_alpha_set(smoothness/50.0);
    ims_beta_set(smoothness/100.0);
}
void aivru_snake_stats_compute ( double *  mean,
double *  dev 
)
int aivru_snake_steps_get ( )

Definition at line 249 of file covira.c.

{
    return(steps);
}
void aivru_snake_steps_set ( int  newsteps)

Definition at line 257 of file covira.c.

{
    steps = newsteps;
}
int aivru_snake_transfer ( int  source_slice,
int  dest_slice 
)

Definition at line 400 of file covira.c.

{
    ims_z_set(source_slice);
    ims_voi_mark();
    ims_z_set(dest_slice);
    ims_voi_import();
    return(1);
}
void aivru_voi_set ( aivru_snake_slice_info sinfo,
int  size 
)

Definition at line 349 of file covira.c.

{
    int i;
    for(i = 0; i < size; i++)
    {
        ims_z_set(sinfo[i].zCoordinate);
        if(sinfo[i].pString != NULL)
            ims_string_set(sinfo[i].pString);
    }
}
Imrect* canny_pot ( Imrect im,
double  sigma 
)

Definition at line 51 of file pots.c.

{
    Imrect *pot, *im1;

    if (im == NULL)
        return (NULL);
    im = imf_lsf_smooth(im, sigma);
    im1 = imf_sqrgrad(im);
    im_free(im);
    pot = imf_minus(im1);
    im_free(im1);
    imf_scale_inplace(pot, 0.0, 255.0);
    return (pot);
}
Imrect* canny_window_pot ( Imrect im,
double  sigma,
double  l,
double  w 
)

Definition at line 75 of file pots.c.

Referenced by ims_pot_get().

{
    Imrect *pot, *im1, *im2;
    Imregion *roi;
    int x, y;
    if (im == NULL)
        return (NULL);
    im1 = imf_lsf_smooth(im, sigma);
    im2 = imf_sqrgrad(im1); im_free(im1);
    pot = imf_minus(im2); im_free(im2);
    roi = pot->region;
    for(x = roi->lx; x < roi->ux; x++)
        for(y = roi->ly; y < roi->uy; y++)
        {
            double g;
            IM_PIX_GET(im, y, x, g);
            if(g < l-w/2 || g > l+w/2)
                IM_PIX_SET(pot, y, x, 0);
        }
    imf_scale_inplace(pot, 0.0, 255.0);
    return (pot);
}

Here is the caller graph for this function:

void create_front_display ( void  )

Definition at line 142 of file front.c.

Referenced by main().

Here is the caller graph for this function:

void create_sagit_display ( void  )

Definition at line 146 of file sagit.c.

Referenced by main().

Here is the caller graph for this function:

void create_trans_display ( void  )

Definition at line 104 of file trans.c.

Referenced by main().

Here is the caller graph for this function:

void create_vis3d_display ( void  )
void create_work_display ( void  )

Definition at line 188 of file work.c.

Referenced by main().

Here is the caller graph for this function:

Imrect* dark_pot ( Imrect im,
double  sigma 
)

Definition at line 101 of file pots.c.

{
    Imrect *pot;

    if (im == NULL)
        return (NULL);

    pot = imf_gauss(im, sigma, 0.001);
    imf_scale_inplace(pot, 0.0, 255.0);
    return (pot);
}
Bool front_changed ( void  )

Definition at line 30 of file front.c.

Referenced by redraw_all().

{
    if (ims_y_get() == yold)
        return (false);
    else
        return (true);
}

Here is the caller graph for this function:

Tv_mouse front_cursor_mouse ( void  )
Tv* front_tv_get ( void  )

Definition at line 16 of file front.c.

Referenced by cursor_proc(), load_block_file_proc(), load_dicom_files_proc(), load_nema_files_proc(), redraw_all(), and tv_choice_proc().

{
    return front_tv;
}

Here is the caller graph for this function:

void front_tv_set ( Tv tv)

Definition at line 21 of file front.c.

{
    front_tv = tv;
}
void hrs_solve ( int  n,
double *  a,
double *  b,
double *  c,
double *  y 
)

Definition at line 81 of file bspline.c.

Referenced by spline_interpolate().

{
    static int nlast = -1;
    static double *l=NULL, *m=NULL, *k=NULL, *e=NULL, *f=NULL;
    if(n != nlast)
    {
/* unstable freeing fixed NAT 27/2/2000 */
        if (l!=NULL) tvector_free(l, 0, double);
        if (m!=NULL) tvector_free(m, 0, double);
        if (k!=NULL) tvector_free(k, 0, double);
        if (e!=NULL) tvector_free(e, 0, double);
        if (f!=NULL) tvector_free(f, 0, double);
        l = tvector_alloc(0, n, double);
        m = tvector_alloc(0, n, double);
        k = tvector_alloc(0, n, double);
        e = tvector_alloc(0, n, double);
        f = tvector_alloc(0, n, double);
    }
    hrs_tridiag(n, a, b, c, l, m, k, e, f);
    hrs_fsubst(n, l, m, e, y);
    hrs_bsubst(n, k, f, y);
    nlast = n;
}

Here is the caller graph for this function:

Vec2 im_grad_vec2 ( Imrect im,
Vec2  p 
)

Definition at line 15 of file pots.c.

Referenced by snake_gradient_forces().

{
    double gx, gy;
    double x = vec2_x(p);
    double y = vec2_y(p);
    gx = 0.5 * (im_sub_pixf(im, y, x + 1.0) - im_sub_pixf(im, y, x - 1.0));
    gy = 0.5 * (im_sub_pixf(im, y + 1.0, x) - im_sub_pixf(im, y - 1.0, x));
    return (vec2(gx, gy));
}

Here is the caller graph for this function:

Mat2 im_hess_mat2 ( Imrect im,
Vec2  p 
)

Definition at line 28 of file pots.c.

Referenced by snake_hessian_forces().

{
    double ixx, ixy, iyy;
    double x = vec2_x(p);
    double y = vec2_y(p);

    ixx = 0.5 * (im_sub_pixf(im, y, x + 1)
                 - 2.0 * im_sub_pixf(im, y, x)
                 + im_sub_pixf(im, y, x - 1));
    iyy = 0.5 * (im_sub_pixf(im, y + 1, x)
                 - 2.0 * im_sub_pixf(im, y, x)
                 + im_sub_pixf(im, y - 1, x));
    ixy = 0.25 * (im_sub_pixf(im, y + 1, x + 1)
                  - im_sub_pixf(im, y + 1, x - 1)
                  - im_sub_pixf(im, y - 1, x + 1)
                  + im_sub_pixf(im, y - 1, x - 1));
    return (mat2(ixx, ixy, ixy, iyy));
}

Here is the caller graph for this function:

void ims_all_snakes_draw ( Tv tv)

Definition at line 103 of file ims_draw.c.

Referenced by work_fulldraw().

Here is the caller graph for this function:

void ims_all_splines_draw ( Tv tv)

Definition at line 88 of file ims_draw.c.

Referenced by work_fulldraw().

Here is the caller graph for this function:

void ims_all_strings_draw ( Tv tv)

Definition at line 118 of file ims_draw.c.

Referenced by work_fulldraw().

Here is the caller graph for this function:

void ims_all_strings_draw3 ( Tv tv)

Definition at line 176 of file ims_draw.c.

Referenced by vis3d_fulldraw().

Here is the caller graph for this function:

void ims_all_strings_front_draw3 ( Tv tv)

Definition at line 268 of file ims_draw.c.

Referenced by front_fulldraw().

Here is the caller graph for this function:

void ims_all_strings_sagit_draw3 ( Tv tv)

Definition at line 229 of file ims_draw.c.

Referenced by sagit_fulldraw().

Here is the caller graph for this function:

double ims_all_vois_area ( )

Definition at line 56 of file ims_draw.c.

References ims, ims_imstack_get(), ims_string_get(), ims_z_get(), ims_z_set(), imstack::lz, NULL, str2_area(), total, and zold.

Referenced by print_voi_proc().

{
    Imstack *ims = ims_imstack_get();
    Tstring *string;
    int z, zold;
    double total=0.0;

    if (ims == NULL)
        return(0.0);

    zold = ims_z_get();

    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        string = ims_string_get();
        if (string!=NULL) total += str2_area(string);
    }
    ims_z_set(zold);
    return(total);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ims_all_vois_draw ( Tv tv,
void(*)()  func 
)

Definition at line 39 of file ims_draw.c.

Referenced by ims_all_snakes_draw(), ims_all_splines_draw(), ims_all_strings_draw(), ims_all_strings_draw3(), ims_all_strings_front_draw3(), and ims_all_strings_sagit_draw3().

{
    int i;
    if (ims_imstack_get() == NULL)
        return;
    oldvoi = ims_nvoi_get();
    tv_save_draw(tv);
    for (i = 0; i < NVOI; i++)
    {
        tv_color_set(tv, magenta+i);
        ims_nvoi_set(i);
        func(tv);
    }
    ims_nvoi_set(oldvoi);
    tv_save_draw(tv);
}

Here is the caller graph for this function:

double ims_alpha_get ( void  )

Definition at line 87 of file ims_params.c.

Referenced by aivru_snake_run(), snake_param_proc(), snake_run_all_proc(), stat_snake_run_proc(), and stat_snake_trans_proc().

{
    return(alpha);
}

Here is the caller graph for this function:

void ims_alpha_set ( double  newalpha)

Definition at line 95 of file ims_params.c.

Referenced by aivru_snake_smoothness_set(), and snake_param_proc().

{
    alpha = newalpha;
}

Here is the caller graph for this function:

double ims_asnake_get ( void  )

Definition at line 43 of file ims_params.c.

Referenced by snake_param_proc().

{
    return (asnake);
}

Here is the caller graph for this function:

void ims_asnake_set ( double  newasnake)

Definition at line 51 of file ims_params.c.

Referenced by snake_param_proc().

{
    int i, z, zold;
    Imstack *ims = ims_imstack_get();
    if (ims == NULL)
        return;
    zold = ims_z_get();
    asnake = newasnake;
    for (z = ims->lz; z < ims->uz; z++)
    {
        Slice *slice = ims->slice[z];
        ims_z_set(z);
        ims_string_get();
        ims_string_changed();
        for (i = 0; i < NVOI; i++)
            if (slice->voi[i] != NULL)
                slice->voi[i]->asnake = asnake;
    }
    ims_z_set(zold);
}

Here is the caller graph for this function:

double ims_beta_get ( void  )

Definition at line 103 of file ims_params.c.

Referenced by aivru_snake_run(), snake_param_proc(), snake_run_all_proc(), stat_snake_run_proc(), and stat_snake_trans_proc().

{
    return(beta);
}

Here is the caller graph for this function:

void ims_beta_set ( double  newbeta)

Definition at line 111 of file ims_params.c.

Referenced by aivru_snake_smoothness_set(), and snake_param_proc().

{
    beta = newbeta;
}

Here is the caller graph for this function:

void ims_bottom ( void  )

Definition at line 365 of file ims.c.

Referenced by bottom_proc().

{
    if (ims != NULL)
        ims->z = ims->uz - 1;
}

Here is the caller graph for this function:

void ims_box_draw3 ( Tv tv,
double  s 
)

Definition at line 312 of file ims_draw.c.

{
    Imstack *ims = ims_imstack_get();
    Vec3 p1, p2, p3, p4;
    Vec3 q1, q2, q3, q4;
    Vec3 c;
    double lx, ly, lz;
    double ux, uy, uz;

    if (ims == NULL)
        return;
    lx = ims->lx;
    ly = ims->ly;
    lz = imstack_zscaled(ims, ims->lz - 1);
    ux = ims->ux;
    uy = ims->uy;
    uz = imstack_zscaled(ims, ims->uz);

    tv_save_draw(tv);
    tv_color_set(tv, gold);
    p1 = vec3(lx, ly, lz);
    p2 = vec3(ux, ly, lz);
    p3 = vec3(ux, uy, lz);
    p4 = vec3(lx, uy, lz);
    q1 = vec3(lx, ly, uz);
    q2 = vec3(ux, ly, uz);
    q3 = vec3(ux, uy, uz);
    q4 = vec3(lx, uy, uz);
    c = vec3_midpoint(p1, q3);

    face(tv, p1, p2, p3, p4, c, s);
    face(tv, q1, q2, q3, q4, c, s);
    face(tv, p1, p2, q2, q1, c, s);
    face(tv, p2, p3, q3, q2, c, s);
    face(tv, p3, p4, q4, q3, c, s);
    face(tv, p4, p1, q1, q4, c, s);
    tv_reset_draw(tv);
}
void ims_camera2 ( Tv tv)

Definition at line 362 of file ims_draw.c.

Referenced by load_block_file_proc(), load_dicom_files_proc(), load_nema_files_proc(), and work_init().

Here is the caller graph for this function:

Bool ims_dofree_get ( void  )

Definition at line 25 of file ims_params.c.

Referenced by slice_image_set().

{
    return(dofree);
}

Here is the caller graph for this function:

void ims_dofree_set ( Bool  newdofree)

Definition at line 33 of file ims_params.c.

Referenced by aivru_image_set().

{
    dofree = newdofree;
}

Here is the caller graph for this function:

void ims_down ( void  )

Definition at line 347 of file ims.c.

Referenced by down_proc(), and voi_down_proc().

{
    if (ims != NULL)
        ims->z = MIN(ims->z + 1, ims->uz - 1);
}

Here is the caller graph for this function:

Spline2* ims_fixed_spline_get ( int  n)

Definition at line 531 of file ims.c.

Referenced by imstack_uniform_splines().

{
    if (ims == NULL)
        return NULL;
    else
        return voi_fixed_spline_get(VOI(ims), n);
}

Here is the caller graph for this function:

void ims_free ( )

Definition at line 1011 of file ims.c.

Referenced by aivru_quit().

Here is the caller graph for this function:

void ims_image_draw ( Tv tv)

Definition at line 369 of file ims_draw.c.

Referenced by work_backdraw().

{
    Imstack *ims = ims_imstack_get();
    if (ims != NULL)
        slice_image_draw(tv, SLICE(ims));
}

Here is the caller graph for this function:

Imrect* ims_image_get ( void  )

Definition at line 401 of file ims.c.

Referenced by ims_stat_snake_init(), ims_stat_snake_run(), ims_stat_snake_trans(), stat_snake_init_proc(), and trans_backdraw().

{
    if (ims == NULL)
        return NULL;
    else
        return slice_image_get(SLICE(ims));
}

Here is the caller graph for this function:

void ims_image_set ( Imrect im)

Definition at line 412 of file ims.c.

Referenced by aivru_image_set(), load_block_file_proc(), load_dicom_files_proc(), and load_nema_files_proc().

{
    Slice *slice;
    Imregion *roi;

    if (ims != NULL)
    {
        slice = SLICE(ims);
        slice_image_set(slice, im);

        if (im != NULL)
        {
            roi = im->region;
            ims->lx = MIN(ims->lx, roi->lx);
            ims->ux = MAX(ims->ux, roi->ux);
            ims->ly = MIN(ims->ly, roi->ly);
            ims->uy = MAX(ims->uy, roi->uy);
        }
    }
}

Here is the caller graph for this function:

Imstack* ims_imstack_get ( void  )
void ims_imstack_set ( Imstack new_imstack)

Definition at line 67 of file ims.c.

{
    imstack_free(ims);
    ims = new_imstack;
}
void ims_init_cursor ( void  )

Definition at line 206 of file ims.c.

Referenced by load_block_file_proc(), load_dicom_files_proc(), and load_nema_files_proc().

{
    if (ims == NULL)
        return;
    ims->x = (ims->lx + ims->ux) / 2;
    ims->y = (ims->ly + ims->uy) / 2;
    ims->z = (ims->lz + ims->uz) / 2;
}

Here is the caller graph for this function:

Bool ims_interpolate_all_splines_between ( int  lz,
int  uz 
)

after interpolation save splines

Definition at line 969 of file ims.c.

Referenced by aivru_multi_snake_interpolate_between(), ims_tube_interp(), and interp_all_proc().

{
    Spline2 **spline;
    int oldz, z;

    if (ims == NULL)
        return(false);
    imstack_uniform_splines(ims);
    if(lz >= uz)
        return(false);

    oldz = ims_z_get();

    /* interpolate all null internal splines */
    spline = tvector_alloc(lz, uz, Spline2 *);
    for (z = lz; z < uz; z++)
    {
        ims_z_set(z);
        if (ims_spline_get() == NULL)
            spline[z] = imstack_interpolate_spline(ims, (double) z);
    }

    /** after interpolation save splines **/
    for (z = lz; z < uz; z++)
    {
        ims_z_set(z);
        if (ims_spline_get() == NULL)
        {
            ims_spline_set(spline[z]);
            ims_spline_changed();
        }
    }

    tvector_free(spline, lz, Spline2 *);

    ims_z_set(oldz);
    return(true);
}

Here is the caller graph for this function:

void ims_interpolate_spline ( void  )

Definition at line 951 of file ims.c.

Referenced by aivru_multi_snake_interpolate_one(), and interp_proc().

{
    double z;
 
    if (ims != NULL)
    {
        Spline2 *spline;
        z = ims_z_get();
        imstack_uniform_splines(ims);
        spline = imstack_interpolate_spline(ims, z);
        ims_spline_set(spline);
    }
}

Here is the caller graph for this function:

double ims_level_get ( void  )

Definition at line 152 of file ims_params.c.

Referenced by aivru_snake_image_level_get(), ims_pot_get(), and snake_param_proc().

{
    return(level);
}

Here is the caller graph for this function:

void ims_level_set ( double  newlevel)

Definition at line 160 of file ims_params.c.

Referenced by aivru_snake_image_level_set(), and snake_param_proc().

{
    level = newlevel;
    ims_pots_free();
}

Here is the caller graph for this function:

void ims_loop_draw ( Tv tv)

Definition at line 383 of file ims_draw.c.

Referenced by loop_proc().

{
    int z, oldz;
    void timer_handler_install(long int length);
    Imstack *ims = ims_imstack_get();

    if (ims == NULL)
        return;
    oldz = ims_z_get();
    tv_start_movie(tv);
    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        tv_free_background(tv);
        tv_repaint(tv);
        tv_make_movie(tv);
    }
    timer_handler_install(500000); /* NAT 27/2/2000 */
    tv_loop_movie(tv, 4);
    timer_handler_uninstall();
    ims_z_set(oldz);
}

Here is the caller graph for this function:

int ims_lz_get ( void  )

Definition at line 292 of file ims.c.

Referenced by ims_pots_free(), ims_sagit_tube_set(), ims_string_tube_set(), interp_all_proc(), snake_auto_proc(), stat_snake_auto_proc(), and voi_empty_all_proc().

{
    if (ims == NULL)
        return -1;
    else
        return ims->lz;
}

Here is the caller graph for this function:

void ims_make ( Vartype  vtype,
int  lz,
int  uz,
double  zscale 
)

Definition at line 18 of file ims.c.

References imstack_free(), and imstack_make().

Referenced by aivru_image_set(), load_block_file_proc(), load_dicom_files_proc(), and load_nema_files_proc().

{
    imstack_free(ims);
    ims = imstack_make(vtype, lz, uz, zscale);
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ims_nspline_get ( void  )

Definition at line 75 of file ims_params.c.

Referenced by imstack_uniform_splines().

{
    Spline2 *spline;
    Imstack *ims = ims_imstack_get();
    if (ims == NULL || (spline = VOI(ims)->spline) == NULL)
        return(0);
    return (spline->n);
}

Here is the caller graph for this function:

int ims_nvoi_get ( )

Definition at line 76 of file ims.c.

Referenced by ims_all_vois_draw(), ims_snake_draw(), ims_spline_draw(), ims_string_draw(), ims_strings_draw3(), print_voi_proc(), and read_voi_proc().

{
    if (ims == NULL)
        return(-1);
    return(ims->nvoi);
}

Here is the caller graph for this function:

void ims_nvoi_set ( int  nvoi)

Definition at line 86 of file ims.c.

Referenced by im_nvoi_choice_proc(), and ims_all_vois_draw().

{
    if (ims == NULL)
        return;
    ims->nvoi = nvoi;
}

Here is the caller graph for this function:

void ims_pot_draw ( Tv tv)

Definition at line 376 of file ims_draw.c.

Referenced by work_backdraw().

{
    Imstack *ims = ims_imstack_get();
    if (ims != NULL)
        slice_pot_draw(tv, SLICE(ims));
}

Here is the caller graph for this function:

Imrect* ims_pot_get ( void  )

Definition at line 436 of file ims.c.

Referenced by aivru_snake_run(), ims_pots_get(), ims_snake_run_all(), ims_snake_run_rot(), ims_snake_run_rts(), ims_snake_run_scale(), ims_snake_run_trans(), snake_edge_proc(), and snake_force_proc().

{
    Imrect *pot;
    Slice *slice;
    double s, l, w;
    if (ims == NULL)
        return NULL;
    slice = SLICE(ims);
    pot = slice_pot_get(slice);
    if(pot != NULL || slice->im == NULL)
        return(pot);
    s = ims_scale_get();
    l = ims_level_get();
    w = ims_window_get();
    pot = canny_window_pot(slice->im, s, l, w);
    slice_pot_set(slice, pot);
    return(pot);
}

Here is the caller graph for this function:

void ims_pot_set ( Imrect pot)

Definition at line 458 of file ims.c.

Referenced by ims_pots_free().

{
    if (ims == NULL)
        return;
    slice_pot_set(SLICE(ims), pot);
}

Here is the caller graph for this function:

void ims_pots_free ( )

Definition at line 468 of file ims.c.

Referenced by ims_level_set(), ims_scale_set(), and ims_window_set().

{
    int z, lz, uz, oldz;
    if(ims == NULL)
        return;
    oldz = ims_z_get();
    lz = ims_lz_get();
    uz = ims_uz_get();
    for(z = lz; z < uz; z++)
    {
        ims_z_set(z);
        ims_pot_set(NULL);
    }
    ims_z_set(oldz);
}

Here is the caller graph for this function:

void ims_pots_get ( void  )

Definition at line 661 of file ims.c.

Referenced by main().

{
    int z, zold;
    if(ims == NULL)
        return;
    zold = ims_z_get();
    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        ims_pot_get();
    }
    ims_z_set(zold);
}

Here is the caller graph for this function:

double ims_pressure_get ( void  )

Definition at line 119 of file ims_params.c.

Referenced by aivru_snake_pressure_get(), aivru_snake_run(), snake_param_proc(), stat_snake_run_proc(), and stat_snake_trans_proc().

{
    return(pressure);
}

Here is the caller graph for this function:

void ims_pressure_set ( double  newpressure)

Definition at line 127 of file ims_params.c.

Referenced by aivru_snake_pressure_set(), aivru_snake_smoothness_set(), and snake_param_proc().

{
    pressure = newpressure;
}

Here is the caller graph for this function:

void ims_rescale_images ( double  gamma,
double  low,
double  high 
)

Definition at line 46 of file ims.c.

Referenced by range_scale_proc().

{
    int z;
    for (z = ims->lz; z < ims->uz; z++)
    {
        Imrect *im = ims->slice[z]->im;
        im_gamma_scale_range_inplace(im, gamma, low, high, 0.0, 255.0, 0.0, 255.0);
    }
}

Here is the caller graph for this function:

void ims_reverse_image_order ( )

Definition at line 27 of file ims.c.

Referenced by load_block_file_proc(), load_dicom_files_proc(), and load_nema_files_proc().

{
    int z, lz, uz;
    Imrect **temp;
    lz = ims->lz;
    uz = ims->uz;
    temp = tvector_alloc(lz, uz, Imrect *);
    for (z = lz; z < uz; z++)
        temp[z] = ims->slice[z]->im;
    for (z = lz; z < uz; z++)
        ims->slice[z]->im = temp[uz - 1 + lz - z];
    tvector_free(temp, lz, Imrect *);
}

Here is the caller graph for this function:

Imregion* ims_roi_get ( void  )

Definition at line 594 of file ims.c.

Referenced by ims_camera2().

{
    Imregion *roi;

    if (ims == NULL)
        return NULL;
    else
    {
        roi = roi_alloc(ims->lx, ims->ly, ims->ux, ims->uy);
        return roi;
    }
}

Here is the caller graph for this function:

void ims_sagit_tube_draw ( Tv tv)

Definition at line 14 of file ims_draw.c.

Referenced by sagit_fulldraw().

{
    int z;
    Tube *tube;
    Imstack *ims = ims_imstack_get();
    if(ims == NULL)
        return;
    if((tube = ims->tube) == NULL)
        return;
    tv_color_set(tv, red);
    for(z = tube->z1; z < tube->z2-1; z++)
    {
        double y1 = vec2_y(tube->p1[z]);
        double y2 = vec2_y(tube->p1[z+1]);
        tv_line2(tv, vec2(y1, z+0.5), vec2(y2, z+1.5));
    }
    tv_color_set(tv, red);
    for(z = tube->z1; z < tube->z2-1; z++)
    {
        double y1 = vec2_y(tube->p2[z]);
        double y2 = vec2_y(tube->p2[z+1]);
        tv_line2(tv, vec2(y1, z+0.5), vec2(y2, z+1.5));
    }
}

Here is the caller graph for this function:

void ims_sagit_tube_set ( Spline2 spline1,
Spline2 spline2,
double  x 
)

Definition at line 1154 of file ims.c.

Referenced by spline_save_tube().

{
    Vec2 p1, p2;
    int z, lz, uz, z1, z2;
    Spline *zspline;
    Tube *tube;

    if (spline1 == NULL || spline2 == NULL)
        return;
    lz = ims_lz_get();
    uz = ims_uz_get();

    p1 = spline2_eval(spline1, 0);
    p2 = spline2_eval(spline1, spline1->n - 1.0);
    z1 = ROUND(vec2_y(p1));
    z2 = ROUND(vec2_y(p2)) + 1;
    if (z1 > z2)
        SWAP(int, z1, z2);
    if (z1 < lz)
        z1 = lz;
    if (z2 > uz)
        z2 = uz;

    lz = z1; uz = z2;
    p1 = spline2_eval(spline2, 0);
    p2 = spline2_eval(spline2, spline2->n - 1.0);
    z1 = ROUND(vec2_y(p1));
    z2 = ROUND(vec2_y(p2)) + 1;
    if (z1 > z2)
        SWAP(int, z1, z2);
    if (z1 < lz)
        z1 = lz;
    if (z2 > uz)
        z2 = uz;

    tube = tube_make(z1, z2);

    zspline = spline1->y;
    for (z = z1; z < z2; z++)
    {
        double t;
        Vec2 p, q;
        t = spline_param(zspline, z);
        p = spline2_eval(spline1, t);
        q = vec2(x, vec2_x(p));
        tube->p1[z] = q;
    }
    zspline = spline2->y;
    for (z = z1; z < z2; z++)
    {
        double t;
        Vec2 p, q;
        t = spline_param(zspline, z);
        p = spline2_eval(spline2, t);
        q = vec2(x, vec2_x(p));
        tube->p2[z] = q;
    }
    ims_tube_set(tube);
}

Here is the caller graph for this function:

double ims_scale_get ( void  )

Definition at line 135 of file ims_params.c.

Referenced by aivru_snake_scale_get(), ims_pot_get(), and snake_param_proc().

{
    return(scale);
}

Here is the caller graph for this function:

void ims_scale_set ( double  newscale)

Definition at line 143 of file ims_params.c.

Referenced by aivru_snake_scale_set(), and snake_param_proc().

{
    scale = newscale;
    ims_pots_free();
}

Here is the caller graph for this function:

void ims_snake_changed ( void  )
void ims_snake_draw ( Tv tv)
void ims_snake_forcelaw_set ( void(*)()  forcelaw)

Definition at line 644 of file ims.c.

{
    int i, z;
    if (ims == NULL)
        return;
    for (z = ims->lz; z < ims->uz; z++)
    {
        Slice *slice = ims->slice[z];
        for (i = 0; i < NVOI; i++)
            if (slice->voi[i]->snake != NULL)
                slice->voi[i]->snake->forcelaw = forcelaw;
    }
}
Snake* ims_snake_get ( void  )
double ims_snake_run_all ( double  alpha,
double  beta,
int  steps 
)

Definition at line 759 of file ims.c.

Referenced by snake_run_all_proc().

{
    double d;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_pot_get();

    if (ims == NULL || snake==NULL || im==NULL) /* NAT 27/2/2000 */
        return 0.0;
    else
    {
        d = snake_run_all(snake, im, alpha, beta, steps);
        ims_snake_changed();
        return d;
    }
}

Here is the caller graph for this function:

double ims_snake_run_rot ( int  steps)

Definition at line 699 of file ims.c.

Referenced by snake_run_rot_proc().

{
    double d;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_pot_get();

    if (ims == NULL || snake==NULL || im==NULL) /* NAT 27/2/2000 */
        return 0.0;
    else
    {
        d = snake_run_rot(snake, im, steps);
        ims_snake_changed();
        return d;
    }
}

Here is the caller graph for this function:

double ims_snake_run_rts ( int  steps)

Definition at line 739 of file ims.c.

Referenced by snake_run_rts_proc().

{
    double d;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_pot_get();

    if (ims == NULL || snake==NULL || im==NULL) /* NAT 27/2/2000 */
        return 0.0;
    else
    {
        d = snake_run_rts(snake, im, steps);
        ims_snake_changed();
        return d;
    }
}

Here is the caller graph for this function:

double ims_snake_run_scale ( int  steps)

Definition at line 719 of file ims.c.

Referenced by snake_run_scale_proc().

{
    double d;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_pot_get();

    if (ims == NULL || snake==NULL || im==NULL) /* NAT 27/2/2000 */
        return 0.0;
    else
    {
        d = snake_run_scale(snake, im, steps);
        ims_snake_changed();
        return d;
    }
}

Here is the caller graph for this function:

double ims_snake_run_trans ( int  steps)

Definition at line 679 of file ims.c.

Referenced by snake_run_trans_proc().

{
    double d;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_pot_get();

    if (ims == NULL || snake==NULL || im==NULL) /* NAT 27/2/2000 */
        return 0.0;
    else
    {
        d = snake_run_trans(snake, im, steps);
        ims_snake_changed();
        return d;
    }
}

Here is the caller graph for this function:

void ims_snake_set ( Snake snake)

Definition at line 575 of file ims.c.

Referenced by ims_stat_snake_run(), and ims_stat_snake_trans().

{
    if (ims != NULL)
        voi_snake_set(VOI(ims), snake);
}

Here is the caller graph for this function:

void ims_spline_changed ( void  )

Definition at line 552 of file ims.c.

Referenced by ims_interpolate_all_splines_between(), ims_tube_interp(), ims_voi_read(), spline_insert_point(), spline_remove_point(), and spline_replace_up().

Here is the caller graph for this function:

void ims_spline_draw ( Tv tv)

Definition at line 78 of file ims_draw.c.

Referenced by ims_all_splines_draw().

{
    int color;
    color = tv_get_color(tv);
    if (ims_nvoi_get() == oldvoi)
        tv_color_set(tv,red);
    spline_draw(tv, ims_spline_get());
    tv_color_set(tv,color);
}

Here is the caller graph for this function:

Spline2* ims_spline_get ( void  )
void ims_spline_set ( Spline2 spline)

Definition at line 542 of file ims.c.

Referenced by ims_interpolate_all_splines_between(), ims_interpolate_spline(), ims_tube_interp(), ims_voi_read(), and spline_save_periodic().

{
    if (ims != NULL)
        voi_spline_set(VOI(ims), spline);
}

Here is the caller graph for this function:

Splinesurf3* ims_splinesurf3_make ( )

Definition at line 893 of file ims.c.

Referenced by add_surf_proc(), and aivru_get_voi_surface().

{
    int z, zold, lz, uz, u, v, nu, nv;
    void *surf;
    Spline2 *spline;
    Vec3 **data;

    if (ims == NULL)
        return (NULL);
    imstack_uniform_splines(ims);
    zold = ims_z_get();

    spline = NULL;
    for (z = ims->lz; z < ims->uz && spline == NULL; z++)
    {
        ims_z_set(z);
        spline = ims_spline_get();
    }
    lz = z - 1;
    spline = NULL;
    for (z = ims->uz - 1; z >= ims->lz && spline == NULL; z--)
    {
        ims_z_set(z);
        spline = ims_spline_get();
    }
    uz = z + 2;

    if (lz >= uz)
        return (NULL);
    ims_z_set(lz);
    spline = ims_spline_get();
    nu = spline->n;
    nv = uz - lz;
    surf = splinesurf3_make(SPLINE_PERIODIC, SPLINE_NATURAL, nu, nv);
    data = tarray_alloc(0, 0, nu, nv, Vec3);

    for (z = lz; z < uz; z++)
    {
        v = z-lz;
        ims_z_set(z);
        spline = ims_spline_get();
        for (u = 0; u < nu; u++)
        {
            Vec2 p = spline2_eval(spline, u);
            data[u][v] = vec3(vec3_x(p), vec3_y(p), ims_zscaled_get());
        }
    }
    splinesurf3_interpolate(surf, data);
    tarray_free(data, 0, 0, nu, nv, Vec3);

    ims_z_set(zold);
    return (surf);
}

Here is the caller graph for this function:

void ims_stat_snake_init ( )

Definition at line 799 of file ims.c.

Referenced by aivru_snake_stats_compute(), and stat_snake_init_proc().

{
    int n;
    Snake *snake = ims_snake_get();
    Imrect *im = ims_image_get();
    Stats *stats;
    void *data[2];

    if (!snake || !im)
        return;
    stats = stats_make();
    data[0] = stats;
    data[1] = im;
    apply_inside_poly(snake->n, snake->p, im->width, im->height, stats_scan, data);
    if ((n = stats->n) > 1)
    {
        stats->mean = stats->tot1 / n;
        stats->var = (stats->tot2 - sqr(stats->tot1) / n) / (n - 1);
        stats->sd = sqrt(stats->var);
    }
    ims_stats_set(stats);
    printf("N: %d\tMean: %.3f\tSD: %.3f\n", stats->n, stats->mean, stats->sd);
}

Here is the caller graph for this function:

void ims_stat_snake_run ( double  alpha,
double  beta,
double  pressure,
double  k_s_d,
int  steps,
int  flag,
int  min_gap,
int  max_gap,
double  dt 
)

Definition at line 832 of file ims.c.

Referenced by aivru_snake_run(), and stat_snake_run_proc().

{
    Stats *stats = ims_stats_get();
    Imrect *im = ims_image_get(), *accum;
    Tstring *ss = ss_from_snake(ims_snake_get());
    int i;

    if (ss == NULL || im == NULL)
        return;

    accum = accum_make(im, ss);
    if(flag)
    {
        stat_snake_mingap(ss, accum, min_gap);
        stat_snake_maxgap(ss, accum, min_gap, max_gap);
    }
    else
        stat_snake_mingap(ss, accum, 1);
    for (i = 0; i < steps; i++)
    {
        stat_snake_step(ss, accum, im, stats, alpha, beta, pressure, k_s_d, dt);
        if(flag)
        {
            stat_snake_mingap(ss, accum, min_gap);
            stat_snake_maxgap(ss, accum, min_gap, max_gap);
        }
    }
    ims_snake_set(ss_to_snake(ss)); ss_free(ss);
    ims_snake_changed();
    im_free(accum);
}

Here is the caller graph for this function:

void ims_stat_snake_trans ( double  alpha,
double  beta,
double  pressure,
double  k_s_d,
int  steps,
double  dt 
)

Definition at line 874 of file ims.c.

Referenced by aivru_snake_run(), and stat_snake_trans_proc().

{
    Stats *stats = ims_stats_get();
    Imrect *im = ims_image_get();
    Tstring *ss = ss_from_snake(ims_snake_get());
    int i;
    if (ss == NULL || im == NULL)
        return;
    for (i = 0; i < steps; i++)
        stat_snake_trans(ss, im, stats, alpha, beta, pressure, k_s_d, dt);
    ims_snake_set(ss_to_snake(ss)); ss_free(ss);
    ims_snake_changed();
}

Here is the caller graph for this function:

Stats* ims_stats_get ( )

Definition at line 227 of file ims_params.c.

Referenced by ims_stat_snake_run(), and ims_stat_snake_trans().

{
    return(stats);
}

Here is the caller graph for this function:

double ims_stats_mean_get ( )

Definition at line 186 of file ims_params.c.

Referenced by aivru_snake_region_level_get().

{
    if(stats == NULL)
        return(0.0);
    return(stats->mean);
}

Here is the caller graph for this function:

void ims_stats_mean_set ( double  mean)

Definition at line 196 of file ims_params.c.

Referenced by aivru_snake_region_level_set().

{
    if(stats == NULL)
      stats = stats_make();
    stats->mean = mean;
}

Here is the caller graph for this function:

void ims_stats_set ( Stats newstats)

Definition at line 235 of file ims_params.c.

Referenced by ims_stat_snake_init().

{
    rfree(stats);
    stats = newstats;
}

Here is the caller graph for this function:

double ims_stats_sigma_get ( )

Definition at line 206 of file ims_params.c.

Referenced by aivru_snake_region_window_get().

{
    if(stats == NULL)
        return(0.0);
    return(stats->sd);
}

Here is the caller graph for this function:

void ims_stats_sigma_set ( double  sigma)

Definition at line 216 of file ims_params.c.

Referenced by aivru_snake_region_window_set().

{
    if(stats == NULL)
      stats = stats_make();
    stats->sd = sigma;
    stats->var = sqr(sigma);
}

Here is the caller graph for this function:

void ims_str2_draw3 ( Tv tv)

Definition at line 123 of file ims_draw.c.

Referenced by ims_strings_draw3().

{
    Imstack *ims = ims_imstack_get();
    if (ims != NULL)
        str2_draw3(tv, ims_string_get(), SLICE(ims)->z);
}

Here is the caller graph for this function:

void ims_string_changed ( void  )

Definition at line 508 of file ims.c.

Referenced by aivru_contour_set(), ims_asnake_set(), imstack_uniform_splines(), and string_end().

Here is the caller graph for this function:

void ims_string_draw ( Tv tv)

Definition at line 108 of file ims_draw.c.

Referenced by ims_all_strings_draw().

{
    int color;
    color = tv_get_color(tv); 
    if (ims_nvoi_get() == oldvoi)
        tv_color_set(tv,red);
    str2_draw(tv, ims_string_get());
    tv_color_set(tv,color);
}

Here is the caller graph for this function:

void ims_string_front_draw3 ( Tv tv)

Definition at line 234 of file ims_draw.c.

Referenced by ims_strings_front_draw3().

Here is the caller graph for this function:

Tstring* ims_string_get ( void  )

Definition at line 487 of file ims.c.

Referenced by aivru_contour_get(), ims_all_vois_area(), ims_asnake_set(), ims_str2_draw3(), ims_string_draw(), ims_string_front_draw3(), ims_string_sagit_draw3(), ims_string_skeldraw3(), and imstack_uniform_splines().

{
    if (ims == NULL)
        return NULL;
    else
        return voi_string_get(VOI(ims));
}

Here is the caller graph for this function:

void ims_string_sagit_draw3 ( Tv tv)

Definition at line 194 of file ims_draw.c.

Referenced by ims_strings_sagit_draw3().

Here is the caller graph for this function:

void ims_string_set ( Tstring string)

Definition at line 498 of file ims.c.

Referenced by aivru_contour_set(), aivru_voi_set(), and string_end().

{
    if (ims != NULL)
        voi_string_set(VOI(ims), string);
}

Here is the caller graph for this function:

void ims_string_skeldraw3 ( Tv tv,
int  space 
)

Definition at line 273 of file ims_draw.c.

Referenced by ims_strings_skeldraw3().

{
    Imstack *ims = ims_imstack_get();
    if (ims != NULL)
        string_skeldraw3(tv, ims_string_get(), SLICE(ims)->z, space);
}

Here is the caller graph for this function:

void ims_string_tube_set ( Tstring str)

Definition at line 1046 of file ims.c.

Referenced by aivru_multi_snake_set_occluding_boundary().

{
    List *a1, *a2, *b1, *b2, *c1, *c2, *ptr;
    int lz, uz, z1, z2;
    Tube *tube;

    if (str == NULL)
        return;
    lz = ims_lz_get();
    uz = ims_uz_get();
    z1 = MAXINT;
    z2 = -MAXINT;
    for(ptr = str->start;; ptr = ptr->next)
    {
        int z = vec3_z(*(Vec3 *)ptr->to);
        if(z1 > z)
        {
            a1 = ptr;
            z1 = z;
        }
        if(z2 < z)
        {
            a2 = ptr;
            z2 = z;
        }
        if(ptr == str->end)
            break;
    }
    z1 = MAX(z1, lz);
    z2 = MIN(z2, uz-1);
    if(z1 == z2)
    {
        ims_tube_set(NULL);
        return;
    }

    for(ptr = a1; ;ptr = ptr->next)
    {
        int z = vec3_z(*(Vec3 *)ptr->to);
        if(z > z1)
        {
            b1 = ptr->last;
            break;
        }
    }
    for(ptr = a1; ;ptr = ptr->last)
    {
        int z = vec3_z(*(Vec3 *)ptr->to);
        if(z > z1)
        {
            c1 = ptr->next;
            break;
        }
    }
    for(ptr = a2; ;ptr = ptr->last)
    {
        int z = vec3_z(*(Vec3 *)ptr->to);
        if(z < z2)
        {
            b2 = ptr->next;
            break;
        }
    }
    for(ptr = a2; ;ptr = ptr->next)
    {
        int z = vec3_z(*(Vec3 *)ptr->to);
        if(z < z2)
        {
            c2 = ptr->last;
            break;
        }
    }
    if(b1 == c1)
    {
        b1 = b1->next;
        c1 = c1->last;
        z1 = vec3_z(*(Vec3 *)b1->to);
    }
    if(b2 == c2)
    {
        b2 = b2->last;
        c2 = c2->next;
        z2 = vec3_z(*(Vec3 *)b2->to);
    }
    tube = tube_make(z1, z2+1);
    for(ptr = b1; ; ptr = ptr->next)
    {
        Vec3 p = *(Vec3 *)ptr->to;
        int z = vec3_z(p);
        tube->p1[z] = vec2(vec3_x(p), vec3_y(p));
        if(ptr == b2)
            break;
    }
    for(ptr = c1; ; ptr = ptr->last)
    {
        Vec3 p = *(Vec3 *)ptr->to;
        int z = vec3_z(p);
        tube->p2[z] = vec2(vec3_x(p), vec3_y(p));
        if(ptr == c2)
            break;
    }
    ims_tube_set(tube);
}

Here is the caller graph for this function:

void ims_strings_draw3 ( Tv tv)

draw furthest first

Definition at line 130 of file ims_draw.c.

Referenced by ims_all_strings_draw3().

{
    int z, zold;
    int color;
    Imstack *ims = ims_imstack_get();

    if (ims == NULL)
        return;

    tv_save_draw(tv);
    zold = ims_z_get();
    color = tv_get_color(tv);

    /** draw furthest first **/
    if (vec3_z(tv->ez3) < 0.0)
    {
        for (z = ims->lz; z < ims->uz; z++)
        {
            ims_z_set(z);
            if (z == zold && ims_nvoi_get() == oldvoi)
            {
                tv_color_set(tv, red);
                ims_str2_draw3(tv);
                tv_color_set(tv, color);
            } else
                ims_str2_draw3(tv);
        }
    } else
    {
        for (z = ims->uz - 1; z >= ims->lz; z--)
        {
            ims_z_set(z);
            if (z == zold && ims_nvoi_get() == oldvoi)
            {
                tv_color_set(tv, red);
                ims_str2_draw3(tv);
                tv_color_set(tv, color);
            } else
                ims_str2_draw3(tv);
        }
    }

    ims_z_set(zold);
    tv_reset_draw(tv);
}

Here is the caller graph for this function:

void ims_strings_front_draw3 ( Tv tv)

Definition at line 241 of file ims_draw.c.

Referenced by ims_all_strings_front_draw3().

{
    int z, zold, color;
    Imstack *ims = ims_imstack_get();

    if (ims == NULL)
        return;

    tv_save_draw(tv);
    tv_set_linewidth(tv, 2);
    zold = ims_z_get();

    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        if (z == zold && color == red)
        {
            tv_color_set(tv, red);
            ims_string_front_draw3(tv); /* NAT 27/2/2000 */
            tv_color_set(tv, magenta);
        } else
            ims_string_front_draw3(tv); /* NAT 27/2/2000 */
    }
    ims_z_set(zold);
    tv_reset_draw(tv);
}

Here is the caller graph for this function:

void ims_strings_sagit_draw3 ( Tv tv)

Definition at line 201 of file ims_draw.c.

Referenced by ims_all_strings_sagit_draw3().

{
    int z, zold, color;
    Imstack *ims = ims_imstack_get();

    if (ims == NULL)
        return;

    tv_save_draw(tv);
    tv_set_linewidth(tv, 2);
    zold = ims_z_get();
    color = tv_color_get(tv);

    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        if (z == zold && color == red)
        {
            tv_color_set(tv, red);
            ims_string_sagit_draw3(tv);
            tv_color_set(tv, magenta);
        } else
            ims_string_sagit_draw3(tv);
    }
    ims_z_set(zold);
    tv_reset_draw(tv);
}

Here is the caller graph for this function:

void ims_strings_skeldraw3 ( Tv tv,
int  space,
int  maxnum 
)

Definition at line 280 of file ims_draw.c.

Referenced by vis3d_skeldraw().

{
    int z, zold, dz;
    Imstack *ims = ims_imstack_get();

    if (ims == NULL)
        return;
    zold = ims_z_get();
    dz = (ims->uz - ims->lz) / (double) maxnum;
    dz = MAX(1.0, dz);
    for (z = ims->lz; z < ims->uz; z += dz)
    {
        ims_z_set(z);
        ims_string_skeldraw3(tv, space);
    }
    ims_z_set(zold);
}

Here is the caller graph for this function:

void ims_top ( void  )

Definition at line 374 of file ims.c.

Referenced by top_proc().

{
    if (ims != NULL)
        ims->z = ims->lz;
}

Here is the caller graph for this function:

void ims_tube_draw ( Tv tv)

Definition at line 351 of file ims_draw.c.

Referenced by work_fulldraw().

{
    Imstack *ims = ims_imstack_get();
    if(ims == NULL || ims->tube == NULL)
        return;
    tv_set_color(tv, red);
    tv_bigdot2(tv, ims->tube->p1[ims->z], 2);
    tv_set_color(tv, green);
    tv_bigdot2(tv, ims->tube->p2[ims->z], 2);
}

Here is the caller graph for this function:

Tube* ims_tube_get ( )

Definition at line 1020 of file ims.c.

Referenced by ims_tube_interp(), and sagit_fulldraw().

{
    if(ims == NULL)
        return(NULL);
    return(ims->tube);
}

Here is the caller graph for this function:

void ims_tube_interp ( )

Definition at line 1236 of file ims.c.

Referenced by aivru_multi_snake_interpolate_tube(), and extrap_tube_proc().

{
    Tube *tube;
    Spline2 *spline;
    Mat2 r;
    Vec2 p1, p2, q1, q2, t;
    double s;
    int z, lz, uz, z1, z2, zold = ims_z_get();
 
    ims_voi_bounds(&lz, &uz);
    ims_interpolate_all_splines_between(lz, uz);

    tube = ims_tube_get();
    if(tube == NULL)
        return;
    z1 = tube->z1;
    z2 = tube->z2;
 
    for(z = lz; z < uz; z++)
    {
        ims_z_set(z);
        q1 = tube->p1[z];
        q2 = tube->p2[z];
        spline = ims_spline_get();
        p1 = spline2_closest(spline, q1);
        p2 = spline2_closest(spline, q2);
        rts_get(p1, p2, q1, q2, &r, &t, &s);
        spline2_rts(spline, r, t, s);
        ims_spline_changed();
    }

    ims_z_set(lz); spline = ims_spline_get();
    for(z = lz-1; z >= z1; z--)
    {
        ims_z_set(z+1); spline = spline2_copy(ims_spline_get());
        ims_z_set(z);
        ims_z_set(z);
        q1 = tube->p1[z];
        q2 = tube->p2[z];
        p1 = spline2_closest(spline, q1);
        p2 = spline2_closest(spline, q2);
        rts_get(p1, p2, q1, q2, &r, &t, &s);
        spline2_rts(spline, r, t, s);
        ims_spline_set(spline2_copy(spline));
        ims_spline_changed();
    }

    for(z = uz-1; z < z2; z++)
    {
        ims_z_set(z-1); spline = spline2_copy(ims_spline_get());
        ims_z_set(z);
        q1 = tube->p1[z];
        q2 = tube->p2[z];
        p1 = spline2_closest(spline, q1);
        p2 = spline2_closest(spline, q2);
        rts_get(p1, p2, q1, q2, &r, &t, &s);
        spline2_rts(spline, r, t, s);
        ims_spline_set(spline);
        ims_spline_changed();
    }

    ims_z_set(zold);
}

Here is the caller graph for this function:

void ims_tube_set ( Tube newtube)

Definition at line 1031 of file ims.c.

Referenced by ims_sagit_tube_set(), and ims_string_tube_set().

{
    if(ims == NULL)
        return;
    tube_free(ims->tube);
    ims->tube = newtube;
}

Here is the caller graph for this function:

void ims_up ( void  )

Definition at line 356 of file ims.c.

Referenced by up_proc(), and voi_up_proc().

{
    if (ims != NULL)
        ims->z = MAX(ims->z - 1, ims->lz);
}

Here is the caller graph for this function:

int ims_uz_get ( void  )

Definition at line 303 of file ims.c.

Referenced by ims_pots_free(), ims_sagit_tube_set(), ims_string_tube_set(), interp_all_proc(), and voi_empty_all_proc().

{
    if (ims == NULL)
        return -1;
    else
        return ims->uz;
}

Here is the caller graph for this function:

Bool ims_voi_bounds ( int *  lz,
int *  uz 
)

Definition at line 124 of file ims.c.

Referenced by aivru_get_voi_lbound(), aivru_get_voi_ubound(), and ims_tube_interp().

{
    Bool flag = false;
    int oldz, z;
    if (ims == NULL)
        return(false);
    oldz = ims_z_get();
    /* realise all splines */
    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        if(ims_spline_get() != NULL)
            flag = true;
    }
    if(!flag)
    {
        *lz = *uz = 0;
        return(false);
    }

    /* find first and last defined splines */
    for (z = ims->lz; z < ims->uz; z++)
        if (ims->slice[z]->voi[ims->nvoi]->spline != NULL)
        {
            *lz = z;
            break;
        }
    for (z = ims->uz-1; z >= ims->lz; z--)
        if (ims->slice[z]->voi[ims->nvoi]->spline != NULL)
        {
            *uz = z+1;
            break;
        }
    ims_z_set(oldz);
    return(true);
}

Here is the caller graph for this function:

void ims_voi_empty ( void  )

Definition at line 104 of file ims.c.

Referenced by front_voi_empty_proc(), imstack_interpolate_spline(), sagit_voi_empty_proc(), voi_empty_all_proc(), and voi_empty_proc().

{
    if (ims != NULL)
        voi_empty(VOI(ims));
}

Here is the caller graph for this function:

Voi* ims_voi_get ( void  )

Definition at line 96 of file ims.c.

{
    return (VOI(ims));
}
void ims_voi_import ( void  )

Definition at line 391 of file ims.c.

Referenced by aivru_snake_transfer(), front_voi_import_proc(), sagit_voi_import_proc(), voi_down_proc(), and voi_up_proc().

{
    if (ims == NULL || ims->zmark < ims->lz || ims->zmark >= ims->uz || ims->zmark == ims->z)
        return;
    slice_voi_import(SLICE(ims), ims->slice[ims->zmark], ims->nvoi);
}

Here is the caller graph for this function:

void ims_voi_mark ( void  )

Definition at line 383 of file ims.c.

Referenced by aivru_snake_transfer(), front_voi_import_proc(), sagit_voi_import_proc(), voi_down_proc(), and voi_up_proc().

{
    ims->zmark = ims->z;
}

Here is the caller graph for this function:

void ims_voi_print ( FILE fp)

Definition at line 161 of file ims.c.

References ims_spline_get(), ims_z_get(), ims_z_set(), imstack::lz, NULL, and spline2_print().

Referenced by print_voi_proc().

{
    int oldz, z;
    Spline2 *spline;
    if (ims == NULL)
       return;
    oldz = ims_z_get();
    for (z = ims->lz; z < ims->uz; z++)
    {
        ims_z_set(z);
        if((spline = ims_spline_get()) != NULL)
        {
           fprintf(fp,"slicez %d \n", z);
           spline2_print(fp, spline);
        } 
    }
    ims_z_set(oldz);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ims_voi_read ( FILE fp)

Definition at line 180 of file ims.c.

References ims_spline_changed(), ims_spline_set(), ims_z_get(), ims_z_set(), NULL, spline2_read(), and temp.

Referenced by read_voi_proc().

{
    int oldz, z, num;
    char temp[24];
    Spline2 *spline;
    if (ims == NULL)
       return;
    oldz = ims_z_get();
    num = fscanf(fp,"%*s %d",&z);
    do
    {
         if (num != 0)
         {
            ims_z_set(z);
            spline = spline2_read(fp);
            ims_spline_set(spline);
            ims_spline_changed();
            num = fscanf(fp,"%*s %d",&z);
         }
    } while (num>0);
    ims_z_set(oldz);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ims_voi_shift ( Vec2  dp)

Definition at line 113 of file ims.c.

{
    voi_shift(VOI(ims), dp);
}
double ims_window_get ( void  )

Definition at line 169 of file ims_params.c.

Referenced by aivru_snake_image_window_get(), ims_pot_get(), and snake_param_proc().

{
    return(window);
}

Here is the caller graph for this function:

void ims_window_set ( double  newwindow)

Definition at line 177 of file ims_params.c.

Referenced by aivru_snake_image_window_set(), and snake_param_proc().

{
    window = newwindow;
    ims_pots_free();
}

Here is the caller graph for this function:

int ims_x_get ( void  )

Definition at line 218 of file ims.c.

Referenced by front_fulldraw(), sagit_backdraw(), sagit_changed(), spline_save_tube(), string_sagit_draw3(), trans_fulldraw(), and work_fulldraw().

{
    if (ims == NULL)
        return -1;
    else
        return ims->x;
}

Here is the caller graph for this function:

void ims_x_set ( int  newx)

Definition at line 229 of file ims.c.

Referenced by front_crosshair_up_proc(), front_voi_empty_proc(), front_voi_import_proc(), trans_crosshair_up_proc(), and work_crosshair_up_proc().

{
    if (ims != NULL)
    {
        newx = MAX(newx, ims->lx);
        newx = MIN(newx, ims->ux - 1);
        ims->x = newx;
    }
}

Here is the caller graph for this function:

Imrect* ims_xslice ( void  )

Definition at line 610 of file ims.c.

Referenced by sagit_backdraw().

{
    if (ims == NULL)
        return NULL;
    else
        return imstack_xslice(ims, ims->x);
}

Here is the caller graph for this function:

int ims_y_get ( void  )

Definition at line 242 of file ims.c.

Referenced by front_backdraw(), front_changed(), sagit_fulldraw(), string_front_draw3(), trans_fulldraw(), and work_fulldraw().

{
    if (ims == NULL)
        return -1;
    else
        return ims->y;
}

Here is the caller graph for this function:

void ims_y_set ( int  newy)

Definition at line 253 of file ims.c.

Referenced by sagit_crosshair_up_proc(), sagit_voi_empty_proc(), sagit_voi_import_proc(), trans_crosshair_up_proc(), and work_crosshair_up_proc().

{
    if (ims != NULL)
    {
        newy = MAX(newy, ims->ly);
        newy = MIN(newy, ims->uy - 1);
        ims->y = newy;
    }
}

Here is the caller graph for this function:

Imrect* ims_yslice ( void  )

Definition at line 621 of file ims.c.

Referenced by front_backdraw().

{
    if (ims == NULL)
        return NULL;
    else
        return imstack_yslice(ims, ims->y);
}

Here is the caller graph for this function:

int ims_z_get ( void  )
void ims_z_set ( int  newz)
double ims_zscale_get ( void  )

Definition at line 316 of file ims.c.

Referenced by front_backdraw(), and sagit_backdraw().

{
    if (ims == NULL)
        return 1.0;
    else
        return ims->zscale;
}

Here is the caller graph for this function:

void ims_zscale_set ( double  zscale)

Definition at line 327 of file ims.c.

{
    if (ims == NULL)
        return;
    ims->zscale = zscale;
}
double ims_zscaled_get ( void  )

Definition at line 338 of file ims.c.

Referenced by ims_splinesurf3_make().

{
    int z = ims_z_get();
    return (imstack_zscaled(ims, z));
}

Here is the caller graph for this function:

Imrect* ims_zslice ( void  )

Definition at line 632 of file ims.c.

{
    if (ims == NULL)
        return NULL;
    else
        return SLICE(ims)->im;
}
void imstack_free ( Imstack imstack)

Definition at line 51 of file imstack.c.

Referenced by ims_free(), ims_imstack_set(), and ims_make().

{
    int z;

    if (imstack == NULL)
        return;
    for (z = imstack->lz; z < imstack->uz; z++)
        slice_free(imstack->slice[z]);
    tvector_free(imstack->slice, imstack->lz, Slice *);
    rfree(imstack->stats);
    tube_free(imstack->tube);
    rfree(imstack);
}

Here is the caller graph for this function:

Spline2* imstack_interpolate_spline ( Imstack imstack,
double  z 
)

count defined splines and check knot numbers

Definition at line 87 of file interp.c.

Referenced by ims_interpolate_all_splines_between(), and ims_interpolate_spline().

{
    Spline *zspline;
    Spline2 **splines, *spline;
    double *zvector, t;
    int m, n, i, j, oldz, imin = MAXINT, imax = -MAXINT;
 
    if (imstack == NULL)
        return (NULL);
    oldz = ims_z_get();
    ims_z_set(z);
    ims_voi_empty();

    /** count defined splines and check knot numbers **/
    for (n = -1, m = 0, i = imstack->lz; i < imstack->uz; i++)
        if ((spline = imstack->slice[i]->voi[imstack->nvoi]->spline) != NULL)
        {
            if (n == -1)
                n = spline->n;
            else if (n != spline->n)
            {
                error("interpolating different knot number splines", non_fatal);
                return (NULL);
            }
            m++;
            imin = MIN(imin, i);
            imax = MAX(imax, i);
        }
    if (m==0) return(NULL); /* NAT 27/2/2000 */
 
    if(z < imin)
        return(spline2_copy(imstack->slice[imin]->voi[imstack->nvoi]->spline));
    else if(z > imax)
        return(spline2_copy(imstack->slice[imax]->voi[imstack->nvoi]->spline));
 
    zvector = tvector_alloc(0, m, double);
    splines = tvector_alloc(0, m, Spline2 *);
    for (j = 0, i = imstack->lz; i < imstack->uz; i++)
        if ((spline = imstack->slice[i]->voi[imstack->nvoi]->spline) != NULL)
        {
            zvector[j] = i;
            splines[j] = spline;
            j++;
        }

    zspline = spline_make(SPLINE_NATURAL, m);
    spline_interpolate(zspline, zvector);
    tvector_free(zvector, 0, double);
    t = spline_param(zspline, z);
    spline_free(zspline);
 
    spline = spline2_stack_interp(m, splines, t);
    tvector_free(splines, 0, Spline2 *);
 
 
    return (spline);
}

Here is the caller graph for this function:

Imstack* imstack_make ( Vartype  vtype,
int  lz,
int  uz,
double  zscale 
)

Definition at line 27 of file imstack.c.

References imstack_zscaled(), imstack::lx, imstack::ly, imstack::lz, NULL, ralloc(), imstack::slice, slice_alloc(), imstack::stats, imstack::tube, tvector_alloc, imstack::ux, imstack::uy, imstack::uz, imstack::vtype, imstack::x, imstack::y, imstack::z, imstack::zmark, zscale, and imstack::zscale.

Referenced by ims_make().

{
    Imstack *imstack = (Imstack *) ralloc(sizeof(Imstack));
    int z;

    imstack->vtype = vtype;
    imstack->lx = imstack->ux = imstack->x = 0;
    imstack->ly = imstack->uy = imstack->y = 0;
    imstack->lz = lz;
    imstack->uz = uz;
    imstack->z = (lz + uz) / 2;
    imstack->zmark = 0;
    imstack->slice = tvector_alloc(lz, uz, Slice *);
    imstack->zscale = zscale;
    for (z = lz; z < uz; z++)
        imstack->slice[z] = slice_alloc(imstack_zscaled(imstack, z));
    imstack->stats = NULL;
    imstack->tube = NULL;
    return (imstack);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void imstack_uniform_splines ( Imstack imstack)

realise all strings

align all strings

realise all splines

get largest knot number

realise all splines with that knot number

Definition at line 16 of file interp.c.

Referenced by add_surf_proc(), ims_interpolate_all_splines_between(), ims_interpolate_spline(), and ims_splinesurf3_make().

{
    Tstring *oldstr;
    double len;
    int i, oldz, nspline;

    if (imstack == NULL)
        return;
    oldz = ims_z_get();

    /** realise all strings **/
    for (len = 0.0, i = imstack->lz; i < imstack->uz; i++)
    {
        Tstring *str;
        ims_z_set(i);
        str = ims_string_get();
        len = MAX(len, str2_arc_length(str));
    }

    /** align all strings **/
    oldstr = NULL;
    for (i = imstack->lz; i < imstack->uz; i++)
    {
        Tstring *str;
        ims_z_set(i);
        str = ims_string_get();
        if(str != NULL)
        {
            if(oldstr != NULL)
                str2_align(oldstr, str);
            oldstr = str;
        }
        ims_string_changed();
    }

    /** realise all splines **/
    for (i = imstack->lz; i < imstack->uz; i++)
    {
        ims_z_set(i);
        ims_spline_get();
    }

    /** get largest knot number */
    nspline = 0;
    for (i = imstack->lz; i < imstack->uz; i++)
    {
        int n;
        ims_z_set(i);
        n = ims_nspline_get();
        nspline = MAX(nspline, n);
    }

    /** realise all splines with that knot number **/
    for (i = imstack->lz; i < imstack->uz; i++)
    {
        ims_z_set(i);
        ims_fixed_spline_get(nspline);
    }

    ims_z_set(oldz);
}

Here is the caller graph for this function:

Imrect* imstack_xslice ( Imstack imstack,
int  x 
)

Definition at line 89 of file imstack.c.

Referenced by ims_xslice().

{
    Imrect *im;
    Imregion *roi;
    float *row;
    int z, width, height;

    if (imstack == NULL)
        return (NULL);

    height = above2n(imstack->uz);
    width = above2n(imstack->uy);
    roi = roi_alloc(imstack->ly, imstack->lz, imstack->uy, imstack->uz);
    im = im_alloc(height, width, roi, imstack->vtype);
    rfree(roi);

    row = tvector_alloc(imstack->ly, imstack->uy, float);
    for (z = imstack->lz; z < imstack->uz; z++)
    {
        im_get_colf(row, imstack->slice[z]->im, x, imstack->ly, imstack->uy);
        im_put_rowf(row, im, z, imstack->ly, imstack->uy);
    }
    tvector_free(row, imstack->ly, float);

    return (im);
}

Here is the caller graph for this function:

Imrect* imstack_yslice ( Imstack imstack,
int  y 
)

Definition at line 119 of file imstack.c.

Referenced by ims_yslice().

{
    Imrect *im;
    Imregion *roi;
    float *row;
    int z, width, height;

    if (imstack == NULL)
        return (NULL);

    height = above2n(imstack->uz);
    width = above2n(imstack->ux);
    roi = roi_alloc(imstack->lx, imstack->lz, imstack->ux, imstack->uz);
    im = im_alloc(height, width, roi, imstack->vtype);
    rfree(roi);

    row = tvector_alloc(imstack->lx, imstack->ux, float);
    for (z = imstack->lz; z < imstack->uz; z++)
    {
        im_get_rowf(row, imstack->slice[z]->im, y, imstack->lx, imstack->ux);
        im_put_rowf(row, im, z, imstack->lx, imstack->ux);
    }
    tvector_free(row, imstack->lx, float);

    return (im);
}

Here is the caller graph for this function:

double imstack_zscaled ( Imstack imstack,
int  z 
)

Definition at line 68 of file imstack.c.

Referenced by ims_box_draw3(), ims_zscaled_get(), and imstack_make().

{
    z -= (imstack->lz + imstack->uz) / 2;
    return (imstack->zscale * z);
}

Here is the caller graph for this function:

int imstack_zunscaled ( Imstack imstack,
double  z 
)

Definition at line 77 of file imstack.c.

Referenced by aivru_get_voi_surface().

{
    int zi;
    z /= imstack->zscale;
    z += (imstack->lz + imstack->uz) / 2;
    zi = ROUND(z);
    return (zi);
}

Here is the caller graph for this function:

Imrect* light_pot ( Imrect im,
double  range,
double  sigma 
)

Definition at line 116 of file pots.c.

{
    Imrect *pot, *im1, *im2;

    if (im == NULL)
        return (NULL);

    im = imf_lsf_smooth(im, 0.5 * sigma);
    im1 = imf_lsf_smooth(im, 0.5 * sigma);
    im_free(im);

    im = imf_lsf_smooth(im1, 0.5 * range);
    im2 = imf_lsf_smooth(im, 0.5 * range);

    imf_scale_inplace(im1, 0.0, 191.0);
    imf_scale_inplace(im2, 0.0, 64.0);
    pot = im_sum(im1, im2);
    im_free(im1);
    im_free(im2);
    return (pot);
}
void notv_snake_edit_down ( Ipos  pos)

Definition at line 47 of file snake_notv.c.

Referenced by aivru_position_down().

{
    Snake *snake = ims_snake_get();

    if (snake == NULL)
        return;

    plast = backproj2(pos);
    centre = snake_centroid(snake);

    scale = 2.0 * vec2_dist(plast, notv_snake_closest(snake, plast));
    scale = MAX(1.0, scale);
}

Here is the caller graph for this function:

void notv_snake_push_drag ( Ipos  pos)

Definition at line 61 of file snake_notv.c.

Referenced by aivru_position_drag().

{
    Vec2 dp, p;
    double gmax;
    int i, n;
    Snake *snake = ims_snake_get();

    if (snake == NULL)
        return;

    p = backproj2(pos);
    dp = vec2_diff(p, plast);
    plast = p;

    n = snake->n;
    gmax = 0.0;
    for (i = 0; i < n; ++i)
    {
        Vec2 q;
        double g;

        q = snake->p[i];
        g = pusher(q, p, scale);
        gmax = MAX(gmax, g);
    }
    if (gmax == 0.0)
        gmax = 1.0;
    for (i = 0; i < n; ++i)
    {
        Vec2 q;
        double g;

        q = snake->p[i];
        g = pusher(q, p, scale) / gmax;
        q = vec2_sum(q, vec2_times(g, dp));
        snake->p[i] = q;
    }
}

Here is the caller graph for this function:

void notv_snake_push_up ( Ipos  pos)

Definition at line 100 of file snake_notv.c.

Referenced by aivru_position_up().

{
    Snake *snake = ims_snake_get();

    if (snake == NULL)
        return;

    ims_snake_changed();
}

Here is the caller graph for this function:

void notv_snake_shift_drag ( Ipos  pos)

Definition at line 110 of file snake_notv.c.

Referenced by aivru_position_drag().

{
    Snake *snake = ims_snake_get();
    Vec2 p, dp;

    if (snake == NULL)
        return;

    p = backproj2(pos);
    dp = vec2_diff(p, plast);
    plast = p;
    snake_shift(snake, dp);
}

Here is the caller graph for this function:

void notv_snake_shift_up ( Ipos  pos)

Definition at line 124 of file snake_notv.c.

Referenced by aivru_position_up().

{
    Snake *snake = ims_snake_get();

    if (snake == NULL)
        return;

    ims_snake_changed();
}

Here is the caller graph for this function:

void notv_snake_zoom_drag ( Ipos  pos)

Definition at line 134 of file snake_notv.c.

Referenced by aivru_position_drag().

{
    int i, n;
    Snake *snake = ims_snake_get();
    Vec2 p;
    double zoom, theta;
    Mat2 r;

    if (snake == NULL)
        return;

    p = backproj2(pos);
    theta = vec2_angle(vec2_diff(plast, centre), vec2_diff(p, centre));
    zoom = vec2_dist(p, centre) / vec2_dist(plast, centre);
    plast = p;

    r = rot2(theta);
    n = snake->n;
    for (i = 0; i < n; ++i)
    {
        Vec2 q;

        q = snake->p[i];
        q = vec2_sum(centre,
                     vec2_times(zoom,
                                mat2_vprod(r, vec2_diff(q, centre))));
        snake->p[i] = q;
    }
}

Here is the caller graph for this function:

void notv_snake_zoom_up ( Ipos  pos)

Definition at line 164 of file snake_notv.c.

Referenced by aivru_position_up().

{
    Snake *snake = ims_snake_get();
    if (snake == NULL)
        return;
    ims_snake_changed();
}

Here is the caller graph for this function:

void redraw_all ( void  )
Bool sagit_changed ( void  )

Definition at line 29 of file sagit.c.

Referenced by redraw_all().

{
    if (ims_x_get() == xold)
        return (false);
    else
        return (true);
}

Here is the caller graph for this function:

Tv_mouse sagit_cursor_mouse ( void  )
void sagit_tube_draw ( Tv tv,
Tube tube 
)

Definition at line 5 of file tube_draw.c.

{
    int z;
    if(tube == NULL)
        return;
    for(z = tube->z1; z < tube->z2-1; z++)
    {
        double y1 = vec2_y(tube->p1[z]);
        double y2 = vec2_y(tube->p1[z+1]);
        tv_line2(tv, vec2(y1, z+0.5), vec2(y2, z+1.5));
    }
    for(z = tube->z1; z < tube->z2-1; z++)
    {
        double y1 = vec2_y(tube->p2[z]);
        double y2 = vec2_y(tube->p2[z+1]);
        tv_line2(tv, vec2(y1, z+0.5), vec2(y2, z+1.5));
    }
}
Tv* sagit_tv_get ( void  )

Definition at line 15 of file sagit.c.

Referenced by cursor_proc(), load_block_file_proc(), load_dicom_files_proc(), load_nema_files_proc(), redraw_all(), spline_draw_proc(), and tv_choice_proc().

{
    return sagit_tv;
}

Here is the caller graph for this function:

void sagit_tv_set ( Tv tv)

Definition at line 20 of file sagit.c.

{
    sagit_tv = tv;
}
Slice* slice_alloc ( double  z)

Definition at line 13 of file slice.c.

Referenced by imstack_make().

{
    Slice *slice = (Slice *) ralloc(sizeof(Slice));
    int i;
    slice->im = NULL;
    slice->pot = NULL;
    for (i = 0; i < NVOI; i++)
        slice->voi[i] = voi_alloc();
    slice->z = z;
    return (slice);
}

Here is the caller graph for this function:

void slice_free ( Slice slice)

Definition at line 28 of file slice.c.

Referenced by imstack_free().

{
    int i;
    if (slice == NULL)
        return;
    im_free(slice->im);
    im_free(slice->pot);
    for (i = 0; i < NVOI; i++)
        voi_free(slice->voi[i]);
    rfree(slice);
}

Here is the caller graph for this function:

void slice_image_draw ( Tv tv,
Slice slice 
)

Definition at line 10 of file slice_draw.c.

Referenced by ims_image_draw().

{
    Imrect *im_scale;
    if (slice == NULL)
        return;
    else
    {
        im_scale = imf_scale(slice->im, 0.0, 255.0);
        tv_erase(tv);
        tv_imrect2(tv, im_scale);
        im_free(im_scale);
    }
}

Here is the caller graph for this function:

Imrect* slice_image_get ( Slice slice)

Definition at line 54 of file slice.c.

Referenced by ims_image_get().

{
    if (slice == NULL)
        return (NULL);
    return (slice->im);
}

Here is the caller graph for this function:

void slice_image_set ( Slice slice,
Imrect im 
)

Definition at line 65 of file slice.c.

Referenced by ims_image_set().

{
    Bool dofree = ims_dofree_get();
    if (slice == NULL)
        return;
    if(dofree == true)
        im_free(slice->im);
    slice->im = im;
}

Here is the caller graph for this function:

void slice_pot_draw ( Tv tv,
Slice slice 
)

Definition at line 24 of file slice_draw.c.

Referenced by ims_pot_draw().

{
    Imrect *im_scale;

    if (slice == NULL)
        return;
    else
    {
        im_scale = imf_scale(slice_pot_get(slice), 0.0, 255.0);
        tv_imrect2(tv, im_scale);
        im_free(im_scale);
    }
}

Here is the caller graph for this function:

Imrect* slice_pot_get ( Slice slice)

Definition at line 78 of file slice.c.

Referenced by ims_pot_get(), and slice_pot_draw().

{
    if (slice == NULL)
        return (NULL);
    return (slice->pot);
}

Here is the caller graph for this function:

void slice_pot_set ( Slice slice,
Imrect pot 
)

Definition at line 88 of file slice.c.

Referenced by ims_pot_get(), and ims_pot_set().

{
    if (slice == NULL)
        return;
    im_free(slice->pot);
    slice->pot = pot;
}

Here is the caller graph for this function:

void slice_voi_import ( Slice slice,
Slice oldslice,
int  nvoi 
)

Definition at line 43 of file slice.c.

Referenced by ims_voi_import().

{
    if (slice == NULL || oldslice == NULL || slice == oldslice)
        return;
    voi_free(slice->voi[nvoi]);
    slice->voi[nvoi] = voi_copy(oldslice->voi[nvoi]);
}

Here is the caller graph for this function:

void smask_diff ( int  s,
double *  mask2,
double *  mask1 
)

Definition at line 29 of file smask.c.

Referenced by normal_graph().

{
    int x;
    for (x = -s + 1; x <= s - 1; x++)
        mask2[x] = (mask1[x + 1] - mask1[x - 1]) / 2.0;
    mask2[-s] = mask2[s] = 0.0;
}

Here is the caller graph for this function:

void smask_diff2 ( int  s,
double *  mask2,
double *  mask1 
)

Definition at line 40 of file smask.c.

Referenced by normal_graph().

{
    int x;
    mask2[-s] = mask2[-s+1];
    for (x = -s + 1; x <= s - 1; x++)
        mask2[x] = (mask1[x + 1] - 2.0 * mask1[x] + mask1[x - 1]) / 4.0;
    mask2[-s] = 2*mask2[-s+1]-mask2[-s+2];
    mask2[s] = 2*mask2[s-1]-mask2[s-2];
}

Here is the caller graph for this function:

double smask_maxgradedge ( int  s,
double *  mask 
)

Definition at line 53 of file smask.c.

{
    int x, xmax = -s;
    double l, lmax = fabs(mask[-s]);

    for (x = -s; x <= s; x++)
        if (lmax < (l = fabs(mask[x])))
        {
            lmax = l;
            xmax = x;
        }
    return (SGN(xmax));
}
double smask_nearzeroedge ( double *  mask,
int  s 
)

Definition at line 70 of file smask.c.

{
    int x, sgn;

    sgn = SGN(mask[0]);
    for (x = 1; x <= s - 1; x++)
    {
        int sgn1 = SGN(mask[x]);
        int sgn2 = SGN(mask[-x]);
        if (sgn != sgn1)
            return (x);
        if (sgn != sgn2)
            return (-x);
    }
    return (0.0);
}
void smask_normalise ( int  s,
double *  mask,
double  m 
)

Definition at line 90 of file smask.c.

Referenced by normal_graph().

{
    int x;
    double mmax = fabs(mask[-s]);
    for (x = -s + 1; x <= s; x++)
        mmax = MAX(mmax, fabs(mask[x]));
    if (mmax == 0.0)
        mmax = 1.0;
    for (x = -s; x <= s; x++)
        mask[x] *= m / mmax;
}

Here is the caller graph for this function:

void smask_smooth ( int  s,
double *  mask2,
double *  mask1 
)

Definition at line 17 of file smask.c.

Referenced by normal_force(), and normal_graph().

{
    int x;
    mask2[-s] = (2.0 * mask1[-s] + mask1[-s + 1]) / 3.0;
    for (x = -s + 1; x <= s - 1; x++)
        mask2[x] = (mask1[x - 1] + 2.0 * mask1[x] + mask1[x + 1]) / 4.0;
    mask2[s] = (mask1[s - 1] + 2.0 * mask1[s]) / 3.0;
}

Here is the caller graph for this function:

Vec2 snake_centroid ( Snake snake)

Definition at line 172 of file snake.c.

Referenced by notv_snake_edit_down(), snake_edit_down(), snake_rot_force(), snake_rot_step(), snake_scale_force(), and snake_scale_step().

{
    Vec2 c, *p;
    int i, n;

    if (snake == NULL)
        return vec2_zero();
    n = snake->n;
    p = snake->p;
    c = vec2_zero();
    for (i = 0; i < n; ++i)
        c = vec2_sum(c, p[i]);
    return (vec2_times(1.0 / n, c));
}

Here is the caller graph for this function:

double snake_chord ( Snake snake,
int  i 
)

Definition at line 142 of file snake.c.

Referenced by snake_length(), and snake_normal_graphs().

{
    int n = snake->n;
    while(i < 0)
        i += n;
    while(i >= n)
        i -= n;
    if(i == n-1)
        return(vec2_dist(snake->p[0], snake->p[i]));
    else
        return(vec2_dist(snake->p[i+1], snake->p[i]));
}

Here is the caller graph for this function:

Snake* snake_copy ( Snake snake)

Definition at line 29 of file snake.c.

Referenced by snake_run_all(), snake_run_rot(), snake_run_rts(), snake_run_scale(), and snake_run_trans().

{
    Snake *new;

    if (snake == NULL)
        return (NULL);
    new = snake_make(snake->n);
    tvector_copy_inplace((char *) new->p, (char *) snake->p, 0, snake->n, Vec2);
    tvector_copy_inplace((char *) new->f, (char *) snake->f, 0, snake->n, Vec2);
    new->forcelaw = snake->forcelaw;
    return (new);
}

Here is the caller graph for this function:

double snake_dist ( Snake s1,
Snake s2 
)

Definition at line 63 of file snake_run.c.

Referenced by snake_run_all(), snake_run_rot(), snake_run_rts(), snake_run_scale(), and snake_run_trans().

{
    int i, n = s1->n;
    double d, dmax = 0.0;

    for (i = 0; i < n; i++)
    {
        d = vec2_dist(s1->p[i], s2->p[i]);
        if (dmax < d)
            dmax = d;
    }
    return (dmax);
}

Here is the caller graph for this function:

void snake_draw ( Tv tv,
Snake snake 
)

Definition at line 16 of file snake_draw.c.

Referenced by ims_snake_draw(), snake_edit_down(), snake_push_drag(), snake_shift_drag(), and snake_zoom_drag().

{
    int i, n;

    if (snake == NULL)
        return;
    n = snake->n;
    for (i = 0; i < n - 1; i++)
    {
        tv_bigdot2(tv, snake->p[i], 2);
        tv_line2(tv, snake->p[i], snake->p[i + 1]);
    }
    tv_bigdot2(tv, snake->p[n - 1], 2);
    tv_line2(tv, snake->p[n - 1], snake->p[0]);
}

Here is the caller graph for this function:

void snake_draw3 ( Tv tv,
Snake snake,
double  z 
)

Definition at line 43 of file snake_draw.c.

{
    int i, n;

    if (snake == NULL)
        return;
    n = snake->n;
    for (i = 0; i < n - 1; i++)
        tv_line3(tv, snake_knot3(snake, z, i), snake_knot3(snake, z, i + 1));
    tv_line3(tv, snake_knot3(snake, z, n - 1), snake_knot3(snake, z, 0));
}
Tv_mouse snake_edit_mouse ( void  )
Vec2 snake_eval ( Snake snake,
double  t 
)

Definition at line 109 of file snake.c.

Referenced by str2_of_snake().

{
    int i, i1, n = snake->n;
    Vec2 *p = snake->p;
    double dt, dt1;

    i = floor(t);
    dt = t - i;
    dt1 = 1.0 - dt;
    while (i < 0)
        i += n;
    i %= n;
    i1 = (i + 1) % n;
    return (vec2_sum(vec2_times(dt1, p[i]), vec2_times(dt, p[i1])));
}

Here is the caller graph for this function:

void snake_external_step ( Snake snake,
double  maxstep,
double *  pdt 
)

Move snake under forces f making maximum step maxstep and find appropriate dt

Definition at line 215 of file snake_run.c.

Referenced by snake_run_all().

{
    int i, n = snake->n;
    double fmax = 0.0, dt;
    Vec2 *p = snake->p, *f = snake->f;
    for (i = 0; i < n; i++)
    {
        fmax = MAX(fmax, fabs(vec2_x(f[i])));
        fmax = MAX(fmax, fabs(vec2_y(f[i])));
    }
    if (fmax != 0.0)
        dt = maxstep / fmax;
    else
        dt = 0.0;
    for (i = 0; i < n; i++)
        p[i] = vec2_diff(p[i], vec2_times(dt, f[i]));
    *pdt = dt;
}

Here is the caller graph for this function:

void snake_force_draw ( Tv tv,
Snake snake,
double  maxlength 
)

Definition at line 59 of file snake_draw.c.

Referenced by snake_force_proc().

{
    int i, n = snake->n;
    Vec2 *p = snake->p;
    Vec2 *f = snake->f;
    double fmax = 0.0;
    char string[32];

    for (i = 0; i < n; i++)
        fmax = MAX(fmax, vec2_mod(f[i]));
    sprintf(string, "maxforce: %12.6f\n", fmax);
    tv_textxy(tv, string, 10, 10);

    if (fmax == 0.0)
        fmax = 1.0;

    maxlength /= fmax;
    tv_save_draw(tv);
    tv_color_set(tv, red);
    for (i = 0; i < n; i++)
        tv_vector2(tv, p[i], vec2_times(maxlength, f[i]));
    tv_reset_draw(tv);
}

Here is the caller graph for this function:

void snake_free ( Snake snake)

Definition at line 45 of file snake.c.

Referenced by snake_run_all(), snake_run_rot(), snake_run_rts(), snake_run_scale(), snake_run_trans(), voi_empty(), voi_free(), voi_spline_changed(), and voi_string_changed().

{
    if (snake == NULL)
        return;
    tvector_free(snake->p, 0, Vec2);
    tvector_free(snake->f, 0, Vec2);
    rfree((void *) snake);
}

Here is the caller graph for this function:

Snake* snake_from_list ( List points)

Definition at line 75 of file snake.c.

{
    List *ptr;
    int i, n;
    Snake *snake = snake_make(n = list_length(points));
    for (i = 0, ptr = points; i < n; i++, ptr = ptr->next)
    {
        Vec2 *v = (Vec2 *) ptr->to;
        snake->p[i] = *v;
    }
    return (snake);
}
void snake_gradient_forces ( Snake snake,
Imrect pot 
)

Definition at line 81 of file snake_run.c.

Referenced by snake_force_proc(), and snake_make().

{
    int i, n = snake->n;
    for (i = 0; i < n; i++)
    {
        Vec2 f, n;

        f = im_grad_vec2(pot, snake->p[i]);
        n = snake_perp(snake, i);
        snake->f[i] = vec2_projpar(f, n);
    }
}

Here is the caller graph for this function:

void snake_hessian_forces ( Snake snake,
Imrect pot 
)

Definition at line 98 of file snake_run.c.

{
    int i, n = snake->n;

    for (i = 0; i < n; i++)
    {
        Mat2 h;
        Vec2 n;
        h = im_hess_mat2(pot, snake->p[i]);
        n = snake_perp(snake, i);
        snake->f[i] = vec2_projpar(mat2_vprod(h, n), n);
    }
}
void snake_internal_step ( Snake snake,
double  alpha,
double  beta,
double  dt 
)

Definition at line 234 of file snake_run.c.

Referenced by snake_run_all().

{
    static int nlast = 0;
    static double *x = NULL, *y = NULL;
    double a, b, c, d, e;
    int i, n;
    Vec2 *p;

    if (snake == NULL)
        return;
    n = snake->n;
    p = snake->p;
    if (nlast != n)
    {
        tvector_free(x, 0, double);
        tvector_free(y, 0, double);
        x = tvector_alloc(0, n, double);
        y = tvector_alloc(0, n, double);
        nlast = n;
    }
    for (i = 0; i < n; i++)
    {
        x[i] = vec2_x(p[i]);
        y[i] = vec2_y(p[i]);
    }
    alpha *= dt*n*n/(32.0*32.0);
    beta *= dt*n*n*n*n/(32.0*32.0*32.0*32.0);
    e = a = beta;
    d = b = -alpha - 4.0 * beta;
    c = 1.0 + 2.0 * alpha + 6.0 * beta;
    pentadiag0(n, a, b, c, d, e, x);
    pentadiag0(n, a, b, c, d, e, y);
    for (i = 0; i < n; i++)
        p[i] = vec2(x[i], y[i]);
}

Here is the caller graph for this function:

double snake_length ( Snake snake)

Definition at line 158 of file snake.c.

{
    double l = 0.0;
    int i;
    if (snake == NULL)
        return (-1.0);
    for (i = 0; i < snake->n; i++)
        l += snake_chord(snake, i);
    return (l);
}
Snake* snake_make ( int  n)

Definition at line 16 of file snake.c.

Referenced by snake_copy(), snake_from_list(), snake_of_str2(), and ss_to_snake().

{
    Snake *snake = talloc(Snake);
    snake->n = n;
    snake->p = tvector_alloc(0, n, Vec2); /* snake vertices */
    snake->f = tvector_alloc(0, n, Vec2); /* workspace for forces */
    snake->forcelaw = snake_gradient_forces; /* default force law */
    return (snake);
}

Here is the caller graph for this function: