Changeset 23320
- Timestamp:
- Mar 13, 2009, 5:19:16 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/eam_branch_20090312/ppImage/src/ppImageCheckCTE.c
r23316 r23320 11 11 // this step is complete optional. 12 12 if (!options->checkCTE) { 13 return true;13 return true; 14 14 } 15 15 … … 34 34 psImageBinningSetSkip(binning, image); 35 35 36 pmFPAfile *input = psMetadataLookupPtr (&status, config->files, "PPIMAGE.INPUT");37 pmReadout *modelReadout = pmFPAGenerateReadout(config, view, "PPIMAGE.CTEMAP", input->fpa, binning);38 psImage *output = modelReadout->image;39 40 36 pmCell *inCell = pmFPAfileThisCell (config->files, view, "PPIMAGE.INPUT"); 41 37 pmCell *outCell = pmFPAfileThisCell (config->files, view, "PPIMAGE.CTEMAP"); 42 if (!pmCellCopyStructure (outCell, inCell, binning->nXbin, binning->nYbin)) {38 if (!pmCellCopyStructure(outCell, inCell, binning->nXbin, binning->nYbin)) { 43 39 psError(PS_ERR_UNKNOWN, false, "Unable to copy cell structure."); 44 40 return false; 45 41 } 46 42 47 // Binned version of image 48 // psImage *output = psImageAlloc(binning->nXruff, binning->nYruff, PS_TYPE_F32); 43 pmReadout *outRO = pmFPAfileThisReadout(config->files, view, "PPIMAGE.CTEMAP"); 44 psImage *output = outRO->image; 45 46 // Don't care about the bias: get rid of it, if present 47 psFree(outRO->bias); 48 outRO->bias = psListAlloc(NULL); 49 psMetadataItem *biassec = psMetadataLookup(outCell->concepts, "CELL.BIASSEC"); 50 psFree(biassec->data.V); 51 biassec->data.V = psListAlloc(NULL); 49 52 50 53 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); … … 57 60 for (int ix = 0; ix < output->numCols; ix++) { 58 61 59 // convert the ruff grid cell to the equivalent fine grid cell62 // convert the ruff grid cell to the equivalent fine grid cell 60 63 ruffRegion = psRegionSet (ix, ix + 1, iy, iy + 1); 61 64 fineRegion = psImageBinningSetFineRegion (binning, ruffRegion); 62 65 fineRegion = psRegionForImage (image, fineRegion); 66 if (fineRegion.x0 >= image->numCols || fineRegion.x1 >= image->numCols || 67 fineRegion.y0 >= image->numRows || fineRegion.y1 >= image->numRows) { 68 continue; 69 } 63 70 64 71 psImage *subset = psImageSubset (image, fineRegion); … … 68 75 } 69 76 psImage *submask = NULL; 70 if (mask) {71 submask = psImageSubset (mask, fineRegion);72 }77 if (mask) { 78 submask = psImageSubset (mask, fineRegion); 79 } 73 80 74 81 // reset the default values 75 statsDefaults->tmpData = stats->tmpData; // XXX this is fairly hackish: tmpData is internal storage for stats; the assign drops the reference...82 statsDefaults->tmpData = stats->tmpData; // XXX this is fairly hackish: tmpData is internal storage for stats; the assign drops the reference... 76 83 *stats = *statsDefaults; 77 statsDefaults->tmpData = NULL; 78 79 psImageStats (stats, subset, submask, 0); 84 statsDefaults->tmpData = NULL; 80 85 81 // XXX need to apply the gain as well 82 output->data.F32[iy][ix] = PS_SQR(stats->sampleStdev) / stats->sampleMedian; 83 84 psFree (subset); 85 psFree (submask); 86 } 86 psImageStats (stats, subset, submask, 0); 87 88 // XXX need to apply the gain as well 89 output->data.F32[iy][ix] = PS_SQR(stats->sampleStdev) / stats->sampleMedian; 90 91 psFree (subset); 92 psFree (submask); 93 } 87 94 } 88 95 89 96 psFree (binning); 90 97 psFree (stats);
Note:
See TracChangeset
for help on using the changeset viewer.
