IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 14, 2005, 3:23:24 AM (21 years ago)
Author:
eugene
Message:

mask/noise are working

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphot-utils.c

    r4216 r4251  
    135135    psFitsWriteImage (fits, NULL, image, 0, NULL);
    136136    psFree (fits);
    137     return;
     137    return true;
    138138}
    139139
     140# if (0)
    140141void pmSourceMaskSaturated (psSource *source, float saturate) {
    141142
     
    150151    }
    151152}
    152 
    153 // mask the area contained by the region
    154 // the region is defined wrt the parent image
    155 void psImageMaskRegion (psImage *image, psRegion *region, bool logical_and, int maskValue) {
    156 
    157     for (int iy = 0; iy < image->numRows; iy++) {
    158         for (int ix = 0; ix < image->numCols; ix++) {
    159             if (ix + image->col0 <  region->x0) continue;
    160             if (ix + image->col0 >= region->x1) continue;
    161             if (iy + image->row0 <  region->y0) continue;
    162             if (iy + image->row0 >= region->y1) continue;
    163             if (logical_and) {
    164                 image->data.U8[iy][ix] &= maskValue;
    165             } else {
    166                 image->data.U8[iy][ix] |= maskValue;
    167             }
    168         }
    169     }
    170 }
    171 
    172 // mask the area not contained by the region
    173 // the region is defined wrt the parent image
    174 void psImageKeepRegion (psImage *image, psRegion *region, bool logical_and, int maskValue) {
    175 
    176     for (int iy = 0; iy < image->numRows; iy++) {
    177         for (int ix = 0; ix < image->numCols; ix++) {
    178             if (ix + image->col0 <  region->x0) goto maskit;
    179             if (ix + image->col0 >= region->x1) goto maskit;
    180             if (iy + image->row0 <  region->y0) goto maskit;
    181             if (iy + image->row0 >= region->y1) goto maskit;
    182             continue;
    183         maskit:
    184             if (logical_and) {
    185                 image->data.U8[iy][ix] &= maskValue;
    186             } else {
    187                 image->data.U8[iy][ix] |= maskValue;
    188             }
    189         }
    190     }
    191 }
    192 
    193 // mask the area contained by the region
    194 // the region is defined wrt the parent image
    195 void psImageMaskCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue) {
    196 
    197     double R2 = PS_SQR(radius);
    198 
    199     for (int iy = 0; iy < image->numRows; iy++) {
    200         for (int ix = 0; ix < image->numCols; ix++) {
    201             dx = ix + image->col0 - x;
    202             dy = iy + image->row0 - y;
    203             r2 = PS_SQR(dx) + PS_SQR(dy);
    204             if (r2 > R2) continue;
    205             if (logical_and) {
    206                 image->data.U8[iy][ix] &= maskValue;
    207             } else {
    208                 image->data.U8[iy][ix] |= maskValue;
    209             }
    210         }
    211     }
    212 }
    213 
    214 // mask the area contained by the region
    215 // the region is defined wrt the parent image
    216 void psImageKeepCircle (psImage *image, double x, double y, double radius, bool logical_and, int maskValue) {
    217 
    218     double R2 = PS_SQR(radius);
    219 
    220     for (int iy = 0; iy < image->numRows; iy++) {
    221         for (int ix = 0; ix < image->numCols; ix++) {
    222             dx = ix + image->col0 - x;
    223             dy = iy + image->row0 - y;
    224             r2 = PS_SQR(dx) + PS_SQR(dy);
    225             if (r2 < R2) continue;
    226             if (logical_and) {
    227                 image->data.U8[iy][ix] &= maskValue;
    228             } else {
    229                 image->data.U8[iy][ix] |= maskValue;
    230             }
    231         }
    232     }
    233 }
     153# endif
    234154
    235155// create a subset of sources for the PS_SOURCE_PSFSTAR entries
Note: See TracChangeset for help on using the changeset viewer.