22 #ifndef MUSE_PIXGRID_H 23 #define MUSE_PIXGRID_H 28 #include "muse_pixtable.h" 37 #define PT_IDX_MASK 0x1FFFFFFFFFFFFFll 40 #define XMAP_BITMASK 0x3FFll 41 #define XMAP_LSHIFT 53ll 99 static inline cpl_size
101 cpl_size aZ, cpl_boolean aAllowOutside)
103 if (!aAllowOutside &&
104 (aX < 0 || aX >= aGrid->nx || aY < 0 || aY >= aGrid->ny ||
105 aZ < 0 || aZ >= aGrid->nz)) {
111 if (aX >= aGrid->nx) {
117 if (aY >= aGrid->ny) {
123 if (aZ >= aGrid->nz) {
126 return aX + aGrid->nx * (aY + aGrid->ny * aZ);
139 static inline cpl_size
146 cpl_size p = aGrid->pix[aIndex];
154 unsigned short ix = (-p >> XMAP_LSHIFT) & XMAP_BITMASK;
155 p = (-p - 1) & PT_IDX_MASK;
157 return aGrid->xmaps[ix][p].npix;
170 static inline const cpl_size *
177 cpl_size p = aGrid->pix[aIndex];
182 return aGrid->pix + aIndex;
185 unsigned short ix = (-p >> XMAP_LSHIFT) & XMAP_BITMASK;
186 p = (-p - 1) & PT_IDX_MASK;
188 return aGrid->xmaps[ix][p].pix;
muse_pixgrid * muse_pixgrid_2d_create(cpl_table *, double, double, double, double, float *)
Convert selected rows of a pixel table into 2D pixel grid, linking the grid points to entries (=rows)...
muse_pixgrid * muse_pixgrid_create(muse_pixtable *, cpl_propertylist *, cpl_size, cpl_size, cpl_size)
Convert selected rows of a pixel table into pixel grid, linking the grid points to entries (=rows) in...
void muse_pixgrid_delete(muse_pixgrid *)
Delete a pixel grid and remove its memory.
Structure definition of MUSE pixel table.
static const cpl_size * muse_pixgrid_get_rows(muse_pixgrid *aGrid, cpl_size aIndex)
Return a pointer to the rows stored in one pixel.
static cpl_size muse_pixgrid_get_index(muse_pixgrid *aGrid, cpl_size aX, cpl_size aY, cpl_size aZ, cpl_boolean aAllowOutside)
Get the grid index determined from all three coordinates.
static cpl_size muse_pixgrid_get_count(muse_pixgrid *aGrid, cpl_size aIndex)
Return the number of rows stored in one pixel.