Changeset 6838
- Timestamp:
- Apr 11, 2006, 6:10:52 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/astrom/pmFPACopy.c
r6828 r6838 366 366 } 367 367 368 369 static pmHDU *findPHU(const pmCell *cell// The cell for which to find the PHU 370 ) 371 { 372 if (cell->hdu && cell->hdu->phu) { 373 return cell->hdu; 374 } 375 pmChip *chip = cell->parent; // The parent chip 376 if (chip->hdu && chip->hdu->phu) { 377 return chip->hdu; 378 } 379 pmFPA *fpa = chip->parent; // The parent FPA 380 if (fpa->hdu && fpa->hdu->phu) { 381 return fpa->hdu; 382 } 383 384 psError(PS_ERR_IO, true, "Unable to find PHU for target cell.\n"); 385 return NULL; 386 } 387 388 389 static bool copyPHU(pmCell *targetCell, // The target cell 390 pmCell *sourceCell // The source cell 391 ) 392 { 393 // Find the respective PHUs 394 pmHDU *targetPHU = findPHU(targetCell); // The target PHU 395 if (targetPHU->header) { 396 return false; // No work required 397 } 398 // Copy the header over 399 pmHDU *sourcePHU = findPHU(sourceCell); // The source PHU 400 targetPHU->header = psMetadataCopy(NULL, sourcePHU->header); 401 return true; 402 } 403 404 368 405 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 369 406 // File-static engine functions --- these do all the work. Actually, cellCopy does all the work; the others … … 371 408 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 372 409 373 static int cellCopy(pmCell *target, // The target cell374 pmCell *source, // The source cell, to be copied375 bool pixels, // Copy the pixels?376 int xBin, int yBin // (Relative) binning factors in x and y410 static int cellCopy(pmCell *target, // The target cell 411 pmCell *source, // The source cell, to be copied 412 bool pixels, // Copy the pixels? 413 int xBin, int yBin // (Relative) binning factors in x and y 377 414 ) 378 415 { … … 396 433 hdu->header = psMetadataAlloc(); 397 434 } 435 // Copy the PHU over as well, if required 436 copyPHU(target, source); 398 437 399 438 // Need to check/change CELL.XPARITY and CELL.YPARITY … … 485 524 int xZero = psMetadataLookupS32(NULL, source->concepts, "CELL.X0"); // CELL.X0 from source 486 525 int xParity = psMetadataLookupS32(NULL, target->concepts, "CELL.XPARITY"); // Parity in x 487 pmReadout *readout = target->readouts->data[0]; // A representative readout 526 int xBin = psMetadataLookupS32(NULL, source->concepts, "CELL.XBIN"); // CELL.XBIN from source 527 pmReadout *readout = source->readouts->data[0]; // A representative readout 488 528 psTrace(__func__, 3, "CELL.X0: Before: %d After: %d\n", xZero, 489 xZero - (readout->image->numCols - 1) * xParity); 490 xZero -= (readout->image->numCols - 1) * xParity; // Change the parity on the X0 position 529 xZero - (readout->image->numCols - 1) * xParity * xBin); 530 psTrace(__func__, 9, "(xParity: %d xBin: %d numCols: %d)\n", xParity, xBin, readout->image->numCols); 531 xZero -= (readout->image->numCols - 1) * xParity * xBin; // Change the parity on the X0 position 491 532 psMetadataItem *newItem = psMetadataLookup(target->concepts, "CELL.X0"); // CELL.X0 from target 492 533 newItem->data.S32 = xZero; … … 495 536 int yZero = psMetadataLookupS32(NULL, source->concepts, "CELL.Y0"); // CELL.Y0 from source 496 537 int yParity = psMetadataLookupS32(NULL, target->concepts, "CELL.YPARITY"); // Parity in y 497 pmReadout *readout = target->readouts->data[0]; // A representative readout 538 int yBin = psMetadataLookupS32(NULL, source->concepts, "CELL.YBIN"); // Parity in y 539 pmReadout *readout = source->readouts->data[0]; // A representative readout 498 540 psTrace(__func__, 3, "CELL.Y0: Before: %d After: %d\n", yZero, 499 yZero - (readout->image->numCols - 1) * yParity); 500 yZero -= (readout->image->numCols - 1) * yParity; // Change the parity on the Y0 position 541 yZero - (readout->image->numRows - 1) * yParity * yBin); 542 psTrace(__func__, 9, "(yParity: %d yBin: %d numRows: %d)\n", yParity, yBin, readout->image->numRows); 543 yZero -= (readout->image->numRows - 1) * yParity * yBin; // Change the parity on the Y0 position 501 544 psMetadataItem *newItem = psMetadataLookup(target->concepts, "CELL.Y0"); // CELL.Y0 from target 502 545 newItem->data.S32 = yZero;
Note:
See TracChangeset
for help on using the changeset viewer.
