Changeset 7629 for trunk/ppImage/src/ppImageRebinReadout.c
- Timestamp:
- Jun 21, 2006, 6:25:28 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageRebinReadout.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageRebinReadout.c
r7621 r7629 19 19 20 20 while ((cell = pmFPAviewNextCell (view, inFile->fpa, 1)) != NULL) { 21 psLogMsg ("ppImageRebinChip", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process);22 if (! cell->process || ! cell->file_exists) { continue; }21 psLogMsg ("ppImageRebinChip", 4, "Cell %d: %x %x\n", view->cell, cell->file_exists, cell->process); 22 if (! cell->process || ! cell->file_exists) { continue; } 23 23 24 // process each of the readouts25 while ((inReadout = pmFPAviewNextReadout (view, inFile->fpa, 1)) != NULL) {26 if (! inReadout->data_exists) { continue; }24 // process each of the readouts 25 while ((inReadout = pmFPAviewNextReadout (view, inFile->fpa, 1)) != NULL) { 26 if (! inReadout->data_exists) { continue; } 27 27 28 outReadout = pmFPAviewThisReadout (view, outFile->fpa);28 outReadout = pmFPAviewThisReadout (view, outFile->fpa); 29 29 30 // run the rebin code 31 ppImageRebinReadout (outReadout, inReadout, outFile); 32 } 30 // run the rebin code 31 ppImageRebinReadout (outReadout, inReadout, outFile); 32 } 33 34 // Get the original values for the binning 35 bool mdok = true; // Status of MD lookup 36 int xBin = psMetadataLookupS32(&mdok, cell->concepts, "CELL.XBIN"); // The binning in x 37 if (!mdok || xBin <= 0) { 38 psLogMsg(__func__, PS_LOG_WARN, "CELL.XBIN is not set --- assuming 1.\n"); 39 xBin = 1; 40 } 41 int yBin = psMetadataLookupS32(&mdok, cell->concepts, "CELL.YBIN"); // The binning in y 42 if (!mdok || yBin <= 0) { 43 psLogMsg(__func__, PS_LOG_WARN, "CELL.YBIN is not set --- assuming 1.\n"); 44 yBin = 1; 45 } 46 47 // Update the concepts with the new values for the binning 48 pmCell *outCell = pmFPAviewThisCell(view, outFile->fpa); // The output cell 49 psMetadataItem *binItem = psMetadataLookup(outCell->concepts, "CELL.XBIN"); 50 binItem->data.S32 = xBin * outFile->xBin; 51 binItem = psMetadataLookup(outCell->concepts, "CELL.YBIN"); 52 binItem->data.S32 = yBin * outFile->yBin; 33 53 } 34 54 return true; … … 53 73 // do the rebinning by hand, mean only for test 54 74 for (int yOut = 0; yOut < output->image->numRows; yOut++) { 55 for (int xOut = 0; xOut < output->image->numCols; xOut++) {56 value = 0;57 nPix = 0;58 for (int yIn = yOut * dY; (yIn < yOut * dY + dY) && (yIn < nY); yIn ++) {59 for (int xIn = xOut * dX; (xIn < xOut * dX + dX) && (xIn < nX); xIn ++) {60 value += input->image->data.F32[yIn][xIn];61 nPix ++;62 }63 }64 output->image->data.F32[yOut][xOut] = value / nPix;65 }75 for (int xOut = 0; xOut < output->image->numCols; xOut++) { 76 value = 0; 77 nPix = 0; 78 for (int yIn = yOut * dY; (yIn < yOut * dY + dY) && (yIn < nY); yIn ++) { 79 for (int xIn = xOut * dX; (xIn < xOut * dX + dX) && (xIn < nX); xIn ++) { 80 value += input->image->data.F32[yIn][xIn]; 81 nPix ++; 82 } 83 } 84 output->image->data.F32[yOut][xOut] = value / nPix; 85 } 66 86 } 67 87
Note:
See TracChangeset
for help on using the changeset viewer.
