Changeset 12592 for trunk/dvoTools/src/dvoMakeCorrUnbin.c
- Timestamp:
- Mar 26, 2007, 5:36:18 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/dvoTools/src/dvoMakeCorrUnbin.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dvoTools/src/dvoMakeCorrUnbin.c
r11805 r12592 26 26 assert (trimsec); 27 27 28 // dimensions of input image: 29 int nx = inData->image->numCols; 30 int ny = inData->image->numRows; 28 // I have the fine and ruff image sizes, determine the binning factor 29 psImageBinning *binning = psImageBinningAlloc(); 30 binning->nXruff = inData->numCols; 31 binning->nYruff = inData->numRows; 32 binning->nXfine = trimsec->x1 - trimsec->x0; 33 binning->nYfine = trimsec->y1 - trimsec->y0; 34 psImageBinningSetBinning (binning, PS_IMAGE_BINNING_CENTER); 35 psImageBinningSetSkip(binning, inData); 31 36 32 // dimensions of output image: 33 int Nx = trimsec->x1 - trimsec->x0; 34 int Ny = trimsec->y1 - trimsec->y0; 35 36 // choose the binning factor which would yield nx,ny pixels from Nx,Ny 37 int DX = Nx / nx; // 36 / 3 = 12, 35 / 3 = 11, 34 / 3 = 11 38 if (Nx % nx) DX ++; // 36, 35, 34 -> DX = 12 39 int xOffset = (Nx % nx) / 2; // for nx = 3, xOffset = 0 or 1 40 41 int DY = Ny / ny; 42 if (Ny % ny) DY ++; 43 int yOffset = (Ny % ny) / 2; 44 37 // construct the supporing pmFPA/pmChip/pmCell structures 45 38 pmReadout *outData = pmFPAviewThisReadout (view, outFile->fpa); 46 39 if (outData == NULL) { … … 48 41 pmChip *outChip = pmFPAviewThisChip (view, outFile->fpa); 49 42 50 pmChipCopyStructure (outChip, inChip, DX, DY);43 pmChipCopyStructure (outChip, inChip, binning->nXbin, binning->nYbin); 51 44 outData = pmFPAviewThisReadout (view, outFile->fpa); 52 45 assert (outData != NULL); 53 46 } 54 47 55 psImageRecycle (outData->image, Nx, Ny, PS_TYPE_F32); 48 // generate the output (fine-scale) image array 49 psImageRecycle (outData->image, binning->nXfine, binning->nYfine, PS_TYPE_F32); 56 50 57 // linear interpolation to full -scale58 if (!psImageUnbin (outData->image, inData->image, DX, DY, xOffset, yOffset)) {51 // linear interpolation to full fine scale 52 if (!psImageUnbin (outData->image, inData->image, binning)) { 59 53 psError (PS_ERR_UNKNOWN, true, "failed to unbin image"); 54 psFree (binning); 60 55 return false; 61 56 } … … 74 69 // exit (0); 75 70 71 psFree (binning); 76 72 return true; 77 73 }
Note:
See TracChangeset
for help on using the changeset viewer.
