IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27467


Ignore:
Timestamp:
Mar 26, 2010, 11:27:28 AM (16 years ago)
Author:
bills
Message:

various changes to get destreaking of raw files correct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksio.c

    r27233 r27467  
    811811    }
    812812    streaksVersionHeaderFull(sfile->header);
     813
    813814    if (!psFitsWriteImage(sfile->fits, sfile->header, sfile->image, 0, extname)) {
    814815        psError(PS_ERR_IO, false, "failed to write image to %s extnum: %d",
     
    871872closeImages(streakFiles *sf)
    872873{
     874    if (sf->stage == IPP_STAGE_RAW) {
     875        if (sf->view) {
     876            sf->view->readout = -1;
     877            pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER);
     878            sf->view->cell = -1;
     879            pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER);
     880            sf->view->chip = -1;
     881            pmFPAfileIOChecks(sf->config, sf->view, PM_FPA_AFTER);
     882        }
     883    }
    873884    closeImage(sf->inImage);
    874885    closeImage(sf->outImage);
     
    11231134
    11241135        psImage *image = sfiles->outImage->image;
     1136        int imageType = image->type.type;
    11251137        double exciseValue = sfiles->inImage->exciseValue;
    11261138
     
    11431155                // these gets are not necessary, we could just set the pixels to nan
    11441156                // but I want to get the counts
    1145                 double imageVal  = image->data.F32[y][x];
     1157                double imageVal;
     1158                if (imageType == PS_TYPE_F32) {
     1159                    imageVal  = image->data.F32[y][x];
     1160                } else if (imageType == PS_TYPE_S16) {
     1161                    imageVal = image->data.S16[y][x];
     1162                } else if (imageType == PS_TYPE_U16) {
     1163                    imageVal = image->data.U16[y][x];
     1164                } else {
     1165                    psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n",
     1166                                imageType);
     1167                    streaksExit("", PS_EXIT_PROG_ERROR);
     1168                }
    11461169                psU32 maskVal;
    11471170                if (sfiles->stage == IPP_STAGE_RAW) {
     
    11561179                    if (!isExciseValue(imageVal, exciseValue)) {
    11571180                        ++nandPixels;
    1158                         image->data.F32[y][x] = exciseValue;
     1181                        if (imageType == PS_TYPE_F32) {
     1182                            image->data.F32[y][x] = exciseValue;
     1183                        } else if (imageType == PS_TYPE_S16) {
     1184                            image->data.S16[y][x] = exciseValue;
     1185                        } else if (imageType == PS_TYPE_U16) {
     1186                            image->data.U16[y][x] = exciseValue;
     1187                        } else {
     1188                            psError(PS_ERR_PROGRAMMING, true, "unexpected image type found: %d\n",
     1189                                imageType);
     1190                            streaksExit("", PS_EXIT_PROG_ERROR);
     1191                        }
    11591192                    }
    11601193                    if (weight) {
Note: See TracChangeset for help on using the changeset viewer.