Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 2.87 KB

readme.md

File metadata and controls

68 lines (50 loc) · 2.87 KB

pyJetRaw, the Python Module for Jetraw

This is the Jetraw Python Module which allows you to read and write TIFF files using Jetraw's compression. For more info visit https://www.dotphoton.com/

Requirements

Installation Windows

First download the WHL file from latest release, or browse previous releases. Once the WHL file is downloaded in order to install pyJetraw run the following command:

pip install JetRaw-x.y.z-py3-none-any.whl

Installation Linux

The WHL file needs to be installed like in the previous section but an extra step is necessary.

You need to add to the LD_LIBRARY_PATH variable the dpcore and jetraw libraries location so pyDpcore is able to find them:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path_to_jetraw_folder/lib/

It is recommended to add this instruction in your bashrc (/home/user/.bashrc) file, then everytime a bash environment is created everything is set up to use pyJetraw. Remember that if you are using an IDE to run python, you will need to launch it from the Terminal. If not the enviroment will not be correctly configured.

Usage

Here are some code snippets of how the module would typically be used.

import jetraw

# Writing a numpy array representing dpcore-prepared stack.
jetraw.imwrite('temp.tif', data, description="Python Jetraw Tests")

# Reading whole stack from TIFF file as numpy array.
image_stack = jetraw.imread('temp.tif')
# image_stack.shape has number of pages as fist dimensions
# image_stack.dtype returns np.uint16

# Read selected pages
image = jetraw.imread('temp.tif', key=range(4, 40, 2))

# Iterate over all pages in TIFF file
with jetraw.TiffReader('temp.tif') as tif_reader:
    for page in range(tif_reader.pages):
        image = tif_reader.read(page)

# Successively write the frames of one contiguous series to a TIFF file
with jetraw.TiffWriter('temp.tif', description='JetRaw rocks!') as tif_writer:
    for frame in data:
        tif_writer.write(frame)

# Get information from JetRaw-compressed TIFF without reading data.
tif = jetraw.TiffReader('temp.tif')
tif.pages   # number of pages in the file
tif.width   # width of a page
tif.height  # Height of a page
tif.close()

Contact

Feel free to use the issues section to report bugs or request new features. You can also ask questions and give comments by visiting the discussions, or following the contact information at https://jetraw.com.