First, download the zipped PyLSM folder from here. (Linked to from this page.)
Next, unzip the folder, navigate inside it at a command prompt, and run
sudo python setup.py install
The website for this python module is http://www.freesbi.ch/en/pylsm and there is some documentation here.
I haven't tried out the gui yet, but here is a snippet of code that should open a Janelia stack.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
plt.ion() | |
from pylsm import lsmreader | |
imageFile = lsmreader.Lsmimage(lsmFileName) | |
imageFile.open() | |
xLen = imageFile.header['Image'][0]['CZ LSM info']['Dimension X'] | |
yLen = imageFile.header['Image'][0]['CZ LSM info']['Dimension Y'] | |
zLen = imageFile.header['Image'][0]['CZ LSM info']['Dimension Z'] | |
numColors = 3 | |
frames = np.zeros((xLen, yLen, zLen, numColors),dtype='uint16') | |
for zPos in range(zLen): | |
redData = np.flipud(imageFile.get_image(stack=zPos, channel=1)) | |
grnData = np.flipud(imageFile.get_image(stack=zPos, channel=0)) | |
frames[:,:,zPos,0] = redData | |
frames[:,:,zPos,1] = grnData | |
fig = plt.figure() | |
ax = fig.add_subplot(111) | |
ax.imshow(frames.max(2)/4096.) |
No comments:
Post a Comment