Changeset 7732
- Timestamp:
- Jun 28, 2006, 9:33:41 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotImageMedian.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotImageMedian.c
r7582 r7732 6 6 { 7 7 bool status; 8 pmFPA *inFPA; 9 pmFPAfile *file; 8 10 psRegion region; 9 11 int MAX_SAMPLE_PIXELS; 12 13 pmReadout *model = NULL; 14 pmReadout *readout = NULL; 15 pmReadout *background = NULL; 16 pmReadout *backSub = NULL; 10 17 11 18 psTimerStart ("psphot"); … … 31 38 32 39 // find the currently selected readout 33 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT"); 40 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.INPUT"); 41 inFPA = file->fpa; 42 readout = pmFPAviewThisReadout (view, inFPA); 34 43 35 44 psImage *image = readout->image; … … 53 62 54 63 // select model pixels (from output background model file, or create internal file) 55 pmReadout *model = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKMDL");56 if ( model== NULL) {57 // select model pixels, from output background model file, or create 64 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKMDL"); 65 if (file == NULL) { 66 // we are not using PSPHOT.BACKMDL as an I/O file: define an internal version 58 67 model = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKMDL", nx, ny, PS_TYPE_F32); 59 68 } else { 60 // replace the supplied image data with an image of the desired size 61 psImageRecycle (model->image, nx, ny, PS_TYPE_F32); 69 // we are using PSPHOT.BACKMDL as an I/O file: select readout or create 70 model = pmFPAviewThisReadout (view, file->fpa); 71 if (model == NULL) { 72 // readout does not yet exist: create from input 73 pmFPAfileCopyStructureView (file->fpa, inFPA, DX, DY, view); 74 model = pmFPAviewThisReadout (view, file->fpa); 75 if (nx != model->image->numCols) psAbort ("psphot", "inconsistent size"); 76 if (ny != model->image->numRows) psAbort ("psphot", "inconsistent size"); 77 } 62 78 } 63 79 psF32 **modelData = model->image->data.F32; … … 107 123 108 124 // select background pixels, from output background file, or create 109 pmReadout *background = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKGND"); 110 if (background == NULL) { 125 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKGND"); 126 if (file) { 127 // we are using PSPHOT.BACKMDL as an I/O file: select readout or create 128 background = pmFPAviewThisReadout (view, file->fpa); 129 if (background == NULL) { 130 // readout does not yet exist: create from input 131 pmFPAfileCopyStructureView (file->fpa, inFPA, 1, 1, view); 132 background = pmFPAviewThisReadout (view, file->fpa); 133 if (Nx != background->image->numCols) psAbort ("psphot", "inconsistent size"); 134 if (Ny != background->image->numRows) psAbort ("psphot", "inconsistent size"); 135 } 136 } else { 111 137 background = pmFPAfileDefineInternal (config->files, "PSPHOT.BACKGND", Nx, Ny, PS_TYPE_F32); 112 138 } … … 118 144 119 145 // back-sub image pixels, from output background file (don't create if not requested) 120 pmReadout *backSub = pmFPAfileThisReadout (config->files, view, "PSPHOT.BACKSUB"); 146 file = psMetadataLookupPtr (&status, config->files, "PSPHOT.BACKSUB"); 147 if (file) { 148 // we are using PSPHOT.BACKMDL as an I/O file: select readout or create 149 backSub = pmFPAviewThisReadout (view, file->fpa); 150 if (backSub == NULL) { 151 // readout does not yet exist: create from input 152 pmFPAfileCopyStructureView (file->fpa, inFPA, 1, 1, view); 153 backSub = pmFPAviewThisReadout (view, file->fpa); 154 } 155 } 121 156 122 // psphotSaveImage (NULL, image, "image.fits"); 123 // psphotSaveImage (NULL, background->image, "back.fits"); 124 // psphotSaveImage (NULL, mask, "mask.fits"); 157 # ifdef TESTSAVE 158 psphotSaveImage (NULL, image, "image.fits"); 159 psphotSaveImage (NULL, background->image, "back.fits"); 160 psphotSaveImage (NULL, mask, "mask.fits"); 161 psphotSaveImage (NULL, model->image, "backmdl.fits"); 162 # endif 125 163 126 164 // subtract the background model (save in backSub, if requested) … … 136 174 } 137 175 138 // if (backSub) psphotSaveImage (NULL, backSub->image, "backsub.fits"); 139 // psphotSaveImage (NULL, model->image, "backmdl.fits");140 // psphotSaveImage (NULL, background->image, "backgnd.fits"); 176 # ifdef TESTSAVE 177 psphotSaveImage (NULL, image, "backsub.fits"); 178 # endif 141 179 142 180 psLogMsg ("psphot", 3, "subtracted background model: %f sec\n", psTimerMark ("psphot"));
Note:
See TracChangeset
for help on using the changeset viewer.
