Changeset 21183 for trunk/psModules/src/detrend/pmDark.c
- Timestamp:
- Jan 26, 2009, 8:40:07 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmDark.c (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmDark.c
r19432 r21183 103 103 { 104 104 psArray *values = psArrayAlloc(inputs->n); 105 psVector *roMask = psVectorAlloc(inputs->n, PS_TYPE_ U8); // Mask for bad readouts105 psVector *roMask = psVectorAlloc(inputs->n, PS_TYPE_VECTOR_MASK); // Mask for bad readouts 106 106 psVector *norm = normConcept ? psVectorAlloc(inputs->n, PS_TYPE_F32) : NULL; // Normalizations for each 107 107 psVector *orders = psVectorAlloc(ordinates->n, PS_TYPE_U8); // Orders for each concept … … 121 121 if (!ordinateLookup(&normValue, &inRange, normConcept, false, NAN, NAN, readout)) { 122 122 psWarning("Unable to find value of %s for readout %d", normConcept, i); 123 roMask->data. U8[i] = 0xff;123 roMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 124 124 norm->data.F32[i] = NAN; 125 125 numBadInputs++; … … 128 128 if (normValue == 0.0) { 129 129 psWarning("Normalisation value (%s) for readout %d is zero", normConcept, i); 130 roMask->data. U8[i] = 0xff;130 roMask->data.PS_TYPE_VECTOR_MASK_DATA[i] = 0xff; 131 131 norm->data.F32[i] = NAN; 132 132 numBadInputs++; … … 151 151 for (int j = 0; j < inputs->n; j++) { 152 152 psVector *val = values->data[j]; // Value vector for readout 153 if (roMask->data. U8[j]) {153 if (roMask->data.PS_TYPE_VECTOR_MASK_DATA[j]) { 154 154 val->data.F32[i] = NAN; 155 155 continue; … … 159 159 float value = NAN; // Value of ordinate 160 160 if (!ordinateLookup(&value, &inRange, ord->name, ord->scale, ord->min, ord->max, readout)) { 161 roMask->data. U8[j] = 0xff;161 roMask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xff; 162 162 val->data.F32[i] = NAN; 163 163 numBadInputs++; … … 165 165 } 166 166 if (!inRange) { 167 roMask->data. U8[j] = 0xff;167 roMask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xff; 168 168 val->data.F32[i] = NAN; 169 169 numBadInputs++; … … 263 263 264 264 // do the combine work for this portion of the output (range is set by input data) 265 bool pmDarkCombine(pmCell *output, const psArray *inputs, int iter, float rej, ps MaskType maskVal)265 bool pmDarkCombine(pmCell *output, const psArray *inputs, int iter, float rej, psImageMaskType maskVal) 266 266 { 267 267 PS_ASSERT_PTR_NON_NULL(output, false); … … 314 314 // Iterate over pixels, fitting polynomial 315 315 psVector *pixels = psVectorAlloc(inputs->n, PS_TYPE_F32); // Stack of pixels 316 psVector *mask = psVectorAlloc(inputs->n, PS_TYPE_ MASK); // Mask for stack316 psVector *mask = psVectorAlloc(inputs->n, PS_TYPE_VECTOR_MASK); // Mask for stack 317 317 for (int i = minInputRows; i < maxInputRows; i++) { 318 318 int yOut = i - outReadout->row0; // y position on output readout … … 330 330 psVectorInit(mask, 0); 331 331 for (int r = 0; r < inputs->n; r++) { 332 if (roMask->data. U8[r]) {333 mask->data.PS_TYPE_ MASK_DATA[r] = 0xff;332 if (roMask->data.PS_TYPE_VECTOR_MASK_DATA[r]) { 333 mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = 0xff; 334 334 continue; 335 335 } … … 343 343 } 344 344 if (readout->mask) { 345 mask->data.PS_TYPE_ MASK_DATA[r] = readout->mask->data.PS_TYPE_MASK_DATA[yIn][xIn];345 mask->data.PS_TYPE_VECTOR_MASK_DATA[r] = (readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[yIn][xIn] & maskVal); 346 346 } 347 347 348 348 } 349 349 350 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, maskVal, values, iter, rej)) {350 if (!psPolynomialMDClipFit(poly, pixels, NULL, mask, 0xff, values, iter, rej)) { 351 351 psErrorClear(); // Nothing we can do about it 352 352 psVectorInit(poly->coeff, NAN); … … 376 376 const psVector *values = job->args->data[3]; // Values for each ordinate 377 377 378 ps MaskType bad = PS_SCALAR_VALUE(job->args->data[4], U8); // Mask value to give bad pixels378 psImageMaskType bad = PS_SCALAR_VALUE(job->args->data[4], PS_TYPE_IMAGE_MASK_DATA); // Mask value to give bad pixels 379 379 bool doNorm = PS_SCALAR_VALUE(job->args->data[5], U8); // Normalise values? 380 380 float norm = PS_SCALAR_VALUE(job->args->data[6], F32); // Value by which to normalise … … 386 386 387 387 bool pmDarkApplyScan(pmReadout *readout, const pmCell *dark, const psVector *orders, const psVector *values, 388 ps MaskType bad, bool doNorm, float norm, int rowStart, int rowStop)388 psImageMaskType bad, bool doNorm, float norm, int rowStart, int rowStop) 389 389 { 390 390 int numCols = readout->image->numCols; … … 405 405 readout->image->data.F32[y][x] -= value; 406 406 if (readout->mask && !isfinite(value)) { 407 readout->mask->data.PS_TYPE_ MASK_DATA[y][x] = bad;407 readout->mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = bad; 408 408 } 409 409 } … … 414 414 } 415 415 416 bool pmDarkApply(pmReadout *readout, pmCell *dark, ps MaskType bad)416 bool pmDarkApply(pmReadout *readout, pmCell *dark, psImageMaskType bad) 417 417 { 418 418 PS_ASSERT_PTR_NON_NULL(readout, false); … … 424 424 PS_ASSERT_IMAGE_NON_NULL(readout->mask, false); 425 425 PS_ASSERT_IMAGES_SIZE_EQUAL(readout->mask, readout->image, false); 426 PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_ MASK, false);426 PS_ASSERT_IMAGE_TYPE(readout->mask, PS_TYPE_IMAGE_MASK, false); 427 427 } 428 428 int numTerms = dark->readouts->n; // Number of polynomial terms … … 496 496 psArrayAdd(job->args, 1, orders); 497 497 psArrayAdd(job->args, 1, values); 498 PS_ARRAY_ADD_SCALAR(job->args, bad, PS_TYPE_ MASK);498 PS_ARRAY_ADD_SCALAR(job->args, bad, PS_TYPE_IMAGE_MASK); 499 499 PS_ARRAY_ADD_SCALAR(job->args, doNorm, PS_TYPE_U8); 500 500 PS_ARRAY_ADD_SCALAR(job->args, norm, PS_TYPE_F32);
Note:
See TracChangeset
for help on using the changeset viewer.
