/* * The Npic library * * Copyright (C) 2003 Edouard Thiel * * This library is free software under the terms of the * GNU Lesser General Public License (LGPL) version 2.1. */ /* * masks.h - 15/12/2008 * * Declaration of struct Npic_mask. */ #ifndef NPIC__MASKS_H #define NPIC__MASKS_H /* Types of masks * * 2,3,4,5,6 = dimension. * Weight for distance transforms or Radius for medial axis: * L = signed Long (32 bits); * D = Double; */ enum { NPIC_MASK_BB = 0x3101, NPIC_MASK_2L, NPIC_MASK_2D, NPIC_MASK_3L, NPIC_MASK_3D, NPIC_MASK_4L, NPIC_MASK_4D, NPIC_MASK_5L, NPIC_MASK_5D, NPIC_MASK_6L, NPIC_MASK_6D, NPIC_MASK_EE }; /* Weightings : coordinates r,s,t,z,y,x ; weight or radius h */ typedef struct { int y, x; Npic_l h; } Npic_weighting_2l; typedef struct { int y, x; Npic_d h; } Npic_weighting_2d; typedef struct { int z, y, x; Npic_l h; } Npic_weighting_3l; typedef struct { int z, y, x; Npic_d h; } Npic_weighting_3d; typedef struct { int t, z, y, x; Npic_l h; } Npic_weighting_4l; typedef struct { int t, z, y, x; Npic_d h; } Npic_weighting_4d; typedef struct { int s, t, z, y, x; Npic_l h; } Npic_weighting_5l; typedef struct { int s, t, z, y, x; Npic_d h; } Npic_weighting_5d; typedef struct { int r, s, t, z, y, x; Npic_l h; } Npic_weighting_6l; typedef struct { int r, s, t, z, y, x; Npic_d h; } Npic_weighting_6d; /* Masks sub-structs, strictly identical in memory. */ typedef struct { int type, /* Nature : NPIC_MASK_2L, .. */ ok, /* Status of mask */ size, /* Memory size of one vector */ nb, /* Current number of vectors */ tot, /* Total number of allocated vectors */ step; /* Increment for realloc */ void *v; /* Allocated list of weightings */ Npic_props props; /* To store a list of properties, see props.h */ } Npic_mask_gen; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_2l *v; Npic_props props; } Npic_mask_2l; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_2d *v; Npic_props props; } Npic_mask_2d; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_3l *v; Npic_props props; } Npic_mask_3l; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_3d *v; Npic_props props; } Npic_mask_3d; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_4l *v; Npic_props props; } Npic_mask_4l; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_4d *v; Npic_props props; } Npic_mask_4d; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_5l *v; Npic_props props; } Npic_mask_5l; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_5d *v; Npic_props props; } Npic_mask_5d; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_6l *v; Npic_props props; } Npic_mask_6l; typedef struct { int type, ok, size, nb, tot, step; Npic_weighting_6d *v; Npic_props props; } Npic_mask_6d; /* Mask type of dimension 2 to 6 */ typedef union { int type; Npic_mask_gen gen; /* generic struct for accessing fields */ Npic_mask_2l dm_2l; Npic_mask_2d dm_2d; Npic_mask_3l dm_3l; Npic_mask_3d dm_3d; Npic_mask_4l dm_4l; Npic_mask_4d dm_4d; Npic_mask_5l dm_5l; Npic_mask_5d dm_5d; Npic_mask_6l dm_6l; Npic_mask_6d dm_6d; } Npic_mask; #endif /* NPIC__MASKS_H */