IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 15, 2008, 10:25:00 AM (18 years ago)
Author:
eugene
Message:

re-organization of the named mask bit handling: pmConfigMaskSetBits now assigns the bits to names and make the recipe consistent

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

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAMaskWeight.h

    r17732 r18554  
    55 * @author Eugene Magnier, IfA
    66 *
    7  * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    8  * @date $Date: 2008-05-17 02:42:01 $
     7 * @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     8 * @date $Date: 2008-07-15 20:25:00 $
    99 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    3232    PM_MASK_MARK     = 0x80,            ///< The pixel is marked as temporarily ignored
    3333} pmMaskValue;
    34 #else
    3534#define PM_MASK_MARK 0x80            ///< The pixel is marked as temporarily ignored
    3635#define PM_MASK_SAT  0x04            ///< The pixel is saturated in the image of interest
     
    4342/// iterating using pmReadoutReadNext, in which case the HDU can't be generated.
    4443bool pmReadoutSetMask(pmReadout *readout, ///< Readout for which to set mask
    45                       psMaskType sat ///< Mask value to give saturated pixels
    46                       psMaskType bad    ///< Mask value to give bad (low) pixels
     44                      psMaskType satMask, ///< Mask value to give saturated pixels
     45                      psMaskType badMask  ///< Mask value to give bad (low) pixels
    4746    );
    4847
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r18061 r18554  
    1010#include "pmErrorCodes.h"
    1111#include "pmConfig.h"
     12#include "pmConfigMask.h"
    1213#include "pmDetrendDB.h"
    1314
     
    489490        psFree(realName);
    490491        return NULL;
     492    }
     493
     494    if (file->type == PM_FPA_FILE_MASK) {
     495        if (!pmConfigMaskReadHeader (config, phu)) {
     496            psError(PS_ERR_IO, false, "error in mask bits");
     497            return NULL;
     498        }
    491499    }
    492500
     
    660668    file->fileLevel = input->fileLevel;
    661669
     670
    662671    // define the rule to identify these files in the file->names data
    663672    psFree (file->filerule);
     
    735744        psMetadataAddStr (file->names, PS_LIST_TAIL, name, 0, "", infiles->data[i]);
    736745
     746        if ((i == 0) && (file->type == PM_FPA_FILE_MASK)) {
     747            if (!pmConfigMaskReadHeader (config, phu)) {
     748                psError(PS_ERR_IO, false, "error in mask bits");
     749                return NULL;
     750            }
     751        }
     752
    737753        psFree(view);
    738754        psFree(name);
     
    806822        psFree(formatName);
    807823        return NULL;
     824    }
     825
     826    if (file->type == PM_FPA_FILE_MASK) {
     827        if (!pmConfigMaskReadHeader (config, phu)) {
     828            psError(PS_ERR_IO, false, "error in mask bits");
     829            return NULL;
     830        }
    808831    }
    809832
  • trunk/psModules/src/camera/pmFPAfileFitsIO.c

    r18330 r18554  
    77
    88#include "pmConfig.h"
     9#include "pmConfigMask.h"
    910#include "pmDetrendDB.h"
    1011
     
    496497    }
    497498
     499    // whenever we write out a mask image, we should define the bits which represent mask concepts
     500    if (file->type == PM_FPA_FILE_MASK) {
     501        assert (phu->header);
     502        if (!pmConfigMaskWriteHeader (config, phu->header)) {
     503            psError(PS_ERR_UNKNOWN, false, "failed to set the bitmask names in the PHU header for Image %s (%s)\n", file->filename, file->name);
     504            return false;
     505        }
     506    }
     507
    498508    switch (file->fileLevel) {
    499509      case PM_FPA_LEVEL_FPA:
  • trunk/psModules/src/camera/pmFPAfileIO.c

    r18330 r18554  
    99
    1010#include "pmConfig.h"
     11#include "pmConfigMask.h"
    1112#include "pmDetrendDB.h"
    1213
     
    428429            }
    429430            pmConfigConformHeader(hdu->header, file->format);
     431
     432            // whenever we write out a mask image, we should define the bits which represent mask concepts
     433            if (file->type == PM_FPA_FILE_MASK) {
     434                assert (hdu->header);
     435                if (!pmConfigMaskWriteHeader (config, hdu->header)) {
     436                    psError(PS_ERR_UNKNOWN, false, "failed to set the bitmask names in the PHU header for Image %s (%s)\n", file->filename, file->name);
     437                    return false;
     438                }
     439            }
    430440        }
    431441
     
    792802          }
    793803
     804          // XXX if we have a mask file, then we need to read the mask bit names
     805          // defined for this file
     806          if (file->type == PM_FPA_FILE_MASK) {
     807            if (!pmConfigMaskReadHeader (config, phu)) {
     808                psError(PS_ERR_IO, false, "error in mask bits");
     809                return false;
     810            }
     811          }
     812
    794813          // determine the current format from the header
    795814          // determine camera if not specified already
  • trunk/psModules/src/camera/pmHDUUtils.c

    r12768 r18554  
    99#include "pmFPA.h"
    1010#include "pmHDUUtils.h"
     11
     12pmHDU *pmHDUGetFirst (const pmFPA *fpa) {
     13
     14    // XXX we probably should have an indicator in pmFPA about the depths.
     15
     16    if (!fpa) return NULL;
     17    if (fpa->hdu) return fpa->hdu;
     18
     19    for (int i = 0; i < fpa->chips->n; i++) {
     20        pmChip *chip = fpa->chips->data[i];
     21        if (!chip) continue;
     22        if (chip->hdu) return chip->hdu;
     23        if (!chip->cells) continue;
     24        for (int j = 0; j < chip->cells->n; j++) {
     25            pmCell *cell = chip->cells->data[j];
     26            if (!cell) continue;
     27            if (cell->hdu) return cell->hdu;
     28        }
     29    }
     30    return NULL;
     31}
    1132
    1233pmHDU *pmHDUFromFPA(const pmFPA *fpa)
  • trunk/psModules/src/camera/pmHDUUtils.h

    r12696 r18554  
    44 * @author Paul Price, IfA
    55 *
    6  * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    7  * @date $Date: 2007-03-30 21:12:56 $
     6 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     7 * @date $Date: 2008-07-15 20:25:00 $
    88 * Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    99 */
     
    1414/// @addtogroup Camera Camera Layout
    1515/// @{
     16
     17/// Get the first HDU encountered in the hierarchy
     18pmHDU *pmHDUGetFirst (const pmFPA *fpa);
    1619
    1720/// Get the lowest HDU in the hierarchy
Note: See TracChangeset for help on using the changeset viewer.