IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 30, 2005, 7:05:28 AM (21 years ago)
Author:
eugene
Message:

cleanups, segfault fixes, etc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageLoop.c

    r5857 r5858  
    11# include "ppImage.h"
    22
    3 bool ppImageLoop (ppData *data, ppRecipe *options, ppConfig *config) {
     3bool ppImageLoop (ppData *data, ppOptions *options, ppConfig *config) {
    44
    5     psArray *inputChips = data->input->chips; // Array of chips in input image
    6     psArray *biasChips  = data->bias->chips;  // Array of chips in bias image
    7     psArray *darkChips  = data->dark->chips;  // Array of chips in dark image
    8     psArray *maskChips  = data->mask->chips;  // Array of chips in mask image
    9     psArray *flatChips  = data->flat->chips;  // Array of chips in flat image
     5    ppDetrend detrend;
    106
    11     for (int i = 0; i < inputChips->n; i++) {
    12         pmChip *inputChip = inputChips->data[i]; // Chip of interest in input image
    13         pmChip *biasChip  = biasChips->data[i];  // Chip of interest in bias image
    14         pmChip *darkChip  = darkChips->data[i];  // Chip of interest in dark image
    15         pmChip *maskChip  = maskChips->data[i];  // Chip of interest in mask image
    16         pmChip *flatChip  = flatChips->data[i];  // Chip of interest in flat image
     7    if (options->imageLoadDepth == PP_LOAD_FPA) {
     8        ppImageLoadPixels (data->input, data->process, config->database, -1, -1);
     9        ppImageLoadPixels (data->bias,  data->process, config->database, -1, -1);
     10        ppImageLoadPixels (data->dark,  data->process, config->database, -1, -1);
     11        ppImageLoadPixels (data->mask,  data->process, config->database, -1, -1);
     12        ppImageLoadPixels (data->flat,  data->process, config->database, -1, -1);
     13    }
     14    for (int i = 0; i < data->input->fpa->chips->n; i++) {
     15        pmChip *inputChip = data->input->fpa->chips->data[i]; // Chip of interest in input image
     16        pmChip *biasChip  = data->bias->fpa->chips->data[i];  // Chip of interest in bias image
     17        pmChip *darkChip  = data->dark->fpa->chips->data[i];  // Chip of interest in dark image
     18        pmChip *maskChip  = data->mask->fpa->chips->data[i];  // Chip of interest in mask image
     19        pmChip *flatChip  = data->flat->fpa->chips->data[i];  // Chip of interest in flat image
    1720
    1821        if (! inputChip->valid) { continue; }
    1922
    20         psArray *inputCells = inputChip->cells; // Array of cells in input image
    21         psArray *biasCells  = biasChip->cells;  // Array of cells in bias image
    22         psArray *darkCells  = darkChip->cells;  // Array of cells in dark image
    23         psArray *maskCells  = maskChip->cells;  // Array of cells in mask image
    24         psArray *flatCells  = flatChip->cells;  // Array of cells in flat image
     23        if (options->imageLoadDepth == PP_LOAD_CHIP) {
     24            ppImageLoadPixels (data->input, data->process, config->database, i, -1);
     25            ppImageLoadPixels (data->bias,  data->process, config->database, i, -1);
     26            ppImageLoadPixels (data->dark,  data->process, config->database, i, -1);
     27            ppImageLoadPixels (data->mask,  data->process, config->database, i, -1);
     28            ppImageLoadPixels (data->flat,  data->process, config->database, i, -1);
     29        }
     30        for (int j = 0; j < inputChip->cells->n; j++) {
     31            detrend.input = inputChip->cells->data[j]; // Cell of interest in input image
     32            detrend.bias  = biasChip->cells->data[j];  // Cell of interest in bias image
     33            detrend.dark  = darkChip->cells->data[j];  // Cell of interest in dark imag
     34            detrend.mask  = maskChip->cells->data[j];  // Cell of interest in mask image
     35            detrend.flat  = flatChip->cells->data[j];  // Cell of interest in flat image
    2536
    26         for (int j = 0; j < inputCells->n; j++) {
    27             pmCell *inputCell = inputCells->data[j]; // Cell of interest in input image
    28             pmCell *biasCell  = biasCells->data[j];  // Cell of interest in bias image
    29             pmCell *darkCell  = darkCells->data[j];  // Cell of interest in dark imag
    30             pmCell *maskCell  = maskCells->data[j];  // Cell of interest in mask image
    31             pmCell *flatCell  = flatCells->data[j];  // Cell of interest in flat image
     37            if (! detrend.input->valid) { continue; }
    3238
    33             if (! inputCell->valid) { continue; }
    34 
    35             ppReadoutDetrend (inputCell, maskCell, biasCell, darkCell, flatCell);
     39            if (options->imageLoadDepth == PP_LOAD_CELL) {
     40                ppImageLoadPixels (data->input, data->process, config->database, i, j);
     41                ppImageLoadPixels (data->bias,  data->process, config->database, i, j);
     42                ppImageLoadPixels (data->dark,  data->process, config->database, i, j);
     43                ppImageLoadPixels (data->mask,  data->process, config->database, i, j);
     44                ppImageLoadPixels (data->flat,  data->process, config->database, i, j);
     45            }
     46            ppDetrendCell (&detrend, options, config);
    3647        }
    3748    }
    3849    return true;
    3950}
     51
     52/* if we allow per-readout loads, we need to load detrend images here */
Note: See TracChangeset for help on using the changeset viewer.