- Timestamp:
- Aug 26, 2009, 4:56:14 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/cleanup/ppImage/src/ppImageBurntoolMask.c
r25159 r25210 3 3 #endif 4 4 5 #define PPIMAGE_BURNTOOL_DEBUG 1 6 5 7 #include "ppImage.h" 6 8 7 bool ppImageBurntoolMask (pmConfig *config, ppImageOptions *options, pmFPAview *view) { 8 9 bool ppImageBurntoolMask (pmConfig *config, ppImageOptions *options, pmFPAview *view,pmReadout *mask) { 9 10 bool status = true; 11 int burntool_cell; 12 /* Find input filename */ 10 13 pmFPAfile *inputFile = psMetadataLookupPtr(&status , config->files, "PPIMAGE.INPUT"); 11 14 if (!status) { … … 13 16 return(false); 14 17 } 15 16 18 psFits *fits = inputFile->fits; 17 19 20 /* Read input header, and find the burntool data table. */ 21 psMetadata *phu = psFitsReadHeader(NULL, fits); 22 18 23 if (!psFitsMoveExtName(fits,"burntool_areas")) { 19 24 psError(PS_ERR_IO,false, "Unable to find extension burntool_areas"); … … 21 26 } 22 27 long Nrows = psFitsTableSize(fits); 28 23 29 long row = 0; 24 25 p mFPAview *detview = pmFPAviewAlloc(0);26 *detview = *view; 27 detview->readout = 0;28 pmReadout *mask = pmFPAfileThisReadout(config->files,detview,"PPIMAGE.MASK");30 31 psLogMsg ("ppImageBurntoolMask", 4, "Inside burntool mask %ld", Nrows); 32 33 /* Redirects and Memory juggling. */ 34 view->readout = 0; 29 35 psImage *image = mask->mask; 30 36 31 psImageMaskType maskValue = psMetadataLookupS32(&status,config->files,"PPIMAGE.BURNTOOL_MASK");32 37 38 /* Set the maskValue from the recipes. */ 39 psImageMaskType maskValue = options->burntoolMask; 40 #ifdef PPIMAGE_BURNTOOL_DEBUG 41 psLogMsg("ppImageBurntoolMask", 4, "Status: %ld %d\n",Nrows,maskValue); 42 #endif 43 44 burntool_cell = view->cell; 45 burntool_cell = (view->cell % 8) * 8 + (view->cell - (view->cell % 8)) / 8; 46 psLogMsg("ppImageBurntoolMask", 4, "Cell mapping: %d %d %d\n",view->cell,burntool_cell,-1); 33 47 for (row = 0; row < Nrows; row++) { 34 48 psMetadata *rowMD = psFitsReadTableRow(fits,row); 35 49 36 if (psMetadataLookupS32(&status,rowMD,"cell") == detview->cell) { 37 38 if (psMetadataLookupS32(&status,rowMD,"func") != -1) { // This should be an actual check 39 50 if (psMetadataLookupS32(&status,rowMD,"cell") == burntool_cell) { 51 if (((options->burntoolTrails & 0x01)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0))|| 52 ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1))|| 53 ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0))) { 54 /* If the fit fails, burntool reports zero here. This 55 signifies that it expected to see a trail (else why 56 fit) but did not find it when it attempted to 57 correct. */ 58 #ifdef PPIMAGE_BURNTOOL_DEBUG 59 psLogMsg ("ppImageBurntoolMask", 4, "Masking! %d (%d %d %d) %d %d", 60 psMetadataLookupS32(&status,rowMD,"cell"), 61 ((options->burntoolTrails & 0x0001)&&(psMetadataLookupS32(&status,rowMD,"nfit") == 0)), 62 ((options->burntoolTrails & 0x02)&&(psMetadataLookupS32(&status,rowMD,"up") == 1)), 63 ((options->burntoolTrails & 0x04)&&(psMetadataLookupS32(&status,rowMD,"up") == 0)), 64 options->burntoolTrails, 65 maskValue 66 ); 67 #endif 40 68 for (int i = psMetadataLookupS32(&status,rowMD,"sxfit"); 41 69 i <= psMetadataLookupS32(&status,rowMD,"exfit"); … … 44 72 if (psMetadataLookupS32(&status,rowMD,"up") == 0) { 45 73 for (int j = 0; j <= psMetadataLookupS32(&status,rowMD,"y1p"); j++) { 74 /* #ifdef PPIMAGE_BURNTOOL_DEBUG */ 75 /* psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n", */ 76 /* i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue); */ 77 /* #endif */ 46 78 image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue; 47 79 } … … 49 81 else { 50 82 for (int j = psMetadataLookupS32(&status,rowMD,"y1m"); j < image->numRows ; j++) { 83 /* #ifdef PPIMAGE_BURNTOOL_DEBUG */ 84 /* psLogMsg("ppImageBurntoolMask", 4, "Noisy!: %d %d %d %d\n", */ 85 /* i,j,image->data.PS_TYPE_IMAGE_MASK_DATA[j][i],maskValue); */ 86 /* #endif */ 51 87 image->data.PS_TYPE_IMAGE_MASK_DATA[j][i] |= maskValue; 52 88 } … … 56 92 } 57 93 } 94 psFree(rowMD); 58 95 } 59 96 psFree(phu); 60 97 return(status); 61 98 }
Note:
See TracChangeset
for help on using the changeset viewer.
