Changeset 21481
- Timestamp:
- Feb 13, 2009, 5:34:19 PM (17 years ago)
- Location:
- trunk/magic/remove/src
- Files:
-
- 3 edited
-
streaksio.c (modified) (1 diff)
-
streaksio.h (modified) (1 diff)
-
streaksremove.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksio.c
r21440 r21481 813 813 // and replicate the files 814 814 815 staticbool815 bool 816 816 replicateOutputs(streakFiles *sfiles) 817 817 { -
trunk/magic/remove/src/streaksio.h
r21440 r21481 27 27 void setMaskedToNAN(streakFiles *sfiles, psU8 maskMask, bool printCounts); 28 28 29 bool replicateOutputs(streakFiles *sf); 29 30 bool swapOutputsToInputs(streakFiles *sf); 30 31 bool deleteTemps(streakFiles *sf); -
trunk/magic/remove/src/streaksremove.c
r21441 r21481 1 1 #include "streaksremove.h" 2 3 #include "nebclient.h"4 2 5 3 static pmConfig *parseArguments(int argc, char **argv); 6 4 static bool readAndCopyToOutput(streakFiles *sf, bool exciseAll); 7 static StreakPixels * getStreakPixels(streakFiles *sfiles, Streaks *streaks);8 5 static void exciseNonWarpedPixels(streakFiles *sfiles, double newMaskValue); 9 6 static bool warpedPixel(streakFiles *sfiles, PixelPos *cellCoord); 10 7 static void excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue); 11 8 static void writeImages(streakFiles *sf, bool exciseImageCube); 12 static bool replicateOutputs(streakFiles *sfiles);13 9 static void updateAstrometry(streakFiles *sfiles); 14 10 … … 125 121 psTimerStart("GET_STREAK_PIXELS"); 126 122 127 StreakPixels *pixels = getStreakPixels(sfiles, streaks);128 123 StreakPixels *pixels = streak_on_component (streaks, sfiles->astrom, 124 sfiles->inImage->numCols, sfiles->inImage->numRows); 129 125 130 126 printf("time to get streak pixels: %f\n", psTimerClear("GET_STREAK_PIXELS")); … … 225 221 } 226 222 227 printf("time to run streaksremove: %f\n", psTimerClear("STREAKSREMOVE"));228 229 223 psFree(sfiles); 230 224 psFree(config); … … 233 227 streaksNebulousCleanup(); 234 228 pmConfigDone(); 229 printf("time to run streaksremove: %f\n", psTimerClear("STREAKSREMOVE")); 235 230 psLibFinalize(); 236 231 … … 466 461 { 467 462 if (sf->bilevelAstrometry) { 463 468 464 linearizeTransforms(sf->astrom); 469 // XXX: pmAstrometry.c should set the correct CTYPE values 465 470 466 if (!pmAstromWriteWCS(sf->outImage->header, sf->inAstrom->fpa, sf->chip, 0.001)) { 471 467 psError(PS_ERR_UNKNOWN, false, "failed to update astrometry for extension %d", sf->extnum); … … 669 665 } 670 666 671 // for any of the outputs that are stored in Nebulous set their extended attributes672 // and replicate the files673 674 static bool675 replicateOutputs(streakFiles *sfiles)676 {677 bool status = false;678 679 // XXX: TODO: need a nebGetXatrr function, but there isn't one680 // another option would be to take the number of copies to be681 // created as an option. That way the system could decide682 // whether to replicate anything other than raw Image files683 void *xattr = NULL;684 685 if (!replicate(sfiles->outImage, xattr)) {686 psError(PM_ERR_SYS, false, "failed to replicate outImage.");687 return false;688 }689 690 #ifdef notyet691 // XXX: don't replicate mask and weight images until we can look up692 // the input's xattr. There may be a perl program that can getXattr693 if (sfiles->outMask) {694 // get xattr from input to see if we need to replicate695 if (!replicate(sfiles->outMask, xattr)) {696 psError(PM_ERR_SYS, false, "failed to replicate outImage.");697 return false;698 }699 }700 if (sfiles->outWeight) {701 // get xattr from input to see if we need to replicate702 if (!replicate(sfiles->outWeight, xattr)) {703 psError(PM_ERR_SYS, false, "failed to replicate outImage.");704 return false;705 }706 }707 #endif708 709 // replicate the recovery images (if in nebulous)710 // perhaps whether we do that or not should be configurable.711 // Sounds like we need a recipe712 713 return true;714 }715 716 717 667 static void 718 668 excisePixel(streakFiles *sfiles, unsigned int x, unsigned int y, bool streak, double newMaskValue) … … 832 782 } 833 783 834 static bool835 streakEndOnComponent(streak *streak, double r_min, double r_max, double d_min, double d_max)836 {837 if ((streak->ra1 >= r_min) && (streak->ra1 <= r_max) &&838 (streak->dec1 >= d_min) && (streak->dec1 <= d_max)) {839 return true;840 }841 if ((streak->ra2 >= r_min) && (streak->ra2 <= r_max) &&842 (streak->dec2 >= d_min) && (streak->dec2 <= d_max)) {843 return true;844 }845 return false;846 }847 848 849 static Streaks *850 restrictStreaksToComponent(streakFiles *sfiles, Streaks *streaks)851 {852 Streaks *out = psAlloc(sizeof(Streaks));853 854 strkPt ll, ur;855 cellToSky(&ll, sfiles->astrom, 0, 0);856 cellToSky(&ur, sfiles->astrom, sfiles->inImage->numCols-1, sfiles->inImage->numRows-1);857 858 double r_min, r_max, d_min, d_max;859 if (ll.x < ur.x) {860 r_min = ll.x; r_max = ur.x;861 } else {862 r_min = ur.x; r_max = ll.x;863 }864 if (ll.y < ur.y) {865 d_min = ll.y; d_max = ur.y;866 } else {867 d_min = ur.y; d_max = ll.y;868 }869 870 out->list = psAlloc(streaks->size * sizeof(streak));871 int j=0;872 for (int i=0 ; i<streaks->size; i++) {873 if (streakEndOnComponent(&streaks->list[i], r_min, r_max, d_min, d_max)) {874 out->list[j++] = streaks->list[i];875 }876 877 }878 out->size = j;879 return out;880 }881 882 static StreakPixels *883 getStreakPixels(streakFiles *sfiles, Streaks *streaks)884 {885 StreakPixels *pixels;886 #ifdef notyet887 Streaks *componentStreaks = NULL;888 Streaks *streaksToProcess;889 890 bool only_component_streaks = false; // XXX flesh this out and make it an option891 if (only_component_streaks) {892 componentStreaks = restrictStreaksToComponent(sfiles, streaks);893 streaksToProcess = componentStreaks;894 } else {895 streaksToProcess = streaks;896 }897 898 pixels = streak_on_component (streaksToProcess, sfiles->astrom,899 sfiles->inImage->numCols, sfiles->inImage->numRows);900 if (componentStreaks) {901 psFree(componentStreaks);902 }903 #else904 pixels = streak_on_component (streaks, sfiles->astrom,905 sfiles->inImage->numCols, sfiles->inImage->numRows);906 #endif907 return pixels;908 }909
Note:
See TracChangeset
for help on using the changeset viewer.
