Changeset 26682 for trunk/ppImage/src/ppImageDetrendPattern.c
- Timestamp:
- Jan 25, 2010, 9:09:13 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageDetrendPattern.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageDetrendPattern.c
r25930 r26682 5 5 #include "ppImage.h" 6 6 7 #define ESCAPE(MESSAGE) { \ 8 psError(PS_ERR_UNKNOWN, false, MESSAGE); \ 9 psFree(view); \ 10 return false; \ 7 #define ESCAPE(MESSAGE) { \ 8 psError(PS_ERR_UNKNOWN, false, MESSAGE); \ 9 psFree(view); \ 10 return false; \ 11 } 12 13 bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, 14 const ppImageOptions *options) 15 { 16 pmCell *cell = NULL; 17 18 assert (options->doPattern); // do not call if not needed 19 assert (inputView->chip != -1); 20 assert (inputView->cell == -1); 21 assert (inputView->readout == -1); 22 bool status; 23 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT"); 24 25 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing 26 *view = *inputView; 27 28 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) { 29 if (!cell->process || !cell->file_exists) { 30 continue; 31 } 32 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 33 ESCAPE("load failure for Cell"); 34 } 35 36 if (!cell->data_exists) { 37 continue; 38 } 39 40 if (cell->readouts->n > 1) { 41 psWarning ("Skipping Video Cell for ppImageDetrendPatternApply"); 42 continue; 43 } 44 45 psMetadataItem *doPattern = pmConfigRecipeValueByView(config, RECIPE_NAME, "PATTERN.SUBSET", 46 chip->parent, view); // Do we do pattern sub? 47 if (!doPattern || doPattern->type != PS_DATA_BOOL) { 48 ESCAPE("Unable to determine whether pattern matching should be applied."); 49 } 50 if (!doPattern->data.B) { 51 fprintf(stderr, "*NOT* DOING PATTERN SUBTRACTION FOR %d,%d\n", view->chip, view->cell); 52 continue; 53 } 54 55 fprintf(stderr, "DOING PATTERN SUBTRACTION FOR %d,%d\n", view->chip, view->cell); 56 continue; 57 58 // process each of the readouts 59 pmReadout *readout; // Readout from cell 60 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) { 61 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) { 62 ESCAPE("load failure for Readout"); 63 } 64 if (!readout->data_exists) { 65 continue; 66 } 67 68 // perfore pattern correction 69 if (!pmPatternRow(readout, options->patternOrder, options->patternIter, options->patternRej, 70 options->patternThresh, options->patternMean, options->patternStdev, 71 options->maskValue, options->darkMask)) { 72 psFree(view); 73 return(false); 74 } 75 } 76 } 77 78 psFree(view); 79 return(true); 11 80 } 12 81 13 bool ppImageDetrendPatternApply(pmConfig *config, pmChip *chip, const pmFPAview *inputView, const ppImageOptions *options) {14 82 15 16 pmCell *cell = NULL;17 18 assert (options->doPattern); // do not call if not needed19 assert (inputView->chip != -1);20 assert (inputView->cell == -1);21 assert (inputView->readout == -1);22 bool status;23 pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");24 25 pmFPAview *view = pmFPAviewAlloc(0); // View for local processing26 *view = *inputView;27 28 while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {29 if (!cell->process || !cell->file_exists) {30 continue;31 }32 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {33 ESCAPE("load failure for Cell");34 }35 36 if (!cell->data_exists) {37 continue;38 }39 40 if (cell->readouts->n > 1) {41 psWarning ("Skipping Video Cell for ppImageDetrendPatternApply");42 continue;43 }44 45 // process each of the readouts46 pmReadout *readout; // Readout from cell47 while ((readout = pmFPAviewNextReadout (view, input->fpa, 1)) != NULL) {48 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {49 ESCAPE("load failure for Readout");50 }51 if (!readout->data_exists) {52 continue;53 }54 55 // perfore pattern correction56 if (!pmPatternRow(readout, options->patternOrder, options->patternIter, options->patternRej,57 options->patternThresh, options->patternMean, options->patternStdev,58 options->maskValue, options->darkMask)) {59 psFree(view);60 return(false);61 }62 }63 }64 65 psFree(view);66 return(true);67 }68 69
Note:
See TracChangeset
for help on using the changeset viewer.
