Closed raacampbell closed 4 years ago
Yes, the stall was because someone cut a cable outside. Novel failure mode.
This indeed happens during the fast preview. It's not important, we leave it for now.
Also doesn't get laid down during a full acquisition
This happens because after the final tile, tileAcq isn't run.
We need to fix this now because it's affecting the automatic brain finding in one out of a total of ten single brain samples.
The best solution is probably to move the code that extracts the tile data to a separate method. Then call that method once more after the acquisition has run.
With the dummyScanner
now baking and saving properly (2ec5c344ad03ebc64d2ab777a5097e64abc5416c) also see the final preview tile not being laid down. So let's try to fix this and hopefully the same concept can be applied to SIBT
.
Changes in this commit 54f5160f2aac420533bcfbb0e9239e9982f3dcd3 and this commit 5654ac741989f62250e8e1e97c45e136a5835bcf fix the last tile bug for the dummyScanner
. It works in preview and bake. It saves the correct number of tiles. Can we implement a similar fix for SIBT?
SIBT.tileAcqDone
should now coordinate the acquisition and display of the final preview tile: c4ba52445a564ab9b0afa56947151d0b283b84da
Ah... It's placing a tile but that tile is just a copy of the penultimate tile. Not fantastic, even though, TBH, 90% of the time the penultimate tile is empty. So the bug is not usually noticeable.
However, with samples that are not brains (i.e. not balls) it's fairly possible for this duplicate issue to cause an extra row or column of tiles to be imaged for no reason. That's a bit annoying.
I thought this was fixed: but right now on the autoROI
branch I don't see the final tile being laid down.
If we examine the last stripe at the CLI at the end of a preview, the final tile is visible as it should be. Also, the following user function returns to screen a different sum
after each z stack:
function BT_timer (src,event,varargin)
% This is a test ScanImage UserFunction used to time events and debug the tiling cycle
persistent nl;
persistent n;
switch event.EventName
case 'acqModeStart'
n=0;
nl=0;
case 'frameAcquired'
n=n+1;
case {'acqDone'}
L=src.hSI.hDisplay.stripeDataBuffer{3};
Lf=L.roiData{1}.imageData{1}{1};
if src.hSI.active
pause(0.2) %Simulate x/y motion
src.hSI.hScan2D.trigIssueSoftwareAcq
end
nl = nl+1;
sum(Lf(:))
case {'acqModeDone'}
fprintf('Acquired %d frames over %d loops\n',n,nl);
end
end
This leads to me to believe that I'm doing something really silly in SIBT.tileAcqDone
. It really should just work with no duplicate tiles and no failure to place the last tile.
Also we don't miss the final tile with stressTestTilePreviewBuffer
, a class included in the repo's diagnostic code.
Ah!
The reason it wasn't entering for the final tile was because of the second armedListener
in SIBT
:
obj.armedListeners{end+1}=addlistener(obj.hC.hUserFunctions, 'acqAbort', @obj.tileScanAbortedInScanImage);
This is the one that's supposed to disarm the scanner if the user presses abort. If I disable that listener in takeRapidPreview
then I get tileAcqDone
running for all the tiles. It's still not placing the final, tile, but this should be fixable now, as it was before...
All tiles placed in grid! a8cd2f298fde3f4f68e4dc4b99918ea72bfde30d However, for this to happen we have to disable the acq abort listener. This seems to have no ill effects, but I will investigate a bit more.
remove the scan abort callback: 0585cda16ccb17c072c0e28d11f8da0bb04b589c
This is a new bug. Although the stall may be due the MATLAB licence server being down. This is unusual.