Changeset 16131 for branches/pap_branch_080117/psLib/src/fits/psFitsScale.c
- Timestamp:
- Jan 17, 2008, 5:37:50 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/pap_branch_080117/psLib/src/fits/psFitsScale.c
r16122 r16131 113 113 114 114 long range = 1 << fits->stdevBits; // Range of values to carry standard deviation 115 *bscale = fits->stdev / (double) range;115 *bscale = stdev / (double) range; 116 116 117 117 int bitpix = fits->bitpix; // Bits per pixel … … 119 119 long diskVal; // Corresponding value on disk 120 120 switch (fits->scaling) { 121 case PS_FITS_SCALE_STDEV_ LOWER:121 case PS_FITS_SCALE_STDEV_POSITIVE: 122 122 // Put (mean - N sigma) at the lowest possible value: predominantly positive images 123 123 imageVal = mean - fits->stdevNum * stdev; 124 124 diskVal = - (1 << (bitpix - 1)); 125 125 break; 126 case PS_FITS_SCALE_STDEV_ UPPER:126 case PS_FITS_SCALE_STDEV_NEGATIVE: 127 127 // Put (mean + N sigma) at the highest possible value: predominantly negative images 128 128 imageVal = mean + fits->stdevNum * stdev; 129 129 diskVal = (1 << (bitpix - 1)) - 1; 130 130 break; 131 case PS_FITS_SCALE_STDEV_ MIDDLE:131 case PS_FITS_SCALE_STDEV_BOTH: 132 132 // Put mean right in the middle: images with an equal abundance of positive and negative values 133 133 imageVal = mean; … … 165 165 // If we don't have a RNG, we will allocate one 166 166 167 if (fits->scaling != PS_FITS_SCALE_STDEV_ LOWER&&168 fits->scaling != PS_FITS_SCALE_STDEV_ UPPER&&169 fits->scaling != PS_FITS_SCALE_STDEV_ MIDDLE) {167 if (fits->scaling != PS_FITS_SCALE_STDEV_POSITIVE && 168 fits->scaling != PS_FITS_SCALE_STDEV_NEGATIVE && 169 fits->scaling != PS_FITS_SCALE_STDEV_BOTH) { 170 170 // No need to do anything 171 171 return true; … … 238 238 } 239 239 break; 240 case PS_FITS_SCALE_STDEV_ LOWER:241 case PS_FITS_SCALE_STDEV_ UPPER:242 case PS_FITS_SCALE_STDEV_ MIDDLE:240 case PS_FITS_SCALE_STDEV_POSITIVE: 241 case PS_FITS_SCALE_STDEV_NEGATIVE: 242 case PS_FITS_SCALE_STDEV_BOTH: 243 243 if (!scaleStdev(bscale, bzero, image, fits)) { 244 244 psError(PS_ERR_UNKNOWN, false, "Unable to set BSCALE and BZERO from stdev");
Note:
See TracChangeset
for help on using the changeset viewer.
