IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 15, 2007, 2:01:03 PM (19 years ago)
Author:
Paul Price
Message:

Fixing subtraction of nominated kernel. This is used to maintain photometric constancy across the image when using a spatially variable kernel (see Alard 2000). Works for POIS kernels, but not yet for ISIS.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/imcombine/pmSubtraction.c

    r13386 r13389  
    44 *  @author GLG, MHPCC
    55 *
    6  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2007-05-15 04:33:58 $
     6 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2007-05-16 00:01:03 $
    88 *
    99 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    6666    assert(kernels->xOrder->n == numKernels);
    6767    assert(kernels->yOrder->n == numKernels);
     68
     69    // Ensure the subIndex for POIS kernels is what is expected
     70    assert(kernels->type != PM_SUBTRACTION_KERNEL_POIS ||
     71           (kernels->u->data.S32[kernels->subIndex] == 0 && kernels->v->data.S32[kernels->subIndex] == 0 &&
     72            kernels->xOrder->data.S32[kernels->subIndex] == 0 &&
     73            kernels->yOrder->data.S32[kernels->subIndex] == 0));
    6874
    6975    int size = kernels->size;           // Kernel half-size
     
    8288              int v = kernels->v->data.S32[i]; // Offset in y
    8389              kernel->kernel[v][u] += weightFunc(polyValue * solution->data.F64[i]);
     90              if (i != kernels->subIndex) {
     91                  // The (0,0) element is subtracted from most kernels to preserve photometric scaling
     92                  kernel->kernel[0][0] -= weightFunc(solution->data.F64[i]);
     93              }
    8494              break;
    8595          }
     
    119129          int u = kernels->u->data.S32[index]; // Offset in x
    120130          int v = kernels->v->data.S32[index]; // Offset in y
    121           return weightFunc(polyValue) * image->data.F32[y + v][x + u];
     131          double value = weightFunc(polyValue) * image->data.F32[y + v][x + u]; // Value of convolution
     132          if (index != kernels->subIndex) {
     133              // The (0,0) element is subtracted from most kernels to preserve photometric scaling
     134              value -= image->data.F32[y][x];
     135          }
     136          return value;
    122137      }
    123138      case PM_SUBTRACTION_KERNEL_ISIS: {
     
    243258                        convolutions->data.F64[i] = convolvePixel(kernels, i, x, y, reference, polyValues,
    244259                                                                  imageWeighting);
    245                     }
    246 
    247                     if (spatialOrder > 0) {
    248                         // Subtract a nominated convolution, to force flux conservation
    249                         int subIndex = kernels->subIndex; // Index of convolution to subtract
    250                         for (int i = 0; i < subIndex; i++) {
    251                             convolutions->data.F64[i] -= convolutions->data.F64[subIndex];
    252                         }
    253                         for (int i = subIndex + 1; i < numKernels; i++) {
    254                             convolutions->data.F64[i] -= convolutions->data.F64[subIndex];
    255                         }
    256260                    }
    257261
Note: See TracChangeset for help on using the changeset viewer.