IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 8, 2009, 7:11:00 PM (17 years ago)
Author:
eugene
Message:

implement SVD analysis of the chi-square equation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psModules/src/imcombine/pmSubtractionVisual.c

    r26341 r26373  
    308308    // if (!pmVisualIsVisual()) return true;
    309309
     310    double sum;
     311
    310312    int NXoff = index % NX;
    311313    int NYoff = index / NX;
     
    315317
    316318    // insert the (target) kernel into the (target) image:
     319    sum = 0.0;
    317320    for (int y = -footprint; y <= footprint; y++) {
    318321        for (int x = -footprint; x <= footprint; x++) {
    319322            targetImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x];
    320         }
    321     }
     323            sum += targetImage->data.F32[y + NYpix][x + NXpix];
     324        }
     325    }
     326    targetImage->data.F32[footprint + 1 + NYpix][NXpix] = sum;
    322327
    323328    // insert the (source) kernel into the (source) image:
     329    sum = 0.0;
    324330    for (int y = -footprint; y <= footprint; y++) {
    325331        for (int x = -footprint; x <= footprint; x++) {
    326332            sourceImage->data.F32[y + NYpix][x + NXpix] = source->kernel[y][x];
    327         }
    328     }
    329    
     333            sum += sourceImage->data.F32[y + NYpix][x + NXpix];
     334        }
     335    }
     336    sourceImage->data.F32[footprint + 1 + NYpix][NXpix] = sum;
     337
    330338    // insert the (convolution) kernel into the (convolution) image:
     339    sum = 0.0;
    331340    for (int y = -footprint; y <= footprint; y++) {
    332341        for (int x = -footprint; x <= footprint; x++) {
    333342            convolutionImage->data.F32[y + NYpix][x + NXpix] = -convolution->kernel[y][x];
    334         }
    335     }
     343            sum += convolutionImage->data.F32[y + NYpix][x + NXpix];
     344        }
     345    }
     346    convolutionImage->data.F32[footprint + 1 + NYpix][NXpix] = sum;
    336347   
    337348    // insert the (difference) kernel into the (difference) image:
     349    sum = 0.0;
    338350    for (int y = -footprint; y <= footprint; y++) {
    339351        for (int x = -footprint; x <= footprint; x++) {
    340352            differenceImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x] - background - source->kernel[y][x] * norm;
    341         }
    342     }
     353            sum += differenceImage->data.F32[y + NYpix][x + NXpix];
     354        }
     355    }
     356    differenceImage->data.F32[footprint + 1 + NYpix][NXpix] = sum;
    343357
    344358    // insert the (residual) kernel into the (residual) image:
     359    sum = 0.0;
    345360    for (int y = -footprint; y <= footprint; y++) {
    346361        for (int x = -footprint; x <= footprint; x++) {
    347362            residualImage->data.F32[y + NYpix][x + NXpix] = target->kernel[y][x] - background - source->kernel[y][x] * norm + convolution->kernel[y][x];
    348         }
    349     }
     363            sum += residualImage->data.F32[y + NYpix][x + NXpix];
     364        }
     365    }
     366    residualImage->data.F32[footprint + 1 + NYpix][NXpix] = sum;
    350367
    351368    // insert the (fresidual) kernel into the (fresidual) image:
    352369    for (int y = -footprint; y <= footprint; y++) {
    353370        for (int x = -footprint; x <= footprint; x++) {
    354             fresidualImage->data.F32[y + NYpix][x + NXpix] = PS_SQR(residualImage->data.F32[y + NYpix][x + NXpix]) / (target->kernel[y][x] + 25.0);
     371            fresidualImage->data.F32[y + NYpix][x + NXpix] = residualImage->data.F32[y + NYpix][x + NXpix] / sqrt(PS_MAX(target->kernel[y][x], 100.0));
    355372        }
    356373    }
Note: See TracChangeset for help on using the changeset viewer.