Better way to read roi
mri1998 opened this issue · comments
Now, the code read roi from
footer.SpeFormat.DataHistories.DataHistory.Origin.Experiment.Devices.Cameras.Camera.ReadoutControl.RegionsOfInterest.CustomRegions.RegionOfInterest
However, for LightField 6.7, if you choose Full Sensor mode, roi here is untrustworthy, like this:
<CustomRegions count="1" relevance="False" type="RegionOfInterestCollection">
<RegionOfInterest id="0" x="71" width="286" xBinning="1" y="413" height="512" yBinning="1" />
</CustomRegions>
It should be <RegionOfInterest id="0" x="0" width="1024" xBinning="1" y="0" height="1024" yBinning="1" />
for Full Sensor mode. relevance="False" means this roi is wrong. Although the code can read main data correctly (beacuse it use xDim from footer.SpeFormat.DataFormat.DataBlock.DataBlock to calculate read how many data), but the roi is absolutely wrong, which make us confused for a long time.
At least for LightField6.7 * EMCCD 1024B_eXcelon3, there is a place storing the right roi, change CustomRegions to Result, namely:
footer.SpeFormat.DataHistories.DataHistory.Origin.Experiment.Devices.Cameras.Camera.ReadoutControl.RegionsOfInterest.Result.RegionOfInterest
like this:
<Result r:readOnly="True" type="RegionOfInterestCollection" count="1">
<RegionOfInterest id="0" x="0" width="1024" xBinning="1" y="0" height="1024" yBinning="1" />
</Result>
It suit all mode in LightField6.7 (Full Sensor, Full Sensor(Binned), Rows Binned, Custom Regions of Interest).
One extra sentence, now in '_read_data' when we want to get 'data_xdim' and 'data_ydim', there is no need to tistinguish between nroi>1 and nroi==1 situations, either way to get dim is right.