tiff_handling#

Example Usage#

Full Contents:#

tiff_handling.flipThroughStackFindLayer(allstack, title_preamble, axis, bigstep, fig)#
FLIPTHROUGHSTACKFINDLAYER Find a layer flipping through stack

Go through 3d data and change the last index of the stack to find a desired layer. When found, press Enter. Returns the layer index visible when Enter/Return was pressed.

Parameters
  • allstack (N x M x P images) – The stack of images to flip through

  • title_preamble (str) – Title preceding the layer index

  • axis (int) – Which axis to flip through

Returns

  • k (int) – The layer index visible when Enter/Return is pressed.

  • NPMitchell 2019

tiff_handling.loadtiff(path)#

Copyright (c) 2012, YoonOh Tak All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution

  • Neither the name of the Gwangju Institute of Science and Technology (GIST), Republic of Korea nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

tiff_handling.saveastiff(data, path, options)#
options.color

: true or FALSE : If this is true, third dimension should be 3 and the data is saved as a color image.

options.compress
: ‘no’, ‘lzw’, ‘jpeg’ or ‘adobe’.
Compression type.

‘no’ : Uncompressed(Default) ‘lzw’ : lossless LZW ‘jpeg’ : lossy JPEG (When using JPEG compression, ImageWidth,

ImageLength, and RowsPerStrip must be multiples of 16.)

‘adobe’ : lossless Adobe-style

options.jpegquality

: JPEG compression qualtiy. A value between 1 and 100

options.message
: TRUE or false.

If this is false, all messages are skipped.

options.append
: true or FALSE

If path is exist, the data is appended to an existing file. If path is not exist, this options is ignored.

options.overwrite
: true or FALSE

Overwrite to an existing file.

options.big
: true or FALSE,

Use 64 bit addressing and allows for files > 4GB

Defalut value of ‘options’ is

options.color = false; options.compress = ‘no’; options.message = true; options.append = false; options.overwrite = false; options.big = false;

resReturn value. It is 0 when the function is finished with no error.

If an error is occured in the function, it will have a positive number (error code).

Copyright (c) 2012, YoonOh Tak All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution

  • Neither the name of the Gwangju Institute of Science and Technology (GIST), Republic of Korea nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

tiff_handling.saveastiff_demo#

This file shows how to use ‘saveastiff’ function.

tiff_handling.stitchTiffMosaic(fns, nrow, ncol, datfn, oper)#
Parameters
  • fns (struct with fields) – name folder

  • nrow (int) – number of rows in the mosaic

  • ncol (int) – number of columns in the mosaic

  • datfn (str) – path to h5 file to save whole stitched data

  • oper (float (between 0-1)) – overlap percent, as a float between 0-1

  • dtype (string specifier ('uint8'=default)) –

  • maxI (optional float (0-1)) – clip intensity at this percentile

Returns

  • data

  • NPMitchell 2020

tiff_handling.writeTiffPages(im, fn, options)#
WRTITETIFFPAGES

Write a tiff stack to disk page by page

Parameters
  • im (MxNxP numeric array) – the numeric array to write to disk as a tiff

  • fn (str) – the filename (full path) to save the tiff

  • options (struct, optional) –

NPMitchell 2020

Indices and tables#