ScanImageTiffReader.jl Documentation

ScanImageTiffReader.jl Documentation

About

The ScanImageTiffReader is a Julia 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. It should read most tiff files, but as of now we don't support compressed or tiled data. It is also available as a Matlab, Python, or C library. There's also a command-line interface.

More information and related tools can be found on here.

Both ScanImage and this reader are products of Vidrio Technologies. If you have questions or need support feel free to submit an issue or contact us.

Usage

The ScanImageTiffReader.open function attempts to open a file and execute a query on it before closing and handling any exceptions. The query is passed as an argument and is one of data, metadata, pxtype, etc... See below for examples.

julia> using Pkg
julia> Pkg.add("ScanImageTiffReader")
julia> using ScanImageTiffReader
julia> vol = ScanImageTiffReader.open("my.tif") do io
    data(io)
end

API Documentation

Base.lengthMethod.
length(ctx::Context)

Return the number of planes in the image stack.

Examples

ScanImageTiffReader.open(mytif) do io
    length(io)
end
# output
10
Base.sizeMethod.
size(ctx::Context)

Return the shape of the data in the TIFF file.

Examples

ScanImageTiffReader.open(mytif) do io
    size(io)
end
# output
(512, 512, 10)
data(ctx::Context)

Return an n-dimensional array containing the image stack.

Examples

using ScanImageTiffReader
d = ScanImageTiffReader.open(mytif) do io
    data(io)
end
d[1:10, 1:10, 1]
description(ctx::Context, iframe::Int)

Return the contents of the image description tag for frame iframe.

Examples

desc = ScanImageTiffReader.open(mytif) do io
    description(io, 1)
end
print(desc)
# output
frameNumbers = 1
acquisitionNumbers = 1
frameNumberAcquisition = 1
frameTimestamps_sec = 0.000000
acqTriggerTimestamps_sec =
nextFileMarkerTimestamps_sec =
endOfAcquisition =  0
endOfAcquisitionMode = 0
dcOverVoltage = 0
epoch = [2016 6 4 13 51 7.8046]
metadata(ctx::Context)

Read the ScanImage metadata section from the file.

This data section is not part of the Tiff specification, so common Tiff readers will not be able to access this data.

In ScanImage 2016 and later, this is a JSON string. For previous versions of ScanImage, this is a bytestring that must be deserialized in MATLAB.

Examples

ScanImageTiffReader.open(mytif) do io
    JSON.parse(metadata(io))
end
# output
Dict{String,Any} with 2 entries:
  "SI"        => Dict{String,Any}("hConfigurationSaver"=>Dict{String,Any}("usrF…
  "RoiGroups" => Dict{String,Any}("photostimRoiGroups"=>nothing,"imagingRoiGrou…
pxtype(ctx::Context)

Return the type of the data in the TIFF file.

Examples

ScanImageTiffReader.open(mytif) do io
    pxtype(io)
end
# output
Int16
Context(handle::Ptr{Cvoid}, log::Ptr{UInt8})
open(func::Function, filename::AbstractString, args...)

Open a ScanImage TIFF file filename for reading and apply func to it (with optional arguments).

Examples

ScanImageTiffReader.open(mytif) do io
    length(io)
end
# output
10