Changeset 7419
- Timestamp:
- Jun 7, 2006, 3:16:45 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPACopy.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPACopy.c
r7382 r7419 8 8 #include "pmHDU.h" 9 9 #include "pmHDUUtils.h" 10 #include "pmHDUGenerate.h"11 10 12 11 #include "pmFPACopy.h" … … 116 115 targetReadout->data_exists = sourceReadout->data_exists; 117 116 118 if (pixels) {119 // Copy image120 if ( sourceReadout->image) {121 if (targetReadout->image) {122 psFree(targetReadout->image);123 }117 // Copy image 118 if (sourceReadout->image) { 119 if (targetReadout->image) { 120 psFree(targetReadout->image); 121 } 122 if (pixels) { 124 123 targetReadout->image = psImageFlip(NULL, sourceReadout->image, xFlip, yFlip); 125 } 126 127 // Copy mask 128 if (sourceReadout->mask) { 129 if (targetReadout->mask) { 130 psFree(targetReadout->mask); 131 } 124 } else { 125 psImage *image = sourceReadout->image; // The source image 126 long binnedCols = (image->numCols + xBin - 1) / xBin; 127 long binnedRows = (image->numRows + yBin - 1) / yBin; 128 targetReadout->image = psImageAlloc(binnedCols, binnedRows, image->type.type); 129 } 130 } 131 132 // Copy mask 133 if (sourceReadout->mask) { 134 if (targetReadout->mask) { 135 psFree(targetReadout->mask); 136 } 137 if (pixels) { 132 138 targetReadout->mask = psImageFlip(NULL, sourceReadout->mask, xFlip, yFlip); 133 } 134 135 // Copy weight 136 if (sourceReadout->weight) { 137 if (targetReadout->weight) { 138 psFree(targetReadout->weight); 139 } 139 } else { 140 psImage *mask = sourceReadout->mask; // The source mask image 141 long binnedCols = (mask->numCols + xBin - 1) / xBin; 142 long binnedRows = (mask->numRows + yBin - 1) / yBin; 143 targetReadout->mask = psImageAlloc(binnedCols, binnedRows, mask->type.type); 144 } 145 } 146 147 // Copy weight 148 if (sourceReadout->weight) { 149 if (targetReadout->weight) { 150 psFree(targetReadout->weight); 151 } 152 if (pixels) { 140 153 targetReadout->weight = psImageFlip(NULL, sourceReadout->weight, xFlip, yFlip); 141 } 142 143 // Copy bias 144 while (targetReadout->bias->n > 0) { 145 psListRemove(targetReadout->bias, PS_LIST_HEAD); 146 } 147 // Iterate over the biases 148 psListIterator *biasIter = psListIteratorAlloc(sourceReadout->bias, PS_LIST_HEAD, false); 149 psImage *bias = NULL; // Bias image from iteration 150 while ((bias = psListGetAndIncrement(biasIter))) { 151 psImage *biasCopy = psImageFlip(NULL, bias, xFlip, yFlip); 152 psListAdd(targetReadout->bias, PS_LIST_TAIL, biasCopy); 153 psFree(biasCopy); // Drop reference 154 } 155 psFree(biasIter); 156 } 154 } else { 155 psImage *weight = sourceReadout->weight; // The source weight image 156 long binnedCols = (weight->numCols + xBin - 1) / xBin; 157 long binnedRows = (weight->numRows + yBin - 1) / yBin; 158 targetReadout->weight = psImageAlloc(binnedCols, binnedRows, weight->type.type); 159 } 160 } 161 162 // Copy bias 163 while (targetReadout->bias->n > 0) { 164 psListRemove(targetReadout->bias, PS_LIST_HEAD); 165 } 166 // Iterate over the biases 167 psListIterator *biasIter = psListIteratorAlloc(sourceReadout->bias, PS_LIST_HEAD, false); 168 psImage *bias = NULL; // Bias image from iteration 169 while ((bias = psListGetAndIncrement(biasIter))) { 170 psImage *biasCopy; // Copy of the bias 171 if (pixels) { 172 biasCopy = psImageFlip(NULL, bias, xFlip, yFlip); 173 } else { 174 long binnedCols = (bias->numCols + xBin - 1) / xBin; 175 long binnedRows = (bias->numRows + yBin - 1) / yBin; 176 biasCopy = psImageAlloc(binnedCols, binnedRows, bias->type.type); 177 } 178 psListAdd(targetReadout->bias, PS_LIST_TAIL, biasCopy); 179 psFree(biasCopy); // Drop reference 180 } 181 psFree(biasIter); 182 157 183 psFree(targetReadout); // Drop reference 158 184 }
Note:
See TracChangeset
for help on using the changeset viewer.
