We provide two different methods for opening Tiff files produced by ScanImage. The ScanImageTiffReader is the fastest way of loading whole volumes, and provides some minimal functionality for extracting metadata. The scanimage.util.opentif() provides more functionality for decoding and loading metadata into Matlab, but is not currently optimized for quickly loading image data.
ScanImageTiffReader
The ScanImageTiffReader is a command line tool and library for extracting data from Tiff and BigTiff files recorded using ScanImage. It is a very fast tiff reader and provides access to ScanImage-specific metadata. Interfaces to the library are provided for Python, Matlab and Julia . This library should actually work with most tiff files, but as of now we don’t support compressed or tiled data.
scanimage.util.opentif()
A Matlab function included with ScanImage that decodes metadata information contained in a ScanImage Tiff file.
This utility replaces the 'scim_openTif()' function supplied with ScanImage 4.2.
Location:
<ScanImage Application Directory>/+scanimage/+util/
Syntax:
scanimage.util.opentif()
scanimage.util.opentif(filename, flagN/flagNArg)
header = scanimage.util.OpenTiff(filename, flagN/flagNArg)
header, Aout] = scanimage.util.OpenTiff(filename, flagN/flagNArg)
[header, Aout, imgInfo] = scanimage.util.OpenTiff(filename, flagN/flagNArg)
Input/Output Parameters:
- filename
the fully qualified name of the Tiff file - flagN/flagNArg:
Optional Flags (string-valued) and/or flag/value pairs, in any order, specifying options to use in opening the specified file. The flag values are case-insensitive.
- 'channel' or 'channels': Argument specifies subset of channel(s) to extract. Ex: 1,[1 3], 2:4.
- 'frame' or 'frames': Argument specifies subset of frames present to extract. Use 'inf' to specify all frames above highest specified value. Ex: 1:30, [50 inf], [1:9 11:19 21 inf]
- 'slice' or 'slices': Argument specifies subset of slices present to extract. Use 'inf' to specify all slices above highest specified value. Ex: 1:30, [50 inf], [1:9 11:19 21 inf]
- 'volume' or 'volumes': Argument specifies subset of volumes present to extract. Use 'inf' to specify all slices above highest specified value. Ex: 1:30, [50 inf], [1:9 11:19 21 inf]
- header
'header' TODO - Aout
'Aout' TODO - imgInfo
'imgInfo' contains basic information about images existent in the given Tiff file: number of images.
Details:
This utility opens the given ScanImage Tiff file, extracting its header information and sequential image data, and, if specified, stores all of the image contents in the output array Aout, if specified.
In the case where a Tiff file name is not specified, a dialog is launched to allow interactive selection.
In the case where 'Aout' is specified, a matrix of the size M x N x C x F x S x V is created, where C spans the channel indices, F spans the frame indicies, S spans the slice indices, and V the volume indices. Otherwise, the image file is not actually read; thus, only header information is extracted.
In case where an error(s) is encountered, the program will attempt to output whatever image data is available to it as an uncategorized stream of images. This stream will be an array of the form M x N x (number of images), raw output without any post-processing, containing all the frames found within the file.
'header' contains the following information: TODO
'Aout' contains the following information: TODO
'imgInfo' contains the following information:
- number of channels
- number of bytes per pixel
- number of lines per frame
- number of slices
- number of volumes
- number of frames
- the tiff filename
- the ScanImage version