Changeset 6895 for trunk/psModules/src/astrom/pmConceptsStandard.c
- Timestamp:
- Apr 18, 2006, 2:54:44 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/astrom/pmConceptsStandard.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/astrom/pmConceptsStandard.c
r6872 r6895 14 14 (a)->y0 == (b)->y0 && \ 15 15 (a)->y1 == (b)->y1) ? true : false) 16 17 #define TYPE_CASE(assign, item, TYPE) \ 18 case PS_TYPE_##TYPE: \ 19 assign = item->data.TYPE; \ 20 break; 21 16 22 17 23 … … 218 224 219 225 int binning = 1; // Binning factor in x 220 if (concept->type == PS_DATA_STRING) { 221 psString binString = concept->data.V; // The string containing the binning 222 if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 && 223 sscanf(binString, "%d,%*d", &binning) != 1) || 224 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 && 225 sscanf(binString, "%*d,%d", &binning) != 1)) { 226 psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString); 227 } 228 } else if (concept->type == PS_TYPE_S32) { 229 binning = concept->data.S32; 230 } else { 226 switch (concept->type) { 227 case PS_DATA_STRING: { 228 psString binString = concept->data.V; // The string containing the binning 229 if ((strcmp(pattern->name, "CELL.XBIN") == 0 && sscanf(binString, "%d %*d", &binning) != 1 && 230 sscanf(binString, "%d,%*d", &binning) != 1) || 231 (strcmp(pattern->name, "CELL.YBIN") == 0 && sscanf(binString, "%*d %d", &binning) != 1 && 232 sscanf(binString, "%*d,%d", &binning) != 1)) { 233 psError(PS_ERR_IO, true, "Unable to parse string to get %s: %s\n", pattern->name, binString); 234 } 235 } 236 TYPE_CASE(binning, concept, U8); 237 TYPE_CASE(binning, concept, U16); 238 TYPE_CASE(binning, concept, U32); 239 TYPE_CASE(binning, concept, S8); 240 TYPE_CASE(binning, concept, S16); 241 TYPE_CASE(binning, concept, S32); 242 default: 231 243 psError(PS_ERR_IO, true, "Note sure how to parse %s of type %x --- assuming 1.\n", pattern->name, 232 244 concept->type); … … 324 336 double seconds = NAN; 325 337 switch (timeItem->type) { 326 case PS_TYPE_S32: 327 seconds = timeItem->data.S32; 328 break; 329 case PS_TYPE_F32: 330 seconds = timeItem->data.F32; 331 break; 332 case PS_TYPE_F64: 333 seconds = timeItem->data.F64; 334 break; 338 TYPE_CASE(seconds, timeItem, U8); 339 TYPE_CASE(seconds, timeItem, U16); 340 TYPE_CASE(seconds, timeItem, U32); 341 TYPE_CASE(seconds, timeItem, S8); 342 TYPE_CASE(seconds, timeItem, S16); 343 TYPE_CASE(seconds, timeItem, S32); 344 TYPE_CASE(seconds, timeItem, F32); 345 TYPE_CASE(seconds, timeItem, F64); 335 346 default: 336 347 psError(PS_ERR_IO, true, "Time is not of an expected type: %x\n", timeItem->type); … … 424 435 assert(cameraFormat); 425 436 426 if (concept->type != PS_TYPE_S32) { 427 psError(PS_ERR_IO, true, "Concept %s is not of type S32, as expected.\n", pattern->name); 437 int offset = 0; // Offset of cell (0,0) corner from the chip (0,0) corner 438 439 switch (concept->type) { 440 TYPE_CASE(offset, concept, U8); 441 TYPE_CASE(offset, concept, U16); 442 TYPE_CASE(offset, concept, U32); 443 TYPE_CASE(offset, concept, S8); 444 TYPE_CASE(offset, concept, S16); 445 TYPE_CASE(offset, concept, S32); 446 default: 447 psError(PS_ERR_IO, true, "Concept %s is not of integer type, as expected.\n", pattern->name); 428 448 return NULL; 429 449 } 430 int offset = concept->data.S32;431 450 offset -= fortranCorr(cameraFormat, pattern->name); 432 451 return psMetadataItemAllocS32(pattern->name, pattern->comment, offset);
Note:
See TracChangeset
for help on using the changeset viewer.
