IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 7, 2008, 6:37:16 PM (18 years ago)
Author:
Paul Price
Message:

Making progress with refactoring of ppStack for optimisation. This version of the code does NOT yet work.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pap_branch_080207/ppStack/src/ppStackCamera.c

    r15844 r16367  
    1010
    1111#include "ppStack.h"
     12
     13
     14// Define an output convolved image file
     15static pmFPAfile *defineOutputConvolved(const char *name, // FPA file name
     16                                        pmFPA *fpa, // FPA to bind
     17                                        const pmConfig *config, // Configuration
     18                                        pmFPAfileType type // Expected type
     19    )
     20{
     21    pmFPAfile *file = pmFPAfileDefineOutput(config, fpa, name);
     22    if (!file) {
     23        psError(PS_ERR_UNKNOWN, false, "Unable to define output convolved file %s", name);
     24        return NULL;
     25    }
     26    if (file->type != PM_FPA_FILE_IMAGE) {
     27        psError(PS_ERR_IO, true, "PPSTACK.OUTCONV is not of type %s", pmFPAfileStringFromType(type));
     28        return NULL;
     29    }
     30
     31    return file;
     32}
     33
     34// Define an input convolved image file, using the output as a basis
     35static pmFPAfile *defineInputConvolved(const char *inputName, // Input FPA file name
     36                                       pmFPAfile *outFile, // Corresponding output FPA file
     37                                       pmConfig *config, // Configuration
     38                                       pmFPAfileType type // Expected type
     39    )
     40{
     41    pmFPAview *view = pmFPAviewAlloc(0); // View into sky cells
     42    view->chip = view->cell = view->readout = 0;
     43
     44    psString imageName = pmFPANameFromRule(outFile->filerule, outFile->fpa, view);
     45    psArray *imageNames = psArrayAlloc(1);
     46    imageNames->data[0] = imageName;
     47    psMetadataAddArray(config->arguments, PS_LIST_TAIL, "INCONV.FILENAMES", PS_META_REPLACE,
     48                       "Filenames of input convolved image files", imageNames);
     49    psFree(imageNames);
     50    bool found = false;                 // Found the file?
     51    pmFPAfile *imageFile = pmFPAfileDefineFromArgs(&found, config, "PPSTACK.INCONV",
     52                                                   "INCONV.FILENAMES");
     53    psMetadataRemoveKey(config->arguments, "INCONV.FILENAMES");
     54    if (!imageFile || !found) {
     55        psError(PS_ERR_UNKNOWN, false, "Unable to define %s file", inputName);
     56        return NULL;
     57    }
     58    if (imageFile->type != type) {
     59        psError(PS_ERR_IO, true, "PPSTACK.INCONV is not of type %s",
     60                pmFPAfileStringFromType(type));
     61        return NULL;
     62    }
     63
     64    return imageFile;
     65}
     66
     67
     68
    1269
    1370bool ppStackCamera(pmConfig *config)
     
    138195            }
    139196        }
     197
     198        // Output convolved files
     199        pmFPAfile *outconvImage  = defineOutputConvolved("PPSTACK.OUTCONV", imageFile->fpa, config,
     200                                                         PM_FPA_FILE_IMAGE);
     201        pmFPAfile *outconvMask   = defineOutputConvolved("PPSTACK.OUTCONV.MASK", imageFile->fpa, config,
     202                                                         PM_FPA_FILE_MASK);
     203        pmFPAfile *outconvWeight = defineOutputConvolved("PPSTACK.OUTCONV.WEIGHT", imageFile->fpa, config,
     204                                                         PM_FPA_FILE_WEIGHT);
     205        if (!outconvImage || !outconvMask || !outconvWeight) {
     206            return false;
     207        }
     208
     209        // Input convolved files
     210        pmFPAfile *inconvImage  = defineInputConvolved("PPSTACK.INCONV", outconvImage, config,
     211                                                       PM_FPA_FILE_IMAGE);
     212        pmFPAfile *inconvMask   = defineInputConvolved("PPSTACK.INCONV.MASK", outconvMask, config,
     213                                                       PM_FPA_FILE_MASK);
     214        pmFPAfile *inconvWeight = defineInputConvolved("PPSTACK.INCONV.WEIGHT", outconvWeight, config,
     215                                                       PM_FPA_FILE_WEIGHT);
     216        if (!inconvImage || !inconvMask || !inconvWeight) {
     217            return false;
     218        }
     219
    140220
    141221        psMetadataAddF32(imageFile->fpa->analysis, PS_LIST_TAIL, "PPSTACK.WEIGHTING", 0,
Note: See TracChangeset for help on using the changeset viewer.