4#ifndef _bspline_macros_h_
5#define _bspline_macros_h_
22#define LOOP_THRU_ROI_X(roi_ijk, vol_ijk, bxf) \
23 for (roi_ijk[0] = 0, vol_ijk[0] = bxf->roi_offset[0]; roi_ijk[0] < bxf->roi_dim[0]; roi_ijk[0]++, vol_ijk[0]++)
25#define LOOP_THRU_ROI_Y(roi_ijk, vol_ijk, bxf) \
26 for (roi_ijk[1] = 0, vol_ijk[1] = bxf->roi_offset[1]; roi_ijk[1] < bxf->roi_dim[1]; roi_ijk[1]++, vol_ijk[1]++)
28#define LOOP_THRU_ROI_Z(roi_ijk, vol_ijk, bxf) \
29 for (roi_ijk[2] = 0, vol_ijk[2] = bxf->roi_offset[2]; roi_ijk[2] < bxf->roi_dim[2]; roi_ijk[2]++, vol_ijk[2]++)
33#define REGION_INDEX_X(ijk, bxf) \
34 (ijk[0] / bxf->vox_per_rgn[0])
36#define REGION_INDEX_Y(ijk, bxf) \
37 (ijk[1] / bxf->vox_per_rgn[1])
39#define REGION_INDEX_Z(ijk, bxf) \
40 (ijk[2] / bxf->vox_per_rgn[2])
74#define REGION_OFFSET_X(ijk, bxf) \
75 (ijk[0] % bxf->vox_per_rgn[0])
77#define REGION_OFFSET_Y(ijk, bxf) \
78 (ijk[1] % bxf->vox_per_rgn[1])
80#define REGION_OFFSET_Z(ijk, bxf) \
81 (ijk[2] % bxf->vox_per_rgn[2])
106static inline plm_long
115#define GET_WORLD_COORD_X_NO_DCOS(ijk_vol, bxf) \
116 (bxf->img_origin[0] + bxf->img_spacing[0] * ijk_vol[0])
118#define GET_WORLD_COORD_Y_NO_DCOS(ijk_vol, bxf) \
119 (bxf->img_origin[1] + bxf->img_spacing[1] * ijk_vol[1])
121#define GET_WORLD_COORD_Z_NO_DCOS(ijk_vol, bxf) \
122 (bxf->img_origin[2] + bxf->img_spacing[2] * ijk_vol[2])
124#define GET_WORLD_COORD_X(ijk_vol, vol, bxf) \
125 (bxf->img_origin[0] \
126 + ijk_vol[0]*vol->step[0*3+0] \
127 + ijk_vol[1]*vol->step[0*3+1] \
128 + ijk_vol[2]*vol->step[0*3+2])
130#define GET_WORLD_COORD_Y(ijk_vol, vol, bxf) \
131 (bxf->img_origin[1] \
132 + ijk_vol[0]*vol->step[1*3+0] \
133 + ijk_vol[1]*vol->step[1*3+1] \
134 + ijk_vol[2]*vol->step[1*3+2])
136#define GET_WORLD_COORD_Z(ijk_vol, vol, bxf) \
137 (bxf->img_origin[2] \
138 + ijk_vol[0]*vol->step[2*3+0] \
139 + ijk_vol[1]*vol->step[2*3+1] \
140 + ijk_vol[2]*vol->step[2*3+2])
149#define LOOP_THRU_VOL_TILES(idx_tile, bxf) \
150 for (idx_tile = 0; idx_tile < (bxf->rdims[0] * bxf->rdims[1] * bxf->rdims[2]); idx_tile++)
153#define LOOP_THRU_TILE_X(ijk_local, bxf) \
154 for (ijk_local[0]=0; ijk_local[0] < bxf->vox_per_rgn[0]; ijk_local[0]++)
156#define LOOP_THRU_TILE_Y(ijk_local, bxf) \
157 for (ijk_local[1]=0; ijk_local[1] < bxf->vox_per_rgn[1]; ijk_local[1]++)
159#define LOOP_THRU_TILE_Z(ijk_local, bxf) \
160 for (ijk_local[2]=0; ijk_local[2] < bxf->vox_per_rgn[2]; ijk_local[2]++)
167#define GET_VOL_COORDS(ijk_vol, ijk_tile, ijk_local, bxf) \
169 ijk_vol[0] = bxf->roi_offset[0] + bxf->vox_per_rgn[0] * ijk_tile[0] + ijk_local[0]; \
170 ijk_vol[1] = bxf->roi_offset[1] + bxf->vox_per_rgn[1] * ijk_tile[1] + ijk_local[1]; \
171 ijk_vol[2] = bxf->roi_offset[2] + bxf->vox_per_rgn[2] * ijk_tile[2] + ijk_local[2]; \
176#define GET_REAL_SPACE_COORDS(xyz_vol, ijk_vol, bxf) \
178 xyz_vol[0] = bxf->img_origin[0] + bxf->img_spacing[0] * ijk_vol[0]; \
179 xyz_vol[1] = bxf->img_origin[1] + bxf->img_spacing[1] * ijk_vol[1]; \
180 xyz_vol[2] = bxf->img_origin[2] + bxf->img_spacing[2] * ijk_vol[2]; \
184#define GET_VOXEL_INDICES(xyz_vol, ijk_vol, bxf) \
186 xyz_vol[0] = ROUND_INT((ijk_vol[0] - bxf->img_origin[0])/ bxf->img_spacing[0]) ; \
187 xyz_vol[1] = ROUND_INT((ijk_vol[1] - bxf->img_origin[1])/ bxf->img_spacing[1]) ; \
188 xyz_vol[2] = ROUND_INT((ijk_vol[2] - bxf->img_origin[2])/ bxf->img_spacing[2]) ; \
192#if defined (commentout)
193#define GET_WORLD_COORDS(xyz_vol, ijk_vol, vol, bxf) \
194 VOXEL_COORDS (xyz_vol, ijk_vol, bxf->img_origin, vol->step)
static void get_region_offset(int q[3], const int ijk[3], const Bspline_xform *bxf)
Definition bspline_macros.h:84
static plm_long get_region_index(const plm_long ijk[3], const Bspline_xform *bxf)
Definition bspline_macros.h:57
static void get_region_index_3(int p[3], const int ijk[3], const Bspline_xform *bxf)
Definition bspline_macros.h:43
static plm_long volume_index(const plm_long dims[3], plm_long i, plm_long j, plm_long k)
Definition volume_macros.h:14