Changeset 8879
- Timestamp:
- Sep 21, 2006, 5:20:08 PM (20 years ago)
- Location:
- trunk/psModules/src/camera
- Files:
-
- 2 edited
-
pmFPAfileDefine.c (modified) (3 diffs)
-
pmFPAfileIO.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAfileDefine.c
r8848 r8879 531 531 pmFPAfile *pmFPAfileDefineFromConf (bool *found, pmConfig *config, char *filename) 532 532 { 533 bool status;534 535 533 PS_ASSERT_PTR_NON_NULL(config, false); 536 534 PS_ASSERT_PTR_NON_NULL(filename, false); … … 563 561 } 564 562 563 565 564 // image names may not come from file->names 566 565 if (!strcasecmp (file->filerule, "@FILES")) { … … 581 580 } 582 581 583 // use the supplied filename 584 char *infile = psStringCopy (file->filerule); 585 586 // load the header of the first image 587 psFits *fits = psFitsOpen (infile, "r"); 588 psMetadata *phu = psFitsReadHeader (NULL, fits); 589 psFitsClose (fits); 590 591 // determine the current format from the header 592 // determine camera if not specified already 593 file->format = pmConfigCameraFormatFromHeader (config, phu); 594 if (!file->format) { 595 psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", infile); 596 psFree(phu); 597 psFree(fpa); 598 psFree(file); 599 psFree(infile); 600 return NULL; 601 } 602 603 // set the view to the corresponding entry for this phu 604 pmFPAview *view = pmFPAAddSourceFromHeader (fpa, phu, file->format); 605 if (!view) { 606 psError(PS_ERR_IO, false, "Unable to determine source for %s (%s)", file->name, infile); 607 psFree(phu); 608 psFree(fpa); 609 psFree(file); 610 psFree(infile); 611 return NULL; 612 } 613 614 // adjust the rules to identify these files in the file->names data 615 psFree (file->filerule); 616 psFree (file->filextra); 617 file->filerule = psStringCopy ("@FILES"); 618 file->filextra = psStringCopy ("{CHIP.NAME}.{CELL.NAME}"); 619 620 // find the matching fileLevel 621 psMetadata *filemenu = psMetadataLookupPtr (&status, file->format, "FILE"); 622 if (!filemenu) { 623 psError (PS_ERR_IO, true, "missing FILE in FORMAT"); 624 psFree(phu); 625 psFree(fpa); 626 psFree(file); 627 psFree(view); 628 psFree(infile); 629 return NULL; 630 } 631 char *levelName = psMetadataLookupStr (&status, filemenu, "PHU"); 632 if (!levelName) { 633 psError (PS_ERR_IO, true, "missing PHU in FILE in FORMAT"); 634 return NULL; 635 } 636 file->fileLevel = pmFPALevelFromName (levelName); 637 if (file->fileLevel == PM_FPA_LEVEL_NONE) { 638 psError (PS_ERR_IO, true, "unknown level"); 639 return NULL; 640 } 641 642 // associate the filename with the FPA element 643 char *name = pmFPAfileNameFromRule (file->filextra, file, view); 644 645 // save the name association in the pmFPAfile structure 646 psMetadataAddStr (file->names, PS_LIST_TAIL, name, 0, "", infile); 647 648 psFree (phu); 582 if (found) { 583 *found = true; 584 } 649 585 psFree (fpa); 650 psFree (view);651 psFree (name);652 psFree (infile);653 654 *found = true;655 586 return file; 656 587 } -
trunk/psModules/src/camera/pmFPAfileIO.c
r8865 r8879 247 247 } 248 248 249 // We need to read it --- double-check it's open! 250 if (file->state == PM_FPA_STATE_CLOSED) { 251 file->fileLevel = level; 252 if (!pmFPAfileOpen (file, view, config)) { 253 psError(PS_ERR_IO, false, "failed to open file %s when attempting to read", file->name); 254 return false; 255 } 256 } 257 249 258 switch (file->type) { 250 259 case PM_FPA_FILE_IMAGE:
Note:
See TracChangeset
for help on using the changeset viewer.
