Changeset 12791 for trunk/psModules/src/camera/pmFPACopy.c
- Timestamp:
- Apr 10, 2007, 2:57:23 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPACopy.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPACopy.c
r12696 r12791 51 51 52 52 if (*target) { 53 psFree(*target);53 psFree(*target); 54 54 } 55 55 if (pixels) { 56 *target = psImageFlip(NULL, source, xFlip, yFlip);57 return;58 } 56 *target = psImageFlip(NULL, source, xFlip, yFlip); 57 return; 58 } 59 59 60 60 // I have the fine image size, I know the binning factor, determine the ruff image size … … 108 108 int xParitySource = psMetadataLookupS32(&mdokS, source->concepts, "CELL.XPARITY"); // Source parity 109 109 int xParityTarget = psMetadataLookupS32(&mdokT, target->concepts, "CELL.XPARITY"); // Target x parity 110 assert (mdokS && mdokT); 111 assert (abs(xParitySource) == 1); 112 assert (abs(xParityTarget) == 1); 110 assert(mdokS && mdokT); 111 if (abs(xParitySource) != 1 || abs(xParityTarget) != 1) { 112 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 113 "CELL.XPARITY is not set for both source (%d) and target (%d)", 114 xParitySource, xParityTarget); 115 psFree(binning); 116 return false; 117 } 113 118 if (xParityTarget != xParitySource) { 114 xFlip = true;119 xFlip = true; 115 120 } else { 116 // Use the source parity117 COPY_CONCEPT(target->concepts, source->concepts, "CELL.XPARITY", S32);121 // Use the source parity 122 COPY_CONCEPT(target->concepts, source->concepts, "CELL.XPARITY", S32); 118 123 } 119 124 120 125 int yParityTarget = psMetadataLookupS32(&mdokT, target->concepts, "CELL.YPARITY"); // Target y parity 121 126 int yParitySource = psMetadataLookupS32(&mdokS, source->concepts, "CELL.YPARITY"); // Source parity 122 assert (mdokS && mdokT); 123 assert (abs(yParitySource) == 1); 124 assert (abs(yParityTarget) == 1); 127 assert(mdokS && mdokT); 128 if (abs(yParitySource) != 1 || abs(yParityTarget) != 1) { 129 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 130 "CELL.YPARITY is not set for both source (%d) and target (%d)", 131 yParitySource, yParityTarget); 132 psFree(binning); 133 return false; 134 } 125 135 if (yParityTarget != yParitySource) { 126 yFlip = true;136 yFlip = true; 127 137 } else { 128 // Use the source parity129 COPY_CONCEPT(target->concepts, source->concepts, "CELL.YPARITY", S32);138 // Use the source parity 139 COPY_CONCEPT(target->concepts, source->concepts, "CELL.YPARITY", S32); 130 140 } 131 141 psTrace("psModules.camera", 3, "xFlip: %d; yFlip: %d\n", xFlip, yFlip); … … 140 150 141 151 // Copy attributes 142 // XXX is this correct under binning?152 // XXX is this correct under binning? 143 153 targetReadout->col0 = sourceReadout->col0; 144 154 targetReadout->row0 = sourceReadout->row0; … … 148 158 149 159 // Copy all three image components (image, mask, weight) 150 readoutCopyComponent (&targetReadout->image, sourceReadout->image, binning, xFlip, yFlip, pixels);151 readoutCopyComponent (&targetReadout->mask, sourceReadout->mask, binning, xFlip, yFlip, pixels);152 readoutCopyComponent (&targetReadout->weight, sourceReadout->weight, binning, xFlip, yFlip, pixels);160 readoutCopyComponent (&targetReadout->image, sourceReadout->image, binning, xFlip, yFlip, pixels); 161 readoutCopyComponent (&targetReadout->mask, sourceReadout->mask, binning, xFlip, yFlip, pixels); 162 readoutCopyComponent (&targetReadout->weight, sourceReadout->weight, binning, xFlip, yFlip, pixels); 153 163 154 164 // Copy bias … … 162 172 while ((bias = psListGetAndIncrement(biasIter))) { 163 173 psImage *biasCopy = NULL; // Copy of the bias 164 readoutCopyComponent (&biasCopy, bias, binning, xFlip, yFlip, pixels);174 readoutCopyComponent (&biasCopy, bias, binning, xFlip, yFlip, pixels); 165 175 psListAdd(targetReadout->bias, PS_LIST_TAIL, biasCopy); 166 176 psFree(biasCopy); // Drop reference … … 181 191 psString name = conceptItem->name; // Name of concept 182 192 if (!strcmp(name, "CELL.TRIMSEC")) continue; 183 if (!strcmp(name, "CELL.BIASSEC")) continue;184 if (!strcmp(name, "CELL.XPARITY")) continue;185 if (!strcmp(name, "CELL.YPARITY")) continue;186 if (!strcmp(name, "CELL.X0")) continue;187 if (!strcmp(name, "CELL.Y0")) continue;188 189 psMetadataItem *copy = psMetadataItemCopy(conceptItem); // Copy of the concept190 psMetadataAddItem(target->concepts, copy, PS_LIST_TAIL, PS_META_REPLACE);191 psFree(copy); // Drop reference193 if (!strcmp(name, "CELL.BIASSEC")) continue; 194 if (!strcmp(name, "CELL.XPARITY")) continue; 195 if (!strcmp(name, "CELL.YPARITY")) continue; 196 if (!strcmp(name, "CELL.X0")) continue; 197 if (!strcmp(name, "CELL.Y0")) continue; 198 199 psMetadataItem *copy = psMetadataItemCopy(conceptItem); // Copy of the concept 200 psMetadataAddItem(target->concepts, copy, PS_LIST_TAIL, PS_META_REPLACE); 201 psFree(copy); // Drop reference 192 202 } 193 203 psFree(conceptsIter); … … 196 206 // XXX this code seems to be very similar to pmConceptsUpdate 197 207 if ((binning->nXbin != 1) || (binning->nYbin != 1)) { 198 bool mdok = false;208 bool mdok = false; 199 209 psRegion *trimsec = psMetadataLookupPtr(&mdok, target->concepts, "CELL.TRIMSEC"); // The trim section 200 210 if (mdok && trimsec && !psRegionIsNaN(*trimsec)) { … … 227 237 } 228 238 229 // XXX make sure this is consistent with the psImageBinning239 // XXX make sure this is consistent with the psImageBinning 230 240 psTrace("psModules.camera", 3, "CELL.X0: Before: %d After: %d\n", xZero, xZero + (xSize - 1) * xParity * sourceBin); 231 241 psTrace("psModules.camera", 9, "(xParity: %d xBin: %d numCols: %d)\n", xParity, sourceBin, xSize); … … 284 294 pmHDU *targetPHU = findBlankPHU(target); // The target PHU 285 295 if (targetPHU && targetPHU != targetHDU) { 286 // pmHDU *sourcePHU = pmHDUGetHighest(source->parent->parent, source->parent, source); // A source HDU296 // pmHDU *sourcePHU = pmHDUGetHighest(source->parent->parent, source->parent, source); // A source HDU 287 297 pmHDU *sourcePHU = findBlankPHU(source); // The target PHU 288 298 if (sourcePHU && sourcePHU->header) {
Note:
See TracChangeset
for help on using the changeset viewer.
