IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 6, 2006, 5:27:52 PM (20 years ago)
Author:
Paul Price
Message:

Moving additional pslib functions over to psLib proper. Some API changes.

Location:
trunk/psModules/src/camera
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmChipMosaic.c

    r7278 r7382  
    11#include <stdio.h>
    22#include <assert.h>
    3 #include "pslib.h"
     3#include <pslib.h>
    44#include "pmFPA.h"
    55#include "pmHDU.h"
    6 #include "psRegionIsBad.h"
    76
    87
     
    5251        pmCell *cell = cells->data[i];  // Cell of interest
    5352        psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
    54         if (!mdok || !trimsec || psRegionIsBad(*trimsec)) {
     53        if (!mdok || !trimsec || psRegionIsNaN(*trimsec)) {
    5554            psError(PS_ERR_IO, true, "CELL.TRIMSEC hasn't been set for cell %d.\n", i);
    5655            return false;
     
    8685        psRegion *biassec = NULL;       // Bias section from iteration
    8786        while ((biassec = psListGetAndIncrement(biassecsIter))) {
    88             if (psRegionIsBad(*biassec)) {
     87            if (psRegionIsNaN(*biassec)) {
    8988                continue;
    9089            }
  • trunk/psModules/src/camera/pmFPACopy.c

    r7278 r7382  
    22#include <assert.h>
    33
    4 #include "pslib.h"
    5 #include "psImageFlip.h"
    6 #include "psRegionIsBad.h"
     4#include <pslib.h>
    75
    86#include "pmFPA.h"
     
    1715// File-static functions
    1816//////////////////////////////////////////////////////////////////////////////////////////////////////////////
    19 
    20 // Copy pixels from a target image to a source image, with flips
    21 static psImage *copyPixels(psImage *source, // Source image (from source cell)
    22                            bool xFlip,      // Flip in x?
    23                            bool yFlip       // Flip in y?
    24                           )
    25 {
    26     assert(source);
    27 
    28     psImage *copy = psMemIncrRefCounter(source);
    29     bool copied = false;                // Have the pixels been copied?
    30     if (xFlip) {
    31         psImage *temp = psImageFlipX(copy); // Flipped version
    32         psFree(copy);
    33         copy = temp;
    34         copied = true;
    35     }
    36     if (yFlip) {
    37         psImage *temp = psImageFlipY(copy); // Flipped version
    38         psFree(copy);
    39         copy = temp;
    40         copied = true;
    41     }
    42     if (!copied) {
    43         psFree(copy);
    44         copy = psImageCopy(NULL, source, source->type.type);
    45     }
    46 
    47     return copy;
    48 }
    4917
    5018// Bin a region down by specified factors in x and y
     
    154122                    psFree(targetReadout->image);
    155123                }
    156                 targetReadout->image = copyPixels(sourceReadout->image, xFlip, yFlip);
     124                targetReadout->image = psImageFlip(NULL, sourceReadout->image, xFlip, yFlip);
    157125            }
    158126
     
    162130                    psFree(targetReadout->mask);
    163131                }
    164                 targetReadout->mask = copyPixels(sourceReadout->mask, xFlip, yFlip);
     132                targetReadout->mask = psImageFlip(NULL, sourceReadout->mask, xFlip, yFlip);
    165133            }
    166134
     
    170138                    psFree(targetReadout->weight);
    171139                }
    172                 targetReadout->weight = copyPixels(sourceReadout->weight, xFlip, yFlip);
     140                targetReadout->weight = psImageFlip(NULL, sourceReadout->weight, xFlip, yFlip);
    173141            }
    174142
     
    181149            psImage *bias = NULL;           // Bias image from iteration
    182150            while ((bias = psListGetAndIncrement(biasIter))) {
    183                 psImage *biasCopy = copyPixels(bias, xFlip, yFlip);
     151                psImage *biasCopy = psImageFlip(NULL, bias, xFlip, yFlip);
    184152                psListAdd(targetReadout->bias, PS_LIST_TAIL, biasCopy);
    185153                psFree(biasCopy);           // Drop reference
     
    209177    if (xBin != 1 || yBin != 1) {
    210178        psRegion *trimsec = psMetadataLookupPtr(&mdok, target->concepts, "CELL.TRIMSEC"); // The trim section
    211         if (mdok && trimsec && !psRegionIsBad(*trimsec)) {
     179        if (mdok && trimsec && !psRegionIsNaN(*trimsec)) {
    212180            binRegion(trimsec, xBin, yBin);
    213181        }
     
    217185            psRegion *biassec = NULL;   // Bias section, from iteration
    218186            while ((biassec = psListGetAndIncrement(biassecsIter))) {
    219                 if (!psRegionIsBad(*biassec)) {
     187                if (!psRegionIsNaN(*biassec)) {
    220188                    binRegion(biassec, xBin, yBin);
    221189                }
  • trunk/psModules/src/camera/pmFPARead.c

    r7311 r7382  
    88#include "pmHDUUtils.h"
    99#include "pmConcepts.h"
    10 #include "psRegionIsBad.h"
    1110#include "pmFPAHeader.h"
    1211
     
    3332
    3433    // The image corresponding to the trim region
    35     if (psRegionIsBad(*trimsec)) {
     34    if (psRegionIsNaN(*trimsec)) {
    3635        psString regionString = psRegionToString(*trimsec);
    3736        psError(PS_ERR_UNKNOWN, true, "Invalid trim section: %s\n", regionString);
     
    5958    psRegion *biassec = NULL;       // A BIASSEC region from the list
    6059    while ((biassec = psListGetAndIncrement(iter))) {
    61         if (psRegionIsBad(*biassec)) {
     60        if (psRegionIsNaN(*biassec)) {
    6261            psString regionString = psRegionToString(*biassec);
    6362            psError(PS_ERR_IO, true, "Invalid bias section: %s\n", regionString);
     
    190189    bool mdok = true;                   // Status of MD lookup
    191190    psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim sections
    192     if (!mdok || !trimsec || psRegionIsBad(*trimsec)) {
     191    if (!mdok || !trimsec || psRegionIsNaN(*trimsec)) {
    193192        psError(PS_ERR_IO, true, "CELL.TRIMSEC is not set.\n");
    194193        return false;
  • trunk/psModules/src/camera/pmFPA_JPEG.c

    r7311 r7382  
    55 *  @author EAM, IfA
    66 *
    7  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2006-06-03 01:02:08 $
     7 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2006-06-07 03:27:52 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1717
    1818#include <pslib.h>
    19 # include "psImageJpeg.h"
    20 # include "psImageUnbin.h"
    21 # include "psAdditionals.h"
    2219
    2320#include "pmHDU.h"
     
    141138
    142139        // XXX we need to decide where the scale will come from in the long term
    143         unsigned long seed = 0;
    144         psImageClippedStatsInit (10000, seed);
    145 
    146         psStats *stats = psImageClippedStats (readout->image, NULL, 0, 0.25, 0.75);
     140        psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS, 0);
     141        psStats *stats = psImageBackground(readout->image, NULL, 0, 0.25, 0.75, 10000, rng);
    147142        float delta = stats->robustUQ - stats->robustLQ;
    148143        float min = stats->robustMedian - 3*delta;
     
    162157        psImageJpeg (map, readout->image, name, min, max);
    163158
    164         psFree (name);
    165         psFree (mode);
    166         psFree (word);
    167         psFree (mapname);
    168         psFree (map);
    169         psFree (stats);
    170         psImageClippedStatsCleanup ();
     159        psFree(name);
     160        psFree(mode);
     161        psFree(word);
     162        psFree(mapname);
     163        psFree(map);
     164        psFree(stats);
     165        psFree(rng);
    171166
    172167        return true;
  • trunk/psModules/src/camera/pmFPAfile.c

    r7323 r7382  
    11#include <stdio.h>
    2 #include "pslib.h"
    3 #include "psAdditionals.h"
     2#include <pslib.h>
     3
    44#include "pmConfig.h"
    55#include "pmHDU.h"
  • trunk/psModules/src/camera/pmHDU.c

    r7278 r7382  
    44#include "pslib.h"
    55#include "pmFPA.h"
    6 #include "psAdditionals.h"
    76
    87//////////////////////////////////////////////////////////////////////////////////////////////////////////////
  • trunk/psModules/src/camera/pmHDUGenerate.c

    r7288 r7382  
    66#include "pmHDU.h"
    77#include "pmHDUUtils.h"
    8 #include "psRegionIsBad.h"
    98
    109#include "pmHDUGenerate.h"
     
    6665    while ((cell = psListGetAndIncrement(cellsIter))) {
    6766        psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim section
    68         if (mdok && trimsec && !psRegionIsBad(*trimsec)) {
     67        if (mdok && trimsec && !psRegionIsNaN(*trimsec)) {
    6968            *xSize = PS_MAX(trimsec->x1, *xSize);
    7069            *ySize = PS_MAX(trimsec->y1, *ySize);
     
    7877            psRegion *biassec = NULL;   // The bias section
    7978            while ((biassec = psListGetAndIncrement(biassecsIter))) {
    80                 if (!psRegionIsBad(*trimsec)) {
     79                if (!psRegionIsNaN(*trimsec)) {
    8180                    *xSize = PS_MAX(biassec->x1, *xSize);
    8281                    *ySize = PS_MAX(biassec->y1, *ySize);
Note: See TracChangeset for help on using the changeset viewer.