Changeset 28280 for trunk/ppBackground/src/ppBackgroundLoop.c
- Timestamp:
- Jun 9, 2010, 6:16:39 PM (16 years ago)
- Location:
- trunk/ppBackground
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppBackground
-
Property svn:ignore
set to
configure
Makefile.in
ignore
config.log
depcomp
config.status
config.guess
ltmain.sh
config.sub
autom4te.cache
libtool
missing
Makefile
aclocal.m4
install-sh
-
Property svn:ignore
set to
-
trunk/ppBackground/src
-
Property svn:ignore
set to
ppBackground
Makefile.in
config.h
ppBackgroundVersionDefinitions.h
.deps
Makefile
ppBackgroundErrorCodes.c
ppBackgroundErrorCodes.h
stamp-h1
config.h.in
-
Property svn:ignore
set to
-
trunk/ppBackground/src/ppBackgroundLoop.c
r28276 r28280 13 13 { 14 14 pmConfig *config = data->config; // Configuration data 15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND. BACKGROUND", 0);15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.IMAGE", 0); 16 16 pmFPAfile *patternFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.PATTERN", 0); // File with data 17 pmFPAfile *bgFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.BACKGROUND", 0); // File with bg 17 18 pmFPA *patternMosaic = pmFPAConstruct(file->camera, file->cameraName); // Mosaicked FPA for pattern 18 19 … … 34 35 } 35 36 36 if (chip->cell ->n > 1) {37 if (chip->cells->n > 1) { 37 38 psError(PPBACKGROUND_ERR_CONFIG, true, 38 39 "Input image and background model should be chip-mosaicked"); … … 44 45 pmFPAfileActivate(config->files, true, "PPBACKGROUND.PATTERN"); 45 46 46 pmCell * cell; // Cell with pattern data47 pmCell *patternCell; // Cell with pattern data 47 48 while ((patternCell = pmFPAviewNextCell(view, patternFile->fpa, 1))) { 48 if (! cell->process || !cell->file_exists) {49 if (!patternCell->process || !patternCell->file_exists) { 49 50 continue; 50 51 } … … 68 69 // Get size of image from concepts 69 70 if (numCols == 0 || numRows == 0) { 70 numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE");71 numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE");71 numCols = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.XSIZE"); 72 numRows = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.YSIZE"); 72 73 } 73 74 // Get size of image from TRIMSEC 74 75 if (numCols == 0 || numRows == 0) { 75 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC");76 psRegion *trimsec = psMetadataLookupPtr(NULL, patternCell->concepts, "CELL.TRIMSEC"); 76 77 numCols = trimsec->x1 - trimsec->x0; 77 78 numRows = trimsec->y1 - trimsec->y0; … … 91 92 92 93 // Remove bias sections to avoid warnings 93 psMetadataItem *biassec = psMetadataLookup(pattern RO->parent->concepts, "CELL.BIASSEC");94 psMetadataItem *biassec = psMetadataLookup(patternCell->concepts, "CELL.BIASSEC"); 94 95 if (psListLength(biassec->data.V)) { 95 96 psFree(biassec->data.V); … … 123 124 } 124 125 126 pmChip *patternChip = patternFile ? pmFPAviewThisChip(view, patternMosaic) : NULL; // Chip with pattern 127 pmChip *bgChip = bgFile ? pmFPAviewThisChip(view, bgFile->fpa) : NULL; // Chip with background model 128 if (!ppBackgroundRestore(chip, bgChip, patternChip, view, config)) { 129 psError(psErrorCodeLast(), false, "Unable to replace background"); 130 return false; 131 } 132 pmChipFreeData(patternChip); 125 133 126 127 128 129 130 131 pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, cell); // HDU for readout 132 if (!hdu) { 133 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data."); 134 return false; 135 } 136 if (!hdu->header) { 137 hdu->header = psMetadataAlloc(); 138 } 139 ppBackgroundVersionHeader(hdu->header); 140 141 142 143 144 145 146 134 pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, NULL); // HDU for chip 135 if (!hdu) { 136 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data."); 137 return false; 138 } 139 if (!hdu->header) { 140 hdu->header = psMetadataAlloc(); 141 } 142 ppBackgroundVersionHeader(hdu->header); 147 143 148 144 // Chip … … 158 154 } 159 155 156 psFree(view); 157 psFree(patternMosaic); 158 160 159 return true; 161 160 }
Note:
See TracChangeset
for help on using the changeset viewer.
