IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 18, 2010, 6:21:02 AM (16 years ago)
Author:
bills
Message:

Fix a couple of problems with desreaking raw images

  1. They aren't type F32
  2. The technique I was using to handle image cubes was incompatible with ppImage. Now I write out the image cube with the pixels set to the excise value
File:
1 edited

Legend:

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

    r26477 r26622  
    197197        psMetadataAddF32(sfiles->stats, PS_LIST_TAIL, "CENSOR_SOURCES", PS_META_REPLACE, "", cs_t);
    198198
    199 
    200199        // write the destreaked "temporary" images and the recovery images
    201200        psTimerStart("WRITE_IMAGES");
     
    205204
    206205        psLogMsg("streaksremove", PS_LOG_INFO, "time to process component %d: %f\n", sfiles->extnum, psTimerClear("PROCESS_COMPONENT"));
     206
    207207    } while (streakFilesNextExtension(sfiles));
    208208
     
    686686    } else {
    687687        // we have an image cube
    688         double initValue;
    689688        if (exciseImageCube) {
    690689            // copy the entire input image to the recovery image
    691690            writeImageCube(sf->recImage, sf->inImage->imagecube, extname, sf->extnum);
    692             initValue = NAN;
    693691        } else {
    694692            // otherwise write it to the output
    695693            writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum);
    696             initValue = 0;
    697         }
    698 
    699         // borrow one of the images from the imagecube and set it to init value
    700         psImage *image = psArrayGet (sf->inImage->imagecube, 0);
    701         psMemIncrRefCounter(image);
    702         psImageInit(image, initValue);
     694        }
     695
     696        // Now deal with the other output image
    703697        if (exciseImageCube) {
    704             sf->outImage->image = image;
    705             writeImage(sf->outImage, extname, sf->extnum);
     698            // Set the values in the imagecube images to NAN and write them to the output image
     699            for (int i = 0; i < psArrayLength(sf->inImage->imagecube); i++) {
     700                psImage *image = psArrayGet (sf->inImage->imagecube, i);
     701                // XXX: NAN isn't right. It should be the integer equivalent. Should use exciseValue
     702                // but it isn't set with this code path. Fix that.
     703                psImageInit(image, 65535);
     704            }
     705            writeImageCube(sf->outImage, sf->inImage->imagecube, extname, sf->extnum);
    706706        } else {
    707             // write zero valued image to reccovery
    708707            if (sf->recImage) {
    709                 sf->recImage->image = image;
    710                 writeImage(sf->recImage, extname, sf->extnum);
     708                // Set the values in the imagecube images to zero
     709                for (int i = 0; i < psArrayLength(sf->inImage->imagecube); i++) {
     710                    psImage *image = psArrayGet (sf->inImage->imagecube, i);
     711                    psImageInit(image, 0);
     712                }
     713                // copy the entire zeroed image to the recovery image
     714                writeImageCube(sf->recImage, sf->inImage->imagecube, extname, sf->extnum);
    711715            }
    712716        }
     
    739743    }
    740744
    741     float imageValue  = sfiles->inImage->image->data.F32[y][x];
    742     if (sfiles->recImage && !isExciseValue(imageValue, sfiles->inImage->exciseValue) ) {
    743         sfiles->recImage->image->data.F32[y][x] = imageValue;
    744     }
    745 
    746     if (sfiles->transparentStreaks == 0) {
    747         sfiles->outImage->image->data.F32[y][x] = exciseValue;
     745    if (sfiles->inImage->image->type.type == PS_TYPE_U16) {
     746        psU16 imageValue  = sfiles->inImage->image->data.U16[y][x];
     747        if (sfiles->recImage && !isExciseValue(imageValue, sfiles->inImage->exciseValue) ) {
     748            sfiles->recImage->image->data.U16[y][x] = imageValue;
     749        }
     750
     751        if (sfiles->transparentStreaks == 0) {
     752            sfiles->outImage->image->data.U16[y][x] = exciseValue;
     753        } else {
     754            if (streak) {
     755                // as a visualization aid don't mask the pixel, just change the intensity
     756                sfiles->outImage->image->data.U16[y][x] = imageValue + sfiles->transparentStreaks;
     757            } else {
     758                sfiles->outImage->image->data.U16[y][x] = exciseValue;
     759            }
     760        }
    748761    } else {
    749         if (streak) {
    750             // as a visualization aid don't mask the pixel, just change the intensity
    751             sfiles->outImage->image->data.F32[y][x] = imageValue + sfiles->transparentStreaks;
     762        float imageValue  = sfiles->inImage->image->data.F32[y][x];
     763        if (sfiles->recImage && !isExciseValue(imageValue, sfiles->inImage->exciseValue) ) {
     764            sfiles->recImage->image->data.F32[y][x] = imageValue;
     765        }
     766
     767        if (sfiles->transparentStreaks == 0) {
     768            sfiles->outImage->image->data.F32[y][x] = exciseValue;
    752769        } else {
    753             sfiles->outImage->image->data.F32[y][x] = exciseValue;
     770            if (streak) {
     771                // as a visualization aid don't mask the pixel, just change the intensity
     772                sfiles->outImage->image->data.F32[y][x] = imageValue + sfiles->transparentStreaks;
     773            } else {
     774                sfiles->outImage->image->data.F32[y][x] = exciseValue;
     775            }
    754776        }
    755777    }
Note: See TracChangeset for help on using the changeset viewer.