Changeset 25209
- Timestamp:
- Aug 26, 2009, 2:38:40 PM (17 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 2 edited
-
streaksio.c (modified) (4 diffs)
-
streaksremove.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksio.c
r25082 r25209 654 654 streaksExit("", PS_EXIT_DATA_ERROR); 655 655 } 656 657 // Ensure input is of the expected type 658 psDataType expected = isMask ? PS_TYPE_IMAGE_MASK : PS_TYPE_F32; // Expected type for image 659 for (int i = 0; i < in->imagecube->n; i++) { 660 psImage *image = in->imagecube->data[i]; // Image of interest 661 if (image->type.type != expected) { 662 psImage *temp = psImageCopy(NULL, image, expected); 663 psFree(image); 664 in->imagecube->data[i] = temp; 665 } 666 } 656 667 } 657 668 setDataExtent(stage, in, (stage == IPP_STAGE_RAW) && !isMask); … … 670 681 sfile->fits->options = psFitsOptionsAlloc(); 671 682 sfile->fits->options->scaling = PS_FITS_SCALE_MANUAL; 683 sfile->fits->options->fuzz = false; 672 684 sfile->fits->options->bitpix = bitpix; 673 685 sfile->fits->options->bscale = bscale; … … 1114 1126 // these gets are not necessary, we could just set the pixels to nan 1115 1127 // but I want to get the counts 1116 double imageVal = psImageGet(image, x, y);1128 double imageVal = image->data.F32[y][x]; 1117 1129 psU32 maskVal; 1118 1130 if (sfiles->stage == IPP_STAGE_RAW) { 1119 1131 unsigned int xChip, yChip; 1120 1132 cellToChipInt(&xChip, &yChip, sfiles->astrom, x, y); 1121 maskVal = psImageGet(mask, xChip, yChip);1133 maskVal = mask->data.PS_TYPE_IMAGE_MASK_DATA[yChip][xChip]; 1122 1134 } else { 1123 maskVal = psImageGet(mask, x, y);1135 maskVal = mask->data.PS_TYPE_IMAGE_MASK_DATA[y][x]; 1124 1136 } 1125 1137 if (maskVal & maskMask) { … … 1127 1139 if (!isExciseValue(imageVal, sfiles->inImage->exciseValue)) { 1128 1140 ++nandPixels; 1129 psImageSet(image, x, y, exciseValue);1141 image->data.F32[y][x] = exciseValue; 1130 1142 } 1131 1143 if (weight) { 1132 double weightVal = weight ? psImageGet(weight, x, y): 0;1144 double weightVal = weight ? weight->data.F32[y][x] : 0; 1133 1145 if (!isnan(weightVal)) { 1134 1146 ++nandWeights; 1135 psImageSet(weight, x, y, NAN);1147 weight->data.F32[y][x] = NAN; 1136 1148 } 1137 1149 } -
trunk/magic/remove/src/streaksremove.c
r25198 r25209 12 12 static pmConfig *parseArguments(int argc, char **argv); 13 13 static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll); 14 static void exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue);14 static void exciseNonWarpedPixels(streakFiles *sfiles, psImageMaskType newMaskValue); 15 15 static bool warpedPixel(streakFiles *sfiles, int x, int y); 16 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue);16 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, psImageMaskType newMaskValue); 17 17 static void writeImages(streakFiles *sf, bool exciseImageCube); 18 18 static void updateAstrometry(streakFiles *sfiles); 19 static void censorSources(streakFiles *sfiles, ps U32maskStreak);19 static void censorSources(streakFiles *sfiles, psImageMaskType maskStreak); 20 20 static long censorPixels(streakFiles *sfiles, psImage * pixels, bool checkNonWarpedPixels, psU16 maskStreak); 21 21 … … 674 674 675 675 static void 676 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue)676 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, psImageMaskType newMaskValue) 677 677 { 678 678 double exciseValue = sfiles->inImage->exciseValue; … … 683 683 } 684 684 685 double imageValue = psImageGet (sfiles->inImage->image, x, y);685 float imageValue = sfiles->inImage->image->data.F32[y][x]; 686 686 if (sfiles->recImage && !isExciseValue(imageValue, sfiles->inImage->exciseValue) ) { 687 psImageSet (sfiles->recImage->image, x, y, imageValue);687 sfiles->recImage->image->data.F32[y][x] = imageValue; 688 688 } 689 689 690 690 if (sfiles->transparentStreaks == 0) { 691 psImageSet (sfiles->outImage->image, x, y, exciseValue);691 sfiles->outImage->image->data.F32[y][x] = exciseValue; 692 692 } else { 693 693 if (streak) { 694 694 // as a visualization aid don't mask the pixel, just change the intensity 695 psImageSet (sfiles->outImage->image, x, y, imageValue + sfiles->transparentStreaks);695 sfiles->outImage->image->data.F32[y][x] = imageValue + sfiles->transparentStreaks; 696 696 } else { 697 psImageSet (sfiles->outImage->image, x, y, exciseValue);697 sfiles->outImage->image->data.F32[y][x] = exciseValue; 698 698 } 699 699 } … … 701 701 if (sfiles->outWeight) { 702 702 if (sfiles->recWeight) { 703 double weightValue = psImageGet (sfiles->inWeight->image, x, y); 704 psImageSet (sfiles->recWeight->image, x, y, weightValue); 703 sfiles->recWeight->image->data.F32[y][x] = sfiles->inWeight->image->data.F32[y][x]; 705 704 } 706 705 // Assume that weight images are always a floating point type 707 psImageSet (sfiles->outWeight->image, x, y, NAN);706 sfiles->outWeight->image->data.F32[y][x] = NAN; 708 707 } 709 708 if (sfiles->outMask) { 710 709 if (sfiles->recMask) { 711 double maskValue = psImageGet (sfiles->inMask->image, x, y); 712 psImageSet (sfiles->recMask->image, x, y, maskValue); 713 } 714 psImageSet (sfiles->outMask->image, x, y, newMaskValue); 710 sfiles->recMask->image->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = 711 sfiles->inMask->image->data.PS_TYPE_IMAGE_MASK_DATA[y][x]; 712 } 713 sfiles->outMask->image->data.PS_TYPE_IMAGE_MASK_DATA[y][x] = 714 sfiles->inMask->image->data.PS_TYPE_IMAGE_MASK_DATA[y][x] | newMaskValue; 715 715 } 716 716 } 717 717 718 718 static void 719 exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue)719 exciseNonWarpedPixels(streakFiles *sfiles, psImageMaskType newMaskValue) 720 720 { 721 721 int cell_x0 = sfiles->astrom->cell_x0; … … 793 793 // streak mask 794 794 static void 795 censorSources(streakFiles *sfiles, ps U32maskStreak)795 censorSources(streakFiles *sfiles, psImageMaskType maskStreak) 796 796 { 797 797 if ((!sfiles->inSources) || (!sfiles->outMask)) { … … 864 864 psF32 y = psMetadataLookupF32(NULL, row, "Y_PSF"); 865 865 866 ps U32 mask = psImageGet(maskImage, x, y);866 psImageMaskType mask = maskImage->data.PS_TYPE_IMAGE_MASK_DATA[(int)y][(int)x]; 867 867 868 868 // Key the source if the center pixel is not masked with maskStreak
Note:
See TracChangeset
for help on using the changeset viewer.
