Changeset 16366 for trunk/psModules/src/camera/pmFPARead.c
- Timestamp:
- Feb 7, 2008, 6:06:05 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPARead.c (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPARead.c
r16365 r16366 108 108 pmReadout *readout, // Readout of interest 109 109 int numScans, // Number of scans to read at a time 110 int overlap, // Number of scans to overlap with previous read 110 111 fpaReadType type // Type of image 111 112 ) … … 173 174 *next = trimsec->x0; 174 175 } else { 175 *next = image ? readout->row0 + numScans : 0;176 *next = image ? readout->row0 + numScans - overlap : 0; 176 177 } 177 178 *last = trimsec->y1; … … 181 182 *next = trimsec->y0; 182 183 } else { 183 *next = image ? readout-> row0 + numScans: 0;184 *next = image ? readout->col0 + numScans - overlap : 0; 184 185 } 185 186 *last = trimsec->x1; … … 210 211 int z, // Plane number 211 212 int numScans, // Number of scans to read at a time 213 int overlap, // Number of scans to overlap with last read 212 214 fpaReadType type // Type of image 213 215 ) … … 237 239 int next; // Next position 238 240 int last; // Last position 239 if (!readoutScanProperties(&next, &last, readout, numScans, type)) {241 if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) { 240 242 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 241 243 return false; … … 393 395 int z, // Desired image plane 394 396 int numScans, // Number of scans (row or col depends on CELL.READDIR); 0 for all 397 int overlap, // Number of scans (row/col) to overlap between scans 395 398 fpaReadType type // Type of image 396 399 ) … … 400 403 assert(z >= 0); 401 404 assert(numScans >= 0); 402 403 psImage **imagePtr = readoutImageByType(readout, type); // Pointer to the image of interest 404 if (*imagePtr && numScans == 0) { 405 assert(overlap >= 0); 406 407 psImage **image = readoutImageByType(readout, type); // Pointer to the image of interest 408 if (*image && numScans == 0) { 405 409 psError(PS_ERR_UNKNOWN, true, "Already read entire image --- won't clobber."); 406 410 return false; … … 422 426 int next; // Next position 423 427 int last; // Last position 424 if (!readoutScanProperties(&next, &last, readout, numScans, type)) {428 if (!readoutScanProperties(&next, &last, readout, numScans, overlap, type)) { 425 429 psError(PS_ERR_UNKNOWN, false, "Unable to determine readout properties."); 426 430 return false; … … 441 445 } 442 446 float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level 443 if (!mdok) {444 psLogMsg(__func__, PS_LOG_WARN, "CELL.BAD is not set --- assuming zero.\n");445 bad = 0.0;446 }447 447 psRegion *trimsec = psMetadataLookupPtr(&mdok, cell->concepts, "CELL.TRIMSEC"); // Trim sections 448 448 if (!mdok || !trimsec || psRegionIsNaN(*trimsec)) { … … 479 479 } 480 480 int upper = next + numScans; // Upper limit to next section 481 if (!*image) { 482 upper += overlap; 483 } 481 484 482 485 // Blow away existing data. 483 486 // Do this before returning, so that we're not returning data from a previous read 484 psImage **image = readoutImageByType(readout, type);485 487 psFree(*image); 486 488 *image = NULL; … … 880 882 881 883 882 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans )884 bool pmReadoutMore(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 883 885 { 884 886 PS_ASSERT_PTR_NON_NULL(readout, false); 885 887 PS_ASSERT_FITS_NON_NULL(fits, false); 886 888 887 return readoutMore(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);888 } 889 890 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans )889 return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE); 890 } 891 892 bool pmReadoutReadChunk(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 891 893 { 892 894 PS_ASSERT_PTR_NON_NULL(readout, false); … … 895 897 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 896 898 897 return readoutReadChunk(readout, fits, z, numScans, FPA_READ_TYPE_IMAGE);899 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_IMAGE); 898 900 } 899 901 … … 903 905 PS_ASSERT_FITS_NON_NULL(fits, false); 904 906 905 return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_IMAGE);907 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_IMAGE); 906 908 } 907 909 … … 943 945 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 944 946 947 bool pmReadoutMoreMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 948 { 949 PS_ASSERT_PTR_NON_NULL(readout, false); 950 PS_ASSERT_FITS_NON_NULL(fits, false); 951 952 return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK); 953 } 954 955 bool pmReadoutReadChunkMask(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 956 { 957 PS_ASSERT_PTR_NON_NULL(readout, false); 958 PS_ASSERT_FITS_NON_NULL(fits, false); 959 PS_ASSERT_INT_NONNEGATIVE(z, false); 960 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 961 962 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_MASK); 963 } 964 945 965 bool pmReadoutReadMask(pmReadout *readout, psFits *fits, int z) 946 966 { … … 948 968 PS_ASSERT_FITS_NON_NULL(fits, false); 949 969 950 return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_MASK);970 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_MASK); 951 971 } 952 972 … … 979 999 ////////////////////////////////////////////////////////////////////////////////////////////////////////////// 980 1000 1001 bool pmReadoutMoreWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 1002 { 1003 PS_ASSERT_PTR_NON_NULL(readout, false); 1004 PS_ASSERT_FITS_NON_NULL(fits, false); 1005 1006 return readoutMore(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT); 1007 } 1008 1009 bool pmReadoutReadChunkWeight(pmReadout *readout, psFits *fits, int z, int numScans, int overlap) 1010 { 1011 PS_ASSERT_PTR_NON_NULL(readout, false); 1012 PS_ASSERT_FITS_NON_NULL(fits, false); 1013 PS_ASSERT_INT_NONNEGATIVE(z, false); 1014 PS_ASSERT_INT_NONNEGATIVE(numScans, false); 1015 1016 return readoutReadChunk(readout, fits, z, numScans, overlap, FPA_READ_TYPE_WEIGHT); 1017 } 1018 981 1019 bool pmReadoutReadWeight(pmReadout *readout, psFits *fits, int z) 982 1020 { … … 984 1022 PS_ASSERT_FITS_NON_NULL(fits, false); 985 1023 986 return readoutReadChunk(readout, fits, z, 0, FPA_READ_TYPE_WEIGHT);1024 return readoutReadChunk(readout, fits, z, 0, 0, FPA_READ_TYPE_WEIGHT); 987 1025 } 988 1026
Note:
See TracChangeset
for help on using the changeset viewer.
