Changeset 3667
- Timestamp:
- Apr 5, 2005, 12:13:28 PM (21 years ago)
- Location:
- trunk/stac/src
- Files:
-
- 1 deleted
- 5 edited
-
Makefile (modified) (2 diffs)
-
shiftSize.c (modified) (5 diffs)
-
shiftSizeHelp.c (deleted)
-
stac.c (modified) (4 diffs)
-
stac.h (modified) (1 diff)
-
stacRejection.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/stac/src/Makefile
r3660 r3667 1 1 SHELL = /bin/sh 2 2 CC = gcc 3 CFLAGS += -g -std=c99 -I/home/mithrandir/price/psLib/include -D_GNU_SOURCE # -D CRFLUX -DTESTING3 CFLAGS += -g -std=c99 -I/home/mithrandir/price/psLib/include -D_GNU_SOURCE # -DTESTING -DCRFLUX 4 4 PSLIB += -L/home/mithrandir/price/psLib/lib/ -lpslib -lgsl -lgslcblas -lfftw3f -lsla -lcfitsio -lm -lxml2 -lmysqlclient 5 5 LDFLAGS += $(PSLIB) … … 12 12 stacCombine.o stacInvertMaps.o stacSize.o 13 13 14 SHIFTSIZE = shiftSize.o s hiftSizeHelp.o stacWrite.o stacConfig.o stacRead.o stacCheckMemory.o stacSize.o14 SHIFTSIZE = shiftSize.o stacWrite.o stacConfig.o stacRead.o stacCheckMemory.o stacSize.o 15 15 16 16 .PHONY: tags clean empty test profile optimise -
trunk/stac/src/shiftSize.c
r3660 r3667 14 14 #include "stac.h" 15 15 16 void help(const char *name) 17 { 18 fprintf (stderr, "shiftSize: Calculate size for output combined image\n" 19 "Usage: %s [-h] [-v] IN1 IN2...\n" 20 "where\n" 21 "\t-h Help (this info)\n" 22 "\t-v Increase verbosity level\n" 23 "\tIN1, IN2... Input images, which have associated .map files.\n", 24 name 25 ); 26 } 27 28 16 29 int main(int argc, char *argv[]) 17 30 { … … 20 33 #ifdef TESTING 21 34 psTraceSetLevel("stac.checkMemory",10); 22 psTraceSetLevel("stac.config",10);23 35 psTraceSetLevel("stac.read",10); 24 36 psTraceSetLevel("stac.size",10); … … 28 40 psLogSetLevel(9); 29 41 42 43 int verbose = 0; // Verbosity level 44 30 45 // Parse command line 31 stacConfig *config = stacConfigAlloc(); // Configuration values32 46 const char *programName = argv[0]; // Program name 33 34 float saturated = 65535.0; // Saturation level35 float bad = 0.0; // Bad level36 37 47 /* Variables for getopt */ 38 48 int opt; /* Option, from getopt */ … … 47 57 exit(EXIT_SUCCESS); 48 58 case 'v': 49 config->verbose++;59 verbose++; 50 60 break; 51 61 default: … … 62 72 } 63 73 64 // Get the input files 65 config->inputs = psArrayAlloc(argc); 74 psArray *inputs = psArrayAlloc(argc); // Input filenames 66 75 for (int i = 0; i < argc; i++) { 67 config->inputs->data[i] = psAlloc(strlen(argv[i]));68 strncpy( config->inputs->data[i], argv[i], strlen(argv[i]));76 inputs->data[i] = psAlloc(strlen(argv[i])); 77 strncpy(inputs->data[i], argv[i], strlen(argv[i])); 69 78 } 70 79 71 72 80 // Read input files 73 psArray *i nputs = stacReadImages(config);81 psArray *images = stacReadImages(inputs); 74 82 75 83 // Read maps 76 psArray *maps = stacReadMaps( config);84 psArray *maps = stacReadMaps(inputs); 77 85 78 86 // Get size 79 stacSize(config, inputs, maps); 87 int outnx, outny; // Size of combined image 88 float xMapDiff, yMapDiff; // Difference to apply to maps 89 stacSize(&outnx, &outny, &xMapDiff, &yMapDiff, images, maps); 80 90 81 printf("%d %d\n", config->outnx, config->outny);91 printf("%d %d\n", outnx, outny); 82 92 83 93 // Write out altered maps 84 stacWriteMaps( maps, config);94 stacWriteMaps(inputs, maps); 85 95 86 psFree(config);87 96 psFree(inputs); 97 psFree(images); 88 98 psFree(maps); 89 99 -
trunk/stac/src/stac.c
r3666 r3667 71 71 sprintf(errName,"%s.err",config->inputs->data[i]); 72 72 psFits *errorFile = psFitsAlloc(errName); 73 if (!psFitsWriteImage(errorFile, NULL, error , 0, NULL)) {73 if (!psFitsWriteImage(errorFile, NULL, errors->data[i], 0, NULL)) { 74 74 psErrorStackPrint(stderr, "Unable to write image: %s\n", errName); 75 75 } … … 91 91 char shiftName[MAXCHAR]; // Filename of shift image 92 92 char errName[MAXCHAR]; // Filename of error image 93 sprintf(shiftName,"%s.shift1",config->inputs->data[n],numTransforms); 94 sprintf(errName,"%s.shifterr1",config->inputs->data[n],numTransforms); 95 psTrace("stac.transform.test", 6, 96 "Output files have size: %dx%d\n",outImage->numCols,outImage->numRows); 93 sprintf(shiftName,"%s.shift1",config->inputs->data[i]); 94 sprintf(errName,"%s.shifterr1",config->inputs->data[i]); 97 95 psFits *shiftFile = psFitsAlloc(shiftName); 98 96 psFits *errFile = psFitsAlloc(errName); 99 if (!psFitsWriteImage(shiftFile, NULL, outImage, 0, NULL)) { 97 psImage *trans = transformed->data[i]; // Transformed image 98 psImage *transErr = transformedErrors->data[i]; // Transformed error image 99 if (!psFitsWriteImage(shiftFile, NULL, trans, 0, NULL)) { 100 100 psErrorStackPrint(stderr, "Unable to write image: %s\n", shiftName); 101 101 } 102 102 psTrace("stac", 1, "Shifted image written to %s\n", shiftName); 103 if (!psFitsWriteImage(errFile, NULL, outError, 0, NULL)) {103 if (!psFitsWriteImage(errFile, NULL, transErr, 0, NULL)) { 104 104 psErrorStackPrint(stderr, "Unable to write image: %s\n", errName); 105 105 } … … 137 137 #ifdef TESTING 138 138 // Write rejection images out to check 139 for (int i = 0; i < nImages; i++) {139 for (int i = 0; i < rejected->n; i++) { 140 140 char rejName[MAXCHAR]; // Filename of rejection image 141 sprintf(rejName, "%s.shiftrej",config->inputs->data[i]);141 sprintf(rejName, "%s.shiftrej", config->inputs->data[i]); 142 142 143 143 psFits *rejFile = psFitsAlloc(rejName); 144 if (!psFitsWriteImage(rejFile, NULL, (*rejected)->data[i], 0, NULL)) {144 if (!psFitsWriteImage(rejFile, NULL, rejected->data[i], 0, NULL)) { 145 145 psErrorStackPrint(stderr, "Unable to write image: %s\n", rejName); 146 146 } … … 151 151 // Write out pre-combined image 152 152 char preName[MAXCHAR]; // Filename of precombined image 153 sprintf(preName, "%s.pre",config->output);153 sprintf(preName, "%s.pre", config->output); 154 154 psFits *preFile = psFitsAlloc(preName); 155 155 if (!psFitsWriteImage(preFile, NULL, combined, 0, NULL)) { -
trunk/stac/src/stac.h
r3666 r3667 192 192 // stacWrite.c 193 193 194 // Write map sout194 // Write map out 195 195 bool stacWriteMap(const char *mapName, // Filename to write to 196 196 psPlaneTransform *map // Map to write 197 197 ); 198 198 199 // Write multiple maps 200 bool stacWriteMaps(const psArray *names, // Filenames of the input images (will add ".map") 201 const psArray *maps // Maps to write 202 ); 203 199 204 /************************************************************************************************************/ 200 205 -
trunk/stac/src/stacRejection.c
r3666 r3667 83 83 #ifdef TESTING 84 84 psImage *rejmap = psImageAlloc(nxInput, nyInput, PS_TYPE_F32); // The rejections in the source frame 85 psImage *grad = psImageAlloc(nxInput, nyInput, PS_TYPE_F32); // The gradient image85 psImage *gradient = psImageAlloc(nxInput, nyInput, PS_TYPE_F32); // The gradient image 86 86 #endif 87 87 psImage *reject = rejected->data[i]; // Pull out the mask in the output frame … … 147 147 148 148 #ifdef TESTING 149 grad ->data.F32[y][x] = stacGradient(inputs->data[i], x, y) / meanGrads;149 gradient->data.F32[y][x] = stacGradient(inputs->data[i], x, y) / meanGrads; 150 150 #endif 151 151 … … 153 153 mask->data.U8[y][x] = 1; 154 154 nBad++; 155 155 156 #ifdef CRFLUX 156 157 fprintf(crs, "%d %d --> %f %f %f\n", x, y, … … 158 159 stacGradient(inputs->data[i], x, y)); 159 160 #endif 161 160 162 } else { 161 163 mask->data.U8[y][x] = 0; … … 200 202 } 201 203 psTrace("stac", 1, "Rejection map written to %s\n", rejmapName); 202 if (!psFitsWriteImage(gradFile, NULL, grad , 0, NULL)) {204 if (!psFitsWriteImage(gradFile, NULL, gradient, 0, NULL)) { 203 205 psErrorStackPrint(stderr, "Unable to write image: %s\n", gradName); 204 206 } … … 208 210 psFree(gradFile); 209 211 psFree(rejmap); 210 psFree(grad );212 psFree(gradient); 211 213 #endif 212 214
Note:
See TracChangeset
for help on using the changeset viewer.
