API Documentation

This page contains some basic documentation for the pyLSM project.

Modules in pyLSM

The lsmreader Module

The module lsmreader is a module to read images recorded with a Zeiss microscope LSM 510

To load an image, simply points the file you want to load.

>>> imageFile = Lsmimage(LSM_FILE)
>>> imageFile.open()

To get the image data of the first channel :

>>> imageData = imageFile.get_image(stack=0,channel=0)

If you have several stacks :

>>> imageData = imageFile.get_image(stack=10,channel=0)

To get the histogram of the image :

>>> [x, y] = imageFile.get_hist()

To avoid all the pixels that have a value below than 1000 (for example).

>>> imageThresh = imageFile.get_threshold(1000)

This command will produce the same matrix as the one from get_image, but with a mask that prevent pixels below the threshold to be considered.

class pylsm.lsmreader.Lsmimage(filename, time=None)

Opens the zeiss microscope image self.header contains the header of the opened file

self.image contain the array that difine the image.

add_stack(matrix_list, where='top')

Adds a stack to the image data

close()

Close the image by cleaning the memory. The image can still be opened using the open method

get_blob()

Gets the blob of the last displayed image.

get_fft(stack=-1, channel=-1, precision=1)

Computes the fast Fourrier transform of the image. You can specify the stack and the channel you want to compute. If stack and channel are not specified, it computes the fft on the latest displayed image.

The method returns the module and the phase image.

get_hist(stack=0, length=100)

Returns the histogram of the image pixel values

get_image(stack=-1, channel=-1, precision=1, angle=None)

Returns the array matrix of the image

get_projection(precision=1, threshold=None)

Returns the projection in the x axis of the image

get_rotation()

Returns the current rotation of the image

get_threshold(threshold, precision=1)

Returns an binary matrix where 0 depicts pixels lower than the threshold and 1 values higher or equal.

get_thresholded_image(value=None)

return the thresholded image of the original image. Value is the min value to be considered. If no value is send, the distribution of the pixel intensity in the whole image is considered

get_thresholded_value(value=None)

return the threshold below which the noise is estimated. Value (default = 1.2) is the portion of the pixels to consider.

open()

Load the image in the memory

set_rotation(angle)

Set the rotation of the image

threshold(value)

Computes the threshold of all the images

The lsmparse Module

lsmparse is used to parse the lsm files in order to extract the image matrices

pylsm.lsmparse.convert_type(tiff_type)

Converts the tiff type in python type

pylsm.lsmparse.find_num_after(string, pattern)

Finds a number in a string after the given pattern.

>>> find_num_after('96toto43','toto')
>>> 43
pylsm.lsmparse.find_num_before(string, pattern)

Finds a number in a string before the given pattern.

>>> find_num_before('19taratata96toto54','toto')
>>> 96
pylsm.lsmparse.read_image(fid, headers, cz_info)

Read the images and return them as matrices

pylsm.lsmparse.read_image_header(fid, start_position)

Read the image header

pylsm.lsmparse.read_stack(fid, width, length, bits_per_samples, compression)

Reads one stack of the image file

pylsm.lsmparse.read_tag(fid, position, method='Normal')

Read the tags in header

Table Of Contents

Previous topic

End User Documentation

This Page