IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2006, 12:42:12 PM (20 years ago)
Author:
Paul Price
Message:

Updating to psLib rel11. Most changes are setting the 'n' element of the vector or array upon allocation. Needed to change the way the image subsets are done: not sure why we switched back to the old method of trim regions, but it seems we did.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pois/src/poisCheckKernel.c

    r4700 r6891  
    44
    55bool poisCheckKernel(const psVector *solution,// Kernel solution
    6                      const psArray *kernels, // Kernel basis functions
    7                      const poisConfig *config // Configuration
     6                     const psArray *kernels, // Kernel basis functions
     7                     const poisConfig *config // Configuration
    88    )
    99{
     
    1313    psVector *radKernel = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32);
    1414    psVector *radii = psVectorAlloc((2*config->xKernel + 1) * (2*config->yKernel + 1), PS_TYPE_F32); // Radius
     15    radKernel->n = radii->n = (2*config->xKernel + 1) * (2*config->yKernel + 1);
    1516    for (int i = 0; i < solution->n - 1; i++) {
    16         poisKernelBasis *kernel = kernels->data[i]; // The kernel basis function
    17         if (kernel->xOrder == 0 && kernel->yOrder == 0) {
    18             int u = kernel->u;          // x offset
    19             int v = kernel->v;          // y offset
    20             float distance = sqrtf((float)(u*u) + (float)(v*v)); // Distance from the centre
    21             radKernel->data.F32[i] = solution->data.F64[i];
    22             radii->data.F32[i] = distance;
    23         }
     17        poisKernelBasis *kernel = kernels->data[i]; // The kernel basis function
     18        if (kernel->xOrder == 0 && kernel->yOrder == 0) {
     19            int u = kernel->u;          // x offset
     20            int v = kernel->v;          // y offset
     21            float distance = sqrtf((float)(u*u) + (float)(v*v)); // Distance from the centre
     22            radKernel->data.F32[i] = solution->data.F64[i];
     23            radii->data.F32[i] = distance;
     24        }
    2425    }
    2526
    2627    psVector *sortIndex = psVectorSortIndex(NULL, radii); // Indices from sort
    27     float distance = 0.0;               // Distance from the centre that's being examined
    28     float sum = 0.0;                    // Sum of kernel for that distance
    29     int num = 0;                        // Number of pixels at that distance
     28    float distance = 0.0;               // Distance from the centre that's being examined
     29    float sum = 0.0;                    // Sum of kernel for that distance
     30    int num = 0;                        // Number of pixels at that distance
    3031    int centreIndex = sortIndex->data.U32[0]; // Index of the centre pixel
    31     int numSuspect = 0;                 // Number of radii considered suspect
     32    int numSuspect = 0;                 // Number of radii considered suspect
    3233    for (int i = 0; i < (2*config->xKernel + 1) * (2*config->yKernel + 1); i++) {
    33         unsigned int index = sortIndex->data.U32[i];
    34         if (radii->data.F32[index] != distance) {
    35             psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num);
    36             if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) {
    37                 numSuspect++;
    38             }
    39             sum = 0.0;
    40             num = 0;
    41             distance = radii->data.F32[index];
    42         }
    43         sum += radKernel->data.F32[index];
    44         num++;
     34        unsigned int index = sortIndex->data.U32[i];
     35        if (radii->data.F32[index] != distance) {
     36            psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num);
     37            if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) {
     38                numSuspect++;
     39            }
     40            sum = 0.0;
     41            num = 0;
     42            distance = radii->data.F32[index];
     43        }
     44        sum += radKernel->data.F32[index];
     45        num++;
    4546    }
    4647    psTrace("pois.checkKernel", 7, "Radius: %f\tMean: %f\n", distance, sum/(float)num);
    4748    if (fabs(distance*sum/(float)num) > radKernel->data.F32[centreIndex]) {
    48         numSuspect++;
     49        numSuspect++;
    4950    }
    5051
     
    5657
    5758    if (numSuspect > 0) {
    58         psWarning("There is significant power at large radii.  The kernel may be bad.\n");
    59         return false;
     59        psWarning("There is significant power at large radii.  The kernel may be bad.\n");
     60        return false;
    6061    }
    6162
Note: See TracChangeset for help on using the changeset viewer.