SWC-Advanced-Microscopy / BakingTray

Serial-section automated anatomy extension for ScanImage
https://bakingtray.mouse.vision/
GNU Lesser General Public License v3.0
12 stars 5 forks source link

autoROI acquisitions that finish with no tissue visible do not stitch #316

Open raacampbell opened 4 years ago

raacampbell commented 4 years ago

No FINISHED file made. Likely it should stitch. Or maybe it should stitch if it go over 75% of the way through?

----------------------------------------------------------------------
 * Section 277

Logging to file F:\NYU-29_NYU-27_NYU-26_SH015\rawData\NYU-29_NYU-27_NYU-26_SH015-0277\acquisition_log.txt
  MSG#1 -- ATTACH LOGGER -- [loghandler,loghandler.attachLogObject -> bake -> bake_callback -> @(varargin)obj.bake_callback(varargin{:})]
Setting up z-scanning with "step" waveform
Armed scanner: 10-Nov-2020 02:22:39
initialisePreviewImageData is in auto-ROI mode. It updates BT.frontLeftWhenPreviewWasTaken:
  X: 3.15 --> 3.15
  Y: -3.17 --> -3.15
initialisePreviewImageData is getting tile positions using front-left value: x=3.15 y=-3.15
Initialised a preview image of 152 columns by 152 rows using supplied tile positions.
Pre-allocated tile buffer to 80 x 80 2 x 4

Finished 5 tile positions in 5.0 seconds (averaging 1.00 s per tile)

SAVING PREVIEW IMAGE TO: F:\PREVIEWIMAGES\NYU-29_NYU-27_NYU-26_SH015_section_277_2020_22_10.mat
getNextROIs is getting previewImages
Preview image will display only channel 2 from now on
BT.returnPreviewStructure makes pStack with image of size 152 by 152 and frontLeftStageMM x=3.15 y=-3.15
getNextROIs is running autoROI

Current section number: 277
Length roiStats: 277
Before ROI shift we have:
#1 Corner position: 0/0  Box Size: 153/153

After ROI shift we have:
#1 Corner position: 1/0  Box Size: 153/153

Running autoROI with provided threshold of 15.84
Removing corner ROI
Removing corner ROI
autoROI found no bounding boxes
 ** Stats array is empty. autoROI is bailing out. **

*** Found no tissue in Section 277 during Bake. Quitting acquisition. ***

  MSG#1 -- DETACH LOGGER -- [loghandler,loghandler.detachLogObject -> bakeCleanupFun -> @()bakeCleanupFun(obj) -> onCleanup.delete -> bake -> bake_callback -> @(varargin)obj.bake_callback(varargin{:})]

Closed log files

Disarmed scanner: 10-Nov-2020 02:22:47
raacampbell commented 3 years ago

Finish file will now be made: 5fcbbd6d1fbee569bfb7fb0d4678aa0f551de133

raacampbell commented 3 years ago

Ok: the error is that it fails to make the preview image stack as follows:

 * Section 279

Logging to file F:\FMR012_CI014_AL048_KS038\rawData\FMR012_CI014_AL048_KS038-0279\acquisition_log.txt
  MSG#1 -- ATTACH LOGGER -- [loghandler,loghandler.attachLogObject -> bake -> bake_callback -> @(varargin)obj.bake_callback(varargin{:})]
Setting up z-scanning with "step" waveform
Armed scanner: 07-Apr-2021 22:24:20
Failed to make preview image stack!
imRows:
   NaN

imCols:
   NaN

tp:
   -3.8477   -6.2561

  MSG#1 -- DETACH LOGGER -- [loghandler,loghandler.detachLogObject -> bakeCleanupFun -> @()bakeCleanupFun(obj) -> onCleanup.delete -> bake -> bake_callback -> @(varargin)obj.bake_callback(varargin{:})]

Then the error is:


Closed log files
FAILURE -- Scanner still in acquisition mode. Can not disarm. -- [,SIBT.disarmScanner{141} -> bakeCleanupFun{13} -> @()bakeCleanupFun(obj){74} -> onCleanup.delete{81} -> bake{25} -> bake_callback{52} -> @(varargin)obj.bake_callback(varargin{:}){61}]
resetting abort flags
Tearing down scanner
Requested 284 slices: this is 14.20 mm thick but only 0.39 mm is possible. You can cut a maximum of 6 slices.

BAKE FAILED IN acquisition_view. CAUGHT THE FOLLOWING ERROR:
 NaN and Inf not allowed.
Line 47 in C:\MATLAB\BakingTray\code\@BT\initialisePreviewImageData.m
Line 27 in C:\MATLAB\BakingTray\code\@BT\runTileScan.m
Line 208 in C:\MATLAB\BakingTray\code\@BT\bake.m
Line 52 in C:\MATLAB\BakingTray\code\+BakingTray\+gui\@acquisition_view\bake_callback.m
Line 61 in C:\MATLAB\BakingTray\code\+BakingTray\+gui\@acquisition_view\buildFigure.m

Error using zeros
NaN and Inf not allowed.

Error in BT/initialisePreviewImageData (line 47)
        obj.lastPreviewImageStack = zeros([imRows,imCols, ...

Error in BT/runTileScan (line 27)
    obj.initialisePreviewImageData(obj.currentTilePattern);

Error in BT/bake (line 208)
        if ~obj.runTileScan

Error in BakingTray.gui.acquisition_view/bake_callback (line 52)
        sectionInd = obj.model.bake; %if the bake loop didn't start, it returns 0

Error in BakingTray.gui.acquisition_view/buildFigure>@(varargin)obj.bake_callback(varargin{:}) (line 61)
                    'Callback', @obj.bake_callback, ...

Error while evaluating UIControl Callback.