Tile Sorting Functions


Tile scanning supports user written functions to determine the order in wich Scan Tiles will be imaged. Sorting functions should take 2 arguments, the index of the starting Tile and the array of Tiles to be sorted. It should export a sorted index array. The starting Tile index is generally taken to be the Tile closest to the current position. This is accounted for before entering the defined function by default however it can also be ignored allowing the function itself to determing the starting index. The returned index array should be set as the value of the tileScanIndices property in the Tile Manager.

% The tile sort function itself.
function pathIdxs = tileSortFcn(startIdx, hTiles)

% Is useage in Tile Manager
function scanTilePathIdxs = getTileScanPath(obj, startTileIdx, scanTiles)
    pathFnc = str2func(obj.scanTileSortFcn);
    scanTilePathIdxs = pathFnc(startTileIdx, scanTiles);
end

The selection button on the Tile View will allow you to choose a function from any folder but functions should be saved to folders on the Matlab search path for best results. The functions may sort the Tiles in any manner desired. For information on what data is contained in the Tile objects please see the Tile Objects page.

Note

In most cases the Tile scannning will step to each Tile location and acquire the desired number of frames as a separate acquisition. This means that acquiring Tiles in Z is performed more or less like a slow Z stack but without using the Stack Manager component, that is to say acquisition by Z plane is sequential following the acquisition of all Tiles on a discrete Z plane first. The default sorting function will sort Tiles starting with the highest Z plane (most negative value in keeping with ScanImage’s coordinate system convention that + Z is deeper into the sample) and ending with the deepest Z plane. Scanning of the Tiles will then follow this convention of scanning all tiles on 1 Z plane before stepping to the next Z plane with defined Tiles, filling in image data as it goes. This can be edited without too much difficulty to acquire at all the Z positions of a given X-Y position first but it will still be broken into separate acquisitions where the stage slowly steps to new position before acquiring.

Because this is still slow the user is permitted to use a FastZ device to traverse Z. In this case all Z planes are acquired in a single acquisition at a single X-Y location. The image data is then fed to Tiles based on a matching algorithm that looks at the Tiles location and geometry to match Tiles at different Z planes. This means that you only acquire Tiles at a single Z plane and tiles should be uniform and aligned. It also means sorting will only be done on a single X-Y plane and will ignore Tiles at different Z planes (deeper than the most shallow Z).

The following image should help illustrate this difference in scanning modes.

../../_images/tileScanZModes.PNG