Changeset 3576
- Timestamp:
- Mar 30, 2005, 2:22:49 PM (21 years ago)
- Location:
- trunk/psModules
- Files:
-
- 1 added
- 2 edited
-
src/pmObjects.c (modified) (40 diffs)
-
test/Makefile.am (modified) (2 diffs)
-
test/tst_pmObjects01.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/pmObjects.c
r3514 r3576 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1.1 0$ $Name: not supported by cvs2svn $8 * @date $Date: 2005-03- 26 03:44:31$7 * @version $Revision: 1.11 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2005-03-31 00:22:49 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 17 17 #include "psConstants.h" 18 18 #include "pmObjects.h" 19 /****************************************************************************** 20 *****************************************************************************/ 21 19 20 /****************************************************************************** 21 pmPeakAlloc(): Allocate the psPeak data structure and set appropriate members. 22 *****************************************************************************/ 22 23 psPeak *pmPeakAlloc(psS32 x, 23 24 psS32 y, … … 34 35 } 35 36 37 /****************************************************************************** 38 pmMomentsAlloc(): Allocate the psMoments structure and initialize the members 39 to zero. 40 *****************************************************************************/ 36 41 psMoments *pmMomentsAlloc() 37 42 { … … 56 61 } 57 62 63 /****************************************************************************** 64 pmModelAlloc(): Allocate the psModel structure, along with its parameters, 65 and initialize the type member. Initialize the params to 0.0. 66 *****************************************************************************/ 58 67 psModel *pmModelAlloc(psModelType type) 59 68 { … … 61 70 62 71 tmp->type = type; 63 tmp->Nparams = 0;64 tmp->params = NULL;65 tmp->dparams = NULL;66 72 tmp->chisq = 0.0; 73 switch (type) { 74 case PS_MODEL_GAUSS: 75 tmp->Nparams = 7; 76 tmp->params = (psF32 *) psAlloc(7 * sizeof(PS_TYPE_F32)); 77 tmp->dparams = (psF32 *) psAlloc(7 * sizeof(PS_TYPE_F32)); 78 break; 79 case PS_MODEL_PGAUSS: 80 tmp->Nparams = 7; 81 tmp->params = (psF32 *) psAlloc(7 * sizeof(PS_TYPE_F32)); 82 tmp->dparams = (psF32 *) psAlloc(7 * sizeof(PS_TYPE_F32)); 83 break; 84 case PS_MODEL_TWIST_GAUSS: 85 tmp->Nparams = 11; 86 tmp->params = (psF32 *) psAlloc(11 * sizeof(PS_TYPE_F32)); 87 tmp->dparams = (psF32 *) psAlloc(11 * sizeof(PS_TYPE_F32)); 88 break; 89 case PS_MODEL_WAUSS: 90 tmp->Nparams = 9; 91 tmp->params = (psF32 *) psAlloc(9 * sizeof(PS_TYPE_F32)); 92 tmp->dparams = (psF32 *) psAlloc(9 * sizeof(PS_TYPE_F32)); 93 break; 94 case PS_MODEL_SERSIC: 95 tmp->Nparams = 8; 96 tmp->params = (psF32 *) psAlloc(8 * sizeof(PS_TYPE_F32)); 97 tmp->dparams = (psF32 *) psAlloc(8 * sizeof(PS_TYPE_F32)); 98 break; 99 case PS_MODEL_SERSIC_CORE: 100 tmp->Nparams = 12; 101 tmp->params = (psF32 *) psAlloc(12 * sizeof(PS_TYPE_F32)); 102 tmp->dparams = (psF32 *) psAlloc(12 * sizeof(PS_TYPE_F32)); 103 break; 104 default: 105 psError(PS_ERR_UNKNOWN, true, "Undefined psModelType"); 106 return(NULL); 107 } 108 109 for (psS32 i = 0 ; i < tmp->Nparams ; i++) { 110 tmp->params[i] = 0.0; 111 tmp->dparams[i] = 0.0; 112 } 67 113 68 114 p_psMemSetDeallocator(tmp, (psFreeFcn) p_psModelFree); … … 70 116 } 71 117 72 // XXX: We don't free pixels and mask since that caused a memory error. 73 // We might need to increase the reference counter and decrease it here. 74 // 118 /****************************************************************************** 119 XXX: We don't free pixels and mask since that caused a memory error. 120 We might need to increase the reference counter and decrease it here. 121 *****************************************************************************/ 75 122 static void p_psSourceFree(psSource *tmp) 76 123 { … … 82 129 } 83 130 131 /****************************************************************************** 132 pmSourceAlloc(): Allocate the psSource structure and initialize its members 133 to NULL. 134 *****************************************************************************/ 84 135 psSource *pmSourceAlloc() 85 136 { … … 195 246 196 247 /****************************************************************************** 248 p_psGetRowVectorFromImage(): a private function which simply returns a 249 psVector containing the specified row of data from the psImage. 250 197 251 XXX: Is there a better way to do this? 198 252 *****************************************************************************/ … … 210 264 } 211 265 266 /****************************************************************************** 267 MyListAddPeak(): A private function which allocates a psList, if the list 268 argument is NULL, otherwise it adds the peak to that list. 269 *****************************************************************************/ 212 270 // XXX: Switch row, col args? 213 271 psList *MyListAddPeak(psList *list, … … 504 562 // We define variables for code readability. 505 563 // 564 // XXX: Since the peak->xy coords are in image, not subImage coords, 565 // these variables should be renamed for clarity (imageCenterRow, etc). 566 // 506 567 psS32 SubImageCenterRow = peak->y; 507 568 psS32 SubImageCenterCol = peak->x; … … 612 673 613 674 XXX: macro this for performance. 614 615 XXX: should arguments be (y, x) order? 616 *****************************************************************************/ 675 *****************************************************************************/ 617 676 bool CheckRadius(psPeak *peak, 618 677 psF32 radius, … … 627 686 } 628 687 688 /****************************************************************************** 689 bool CheckRadius2(): private function which simply determines if the (x, y) 690 point is within the radius of the specified peak. 691 692 XXX: macro this for performance. 693 *****************************************************************************/ 629 694 bool CheckRadius2(psF32 xCenter, 630 695 psF32 yCenter, … … 641 706 642 707 /****************************************************************************** 643 pmSourceMoments(source, radius) 708 pmSourceMoments(source, radius): this function takes a subImage defined in the 709 psSource data structure, along with the peak location, and determines the 710 various moments associated with that peak. 644 711 645 712 Requires the following to have been created: … … 647 714 psSource->peak 648 715 psSource->pixels 716 717 XXX: The peak calculations are done in image coords, not subImage coords. 649 718 650 719 XXX: mask values? … … 733 802 734 803 /****************************************************************************** 735 pmSourceRoughClass(source, saturate, SNlim, valid): make a guess at the source804 pmSourceRoughClass(source, metadata): make a guess at the source 736 805 classification. 737 806 738 psSource *pmSourceRoughClass(psSource *source, 739 psF32 saturate, 740 float SNlim, 741 const psRegion *valid) 807 XXX: This is not useable code, as of the release date. There remains a fair 808 bit of coding to be completed. 809 742 810 XXX: The sigX and sigY stuff in the SDRS is unclear. 743 811 … … 838 906 // We define variables for code readability. 839 907 // 908 // XXX: Since the peak->xy coords are in image, not subImage coords, 909 // these variables should be renamed for clarity (imageCenterRow, etc). 910 // 840 911 psS32 radiusS32 = (psS32) radius; 841 912 psS32 SubImageCenterRow = source->peak->y; … … 910 981 /****************************************************************************** 911 982 pmSourceModelGuess(source, image, model): This function allocates a new 912 psModel structure and store it in the psSource data structure specified in the913 argument list. The model type is specified in the argument list. The params 914 array in that psModel structure are allocated, and then set to the appropriate915 values. This function returns true if everything was successful.983 psModel structure and stores it in the psSource data structure specified in 984 the argument list. The model type is specified in the argument list. The 985 params array in that psModel structure are allocated, and then set to the 986 appropriate values. This function returns true if everything was successful. 916 987 917 988 XXX: Many of the initial parameters are set to 0.0 since I don't know what 918 989 the appropiate initial guesses are. 990 991 XXX: The image argument is redundant. 992 993 XXX: Many parameters are based on the src->moments structure, which is in 994 image, not subImage coords. Therefore, the calls to the model evaluation 995 functions will be in image, not subImage coords. Remember this. 919 996 *****************************************************************************/ 920 997 bool pmSourceModelGuess(psSource *source, … … 931 1008 psFree(source->models); 932 1009 } 933 source->models = pmModelAlloc( PS_MODEL_UNDEFINED);1010 source->models = pmModelAlloc(model); 934 1011 935 1012 switch (model) { 936 1013 case PS_MODEL_GAUSS: 937 source->models->type = PS_MODEL_GAUSS;938 source->models->Nparams = 7;939 source->models->params = (psF32 *) psAlloc(7 * sizeof(psF32));940 source->models->dparams = (psF32 *) psAlloc(7 * sizeof(psF32));941 for (psS32 i = 0 ; i < 7 ; i++) {942 source->models->params[i] = 0.0;943 source->models->dparams[i] = 0.0;944 }945 1014 source->models->params[0] = source->moments->Sky; 946 1015 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 950 1019 source->models->params[5] = sqrt(2.0) / source->moments->Sy; 951 1020 source->models->params[6] = source->moments->Sxy; 952 source->models->chisq = 0.0;953 1021 return(true); 1022 954 1023 case PS_MODEL_PGAUSS: 955 source->models->type = PS_MODEL_PGAUSS;956 source->models->Nparams = 7;957 source->models->params = (psF32 *) psAlloc(7 * sizeof(psF32));958 source->models->dparams = (psF32 *) psAlloc(7 * sizeof(psF32));959 for (psS32 i = 0 ; i < 7 ; i++) {960 source->models->params[i] = 0.0;961 source->models->dparams[i] = 0.0;962 }963 1024 source->models->params[0] = source->moments->Sky; 964 1025 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 968 1029 source->models->params[5] = sqrt(2.0) / source->moments->Sy; 969 1030 source->models->params[6] = source->moments->Sxy; 970 source->models->chisq = 0.0;971 1031 return(true); 1032 972 1033 case PS_MODEL_TWIST_GAUSS: 973 source->models->type = PS_MODEL_TWIST_GAUSS;974 source->models->Nparams = 11;975 source->models->params = (psF32 *) psAlloc(11 * sizeof(psF32));976 source->models->dparams = (psF32 *) psAlloc(11 * sizeof(psF32));977 for (psS32 i = 0 ; i < 11 ; i++) {978 source->models->params[i] = 0.0;979 source->models->dparams[i] = 0.0;980 }981 982 1034 source->models->params[0] = source->moments->Sky; 983 1035 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 992 1044 // source->models->params[9] = SxyOuter; 993 1045 // source->models->params[10] = N; 994 995 source->models->chisq = 0.0;996 1046 return(true); 1047 997 1048 case PS_MODEL_WAUSS: 998 999 1049 source->models->params[0] = source->moments->Sky; 1000 1050 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 1007 1057 // source->models->params[7] = B2; 1008 1058 // source->models->params[8] = B3; 1009 1010 source->models->type = PS_MODEL_WAUSS;1011 source->models->Nparams = 9;1012 source->models->params = (psF32 *) psAlloc(9 * sizeof(psF32));1013 source->models->dparams = (psF32 *) psAlloc(9 * sizeof(psF32));1014 for (psS32 i = 0 ; i < 9 ; i++) {1015 source->models->params[i] = 0.0;1016 source->models->dparams[i] = 0.0;1017 }1018 source->models->chisq = 0.0;1019 1059 return(true); 1060 1020 1061 case PS_MODEL_SERSIC: 1021 source->models->type = PS_MODEL_SERSIC;1022 source->models->Nparams = 8;1023 source->models->params = (psF32 *) psAlloc(8 * sizeof(psF32));1024 source->models->dparams = (psF32 *) psAlloc(8 * sizeof(psF32));1025 for (psS32 i = 0 ; i < 8 ; i++) {1026 source->models->params[i] = 0.0;1027 source->models->dparams[i] = 0.0;1028 }1029 1030 1062 source->models->params[0] = source->moments->Sky; 1031 1063 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 1037 1069 // XXX: What are these? 1038 1070 //source->models->params[7] = Nexp; 1039 1040 source->models->chisq = 0.0;1041 1071 return(true); 1072 1042 1073 case PS_MODEL_SERSIC_CORE: 1043 source->models->type = PS_MODEL_SERSIC_CORE;1044 source->models->Nparams = 12;1045 source->models->params = (psF32 *) psAlloc(12 * sizeof(psF32));1046 source->models->dparams = (psF32 *) psAlloc(12 * sizeof(psF32));1047 for (psS32 i = 0 ; i < 12 ; i++) {1048 source->models->params[i] = 0.0;1049 source->models->dparams[i] = 0.0;1050 }1051 1052 1074 source->models->params[0] = source->moments->Sky; 1053 1075 source->models->params[1] = source->peak->counts - source->moments->Sky; … … 1063 1085 //source->models->params[10] = SxyOuter; 1064 1086 //source->models->params[11] = Nexp; 1065 1066 source->models->chisq = 0.0;1067 1087 return(true); 1088 1068 1089 default: 1069 1090 psError(PS_ERR_UNKNOWN, true, "Undefined psModelType"); … … 1074 1095 /****************************************************************************** 1075 1096 evalModel(source, level, row): a private function which evaluates the 1076 source->model function at the specified coords. 1077 1078 NOTE: The coords are in source->pixel coords, not image coords. 1097 source->model function at the specified coords. The coords are subImage, not 1098 image coords. 1099 1100 NOTE: The coords are in subImage source->pixel coords, not image coords. 1079 1101 1080 1102 XXX: reverse order of row,col args? 1081 1103 1082 XXX: This should probably be a public function. 1104 XXX: rename all coords in this file such that their name defines whether 1105 the coords is in subImage or image space. 1106 1107 XXX: This should probably be a public psModules function. 1083 1108 1084 1109 XXX: Use static vectors for x. 1085 1110 1086 1111 XXX: Figure out if it's (row, col) or (col, row) for the model functions. 1112 1113 XXX: For a while, the first psVectorAlloc() was generating a seg fault during 1114 testing. Try to reproduce that and debug. 1087 1115 *****************************************************************************/ 1088 1116 psF32 evalModel(psSource *src, … … 1090 1118 psU32 col) 1091 1119 { 1120 PS_PTR_CHECK_NULL(src, false); 1121 PS_PTR_CHECK_NULL(src->models, false); 1122 PS_PTR_CHECK_NULL(src->models->params, false); 1123 1092 1124 // XXX: The following step will not be necessary if the models->params 1093 // member is a psVector. 1094 psVector *params = psVectorAlloc( src->models->Nparams, PS_TYPE_F32);1125 // member is a psVector. Suggest to IfA. 1126 psVector *params = psVectorAlloc(7, PS_TYPE_F32); 1095 1127 for (psS32 i = 0 ; i < src->models->Nparams ; i++) { 1096 1128 params->data.F32[i] = src->models->params[i]; 1097 1129 } 1130 1131 // 1132 // Allocate the x coordinate structure and convert row/col to image space. 1133 // 1098 1134 psVector *x = psVectorAlloc(2, PS_TYPE_F32); 1099 1135 x->data.F32[0] = (psF32) (col + src->pixels->col0); 1100 1136 x->data.F32[1] = (psF32) (row + src->pixels->row0); 1101 1137 psF32 tmpF; 1102 1103 1138 1104 1139 switch (src->models->type) { … … 1139 1174 XXX: reverse order of row,col args? 1140 1175 1141 XXX: The result is returned in subImage coords, not image coords. 1176 XXX: Input row/col are in image coords. 1177 1178 XXX: The result is returned in image coords. 1142 1179 *****************************************************************************/ 1143 1180 psF32 findValue(psSource *source, … … 1147 1184 psU32 dir) 1148 1185 { 1186 // 1187 // Convert coords to subImage space. 1188 // 1189 psU32 subRow = row - source->pixels->row0; 1190 psU32 subCol = col - source->pixels->col0; 1191 1149 1192 // Ensure that the starting column is allowable. 1150 if (!((0 <= col) && (col < source->pixels->numCols))) {1193 if (!((0 <= subCol) && (subCol < source->pixels->numCols))) { 1151 1194 psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range"); 1152 1195 return(NAN); 1153 1196 } 1154 1155 psF32 oldValue = evalModel(source, row, col); 1197 if (!((0 <= subRow) && (subRow < source->pixels->numRows))) { 1198 psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range"); 1199 return(NAN); 1200 } 1201 1202 psF32 oldValue = evalModel(source, subRow, subCol); 1156 1203 if (oldValue == level) { 1157 return(((psF32) col));1204 return(((psF32) (subCol + source->pixels->col0))); 1158 1205 } 1159 1206 … … 1171 1218 lastColumn = source->pixels->numCols; 1172 1219 } 1173 col+=incr;1174 1175 while ( col != lastColumn) {1176 psF32 newValue = evalModel(source, row, col);1220 subCol+=incr; 1221 1222 while (subCol != lastColumn) { 1223 psF32 newValue = evalModel(source, subRow, subCol); 1177 1224 if (oldValue == level) { 1178 return( col);1225 return((psF32) (subCol + source->pixels->col0)); 1179 1226 } 1180 1227 1181 1228 if ((newValue <= level) && (level <= oldValue)) { 1182 1229 // This is simple linear interpolation. 1183 return( ((psF32) col) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) );1230 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) ); 1184 1231 } 1185 1232 1186 1233 if ((oldValue <= level) && (level <= newValue)) { 1187 1234 // This is simple linear interpolation. 1188 return( ((psF32) col) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) );1189 } 1190 1191 col+=incr;1235 return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) ); 1236 } 1237 1238 subCol+=incr; 1192 1239 } 1193 1240 1194 1241 return(NAN); 1195 1242 } 1196 /****************************************************************************** 1243 1244 /****************************************************************************** 1245 pmSourceContour(src, img, level, mode): For an input subImage, and model, this 1246 routine returns a psArray of coordinates that evaluate to the specified level. 1247 1197 1248 XXX: Probably should remove the "image" argument. 1198 XXX: What type should the output coordinate vectors consist of? 1249 XXX: What type should the output coordinate vectors consist of? col,row? 1199 1250 XXX: Why a pmArray output? 1200 1251 XXX: doex x,y correspond with col,row or row/col? 1252 XXX: What is momde? 1253 XXX: The top, bottom of the contour is not correctly determined. 1201 1254 *****************************************************************************/ 1202 1255 psArray *pmSourceContour(psSource *source, … … 1206 1259 { 1207 1260 PS_PTR_CHECK_NULL(source, false); 1261 PS_PTR_CHECK_NULL(image, false); 1208 1262 PS_PTR_CHECK_NULL(source->moments, false); 1209 1263 PS_PTR_CHECK_NULL(source->peak, false); … … 1228 1282 // Starting at peak pixel, search leftwards for the column intercept. 1229 1283 psF32 leftIntercept = findValue(source, level, row, col, 0); 1284 if (isnan(leftIntercept)) { 1285 psError(PS_ERR_UNKNOWN, true, "Could not find contour edge (NAN)"); 1286 psFree(xVec); 1287 psFree(yVec); 1288 return(NULL); 1289 } 1230 1290 xVec->data.F32[row] = ((psF32) source->pixels->col0) + leftIntercept; 1231 1291 1232 1292 // Starting at peak pixel, search rightwards for the column intercept. 1293 1233 1294 psF32 rightIntercept = findValue(source, level, row, col, 1); 1295 if (isnan(rightIntercept)) { 1296 psError(PS_ERR_UNKNOWN, true, "Could not find contour edge (NAN)"); 1297 psFree(xVec); 1298 psFree(yVec); 1299 return(NULL); 1300 } 1301 //printf("HERE the intercepts are (%.2f, %.2f)\n", leftIntercept, rightIntercept); 1234 1302 xVec->data.F32[row+xVec->n] = ((psF32) source->pixels->col0) + rightIntercept; 1235 1303 … … 1248 1316 // Starting at peak pixel, search leftwards for the column intercept. 1249 1317 psF32 leftIntercept = findValue(source, level, row, col, 0); 1318 if (isnan(leftIntercept)) { 1319 psError(PS_ERR_UNKNOWN, true, "Could not find contour edge (NAN)"); 1320 psFree(xVec); 1321 psFree(yVec); 1322 return(NULL); 1323 } 1250 1324 xVec->data.F32[row] = ((psF32) source->pixels->col0) + leftIntercept; 1251 1325 1252 1326 // Starting at peak pixel, search rightwards for the column intercept. 1253 1327 psF32 rightIntercept = findValue(source, level, row, col, 1); 1328 if (isnan(rightIntercept)) { 1329 psError(PS_ERR_UNKNOWN, true, "Could not find contour edge (NAN)"); 1330 psFree(xVec); 1331 psFree(yVec); 1332 return(NULL); 1333 } 1254 1334 xVec->data.F32[row+xVec->n] = ((psF32) source->pixels->col0) + rightIntercept; 1255 1335 … … 1294 1374 PS_IMAGE_CHECK_NULL(image, false); 1295 1375 PS_IMAGE_CHECK_TYPE(image, PS_TYPE_F32, false); 1296 1297 1376 psBool rc; 1298 1377 psS32 count = 0; … … 1306 1385 psArray *x = psArrayAlloc(count); 1307 1386 psVector *y = psVectorAlloc(count, PS_TYPE_F32); 1387 psS32 tmpCnt = 0; 1308 1388 for (psS32 i = 0 ; i < source->pixels->numRows ; i++) { 1309 1389 for (psS32 j = 0 ; j < source->pixels->numCols ; j++) { 1310 1390 if (source->mask->data.U8[i][j] == 0) { 1311 1391 psVector *coord = psVectorAlloc(2, PS_TYPE_F32); 1312 // XXX: Should we use the subimage offsets here, or does it not matter? 1313 coord->data.F32[0] = (psF32) (i); 1314 coord->data.F32[1] = (psF32) (j); 1315 x->data[count] = (psPtr *) coord; 1316 y->data.F32[count] = source->pixels->data.F32[i][j]; 1392 // XXX: Convert i/j to image space: 1393 coord->data.F32[0] = (psF32) (i + source->pixels->row0); 1394 coord->data.F32[1] = (psF32) (j + source->pixels->col0); 1395 x->data[tmpCnt] = (psPtr *) coord; 1396 y->data.F32[tmpCnt] = source->pixels->data.F32[i][j]; 1397 tmpCnt++; 1317 1398 } 1318 1399 } … … 1326 1407 switch (source->models->type) { 1327 1408 case PS_MODEL_GAUSS: 1409 1328 1410 rc = psMinimizeLMChi2(myMin, NULL, params, NULL, x, y, 1329 1411 NULL, (psMinimizeLMChi2Func) p_pmMinLM_Gauss2D_Vec); … … 1374 1456 PS_IMAGE_CHECK_TYPE(image, PS_TYPE_F32, false); 1375 1457 1376 // XXX: make static, document. 1377 // We use a length of 100 here since it is larger enough for all models. 1378 #define MAX_PARAMS 100 1379 1380 psVector *params = psVectorAlloc(MAX_PARAMS, PS_TYPE_F32); 1458 psVector *params = psVectorAlloc(src->models->Nparams, PS_TYPE_F32); 1381 1459 psVector *x = psVectorAlloc(2, PS_TYPE_F32); 1382 if (src->models->Nparams > MAX_PARAMS) {1383 psError(PS_ERR_UNKNOWN, true, "Internal error: increase MAX_PARAMS to %d", src->models->Nparams);1384 }1385 1460 for (psS32 i = 0 ; i < src->models->Nparams ; i++) { 1386 1461 params->data.F32[i] = src->models->params[i]; … … 1390 1465 for (psS32 j = 0 ; j < src->pixels->numCols ; j++) { 1391 1466 psF32 pixelValue; 1392 // XXX: Should you use offsets here?1393 // XXX: Make sure you have col/row order correct.1394 1467 // XXX: Should you be adding the pixels for the entire subImage, 1395 1468 // or a radius of pixels around it? 1396 1469 1397 x->data.F32[0] = (float) j; 1398 x->data.F32[1] = (float) i; 1470 // Convert i/j to imace coord space: 1471 // XXX: Make sure you have col/row order correct. 1472 psS32 imageRow = i + src->pixels->row0; 1473 psS32 imageCol = j + src->pixels->col0; 1474 1475 x->data.F32[0] = (float) imageCol; 1476 x->data.F32[1] = (float) imageRow; 1399 1477 switch (src->models->type) { 1400 1478 case PS_MODEL_GAUSS: … … 1428 1506 // XXX: Must figure out how to calculate the image coordinates and 1429 1507 // how to use the boolean "center" flag. 1430 psS32 imageRow = i + src->pixels->row0;1431 psS32 imageCol = j + src->pixels->col0;1432 1508 1433 1509 image->data.F32[imageRow][imageCol]+= pixelValue; … … 1489 1565 XXX: I added the following. Must conform with IfA. If deriv==NULL, then 1490 1566 we simply don't perform the derivative calculations. 1567 1568 XXX: It is not clear whether the subImage coords, or the image coords should 1569 be used when calling these functions. I don't think it really matters, as 1570 long as we are consistent. 1491 1571 *****************************************************************************/ 1492 1572 psF32 pmMinLM_Gauss2D(psVector *deriv, … … 1553 1633 } 1554 1634 1635 psVector *tmpVec2 = (psVector *) x->data[i]; 1555 1636 tmpVec->data.F32[i] = pmMinLM_Gauss2D(tmpRow, 1556 1637 params, 1557 (psVector *) x->data[i]);1638 tmpVec2); 1558 1639 1559 1640 for (psS32 j = 0 ; j < tmpRow->n ; j++) { -
trunk/psModules/test/Makefile.am
r3231 r3576 1 bin_PROGRAMS = tst_pmFlatField tst_pmMaskBadPixels tst_pmNonLinear tst_pmSubtractBias tst_pmReadoutCombine tst_pmSubtractSky 1 bin_PROGRAMS = tst_pmFlatField tst_pmMaskBadPixels tst_pmNonLinear tst_pmSubtractBias tst_pmReadoutCombine tst_pmSubtractSky tst_pmObjects01 2 2 3 3 AM_LDFLAGS = -L../src -lpsmodule $(LDFLAGS) … … 14 14 15 15 tst_pmSubtractSky_SOURCES = tst_pmSubtractSky.c 16 17 tst_pmObjects_SOURCES = tst_pmObjects01.c 18
Note:
See TracChangeset
for help on using the changeset viewer.
