使用球谐函数进行细胞质参数化
项目描述
3D细胞参数化
基于球谐函数系数的3D细胞质和核质的参数化
安装
稳定版本: pip install aicscytoparam
开发头: pip install git+https://github.com/AllenCell/aics-cytoparam.git
如何使用
这里概述了如何使用aicscytoparam
创建3D细胞的参数化示例。在这种情况下,3D细胞将由细胞分割、核分割和表示标记蛋白荧光信号的荧光蛋白(FP)图像表示。
# Import required packages
import numpy as np
import matplotlib.pyplot as plt
from aicscytoparam import cytoparam
from skimage import morphology as skmorpho
# First create a cuboid cell with an off-center cuboid nucleus
# and get the spherical harmonics coefficients of this cell and nucleus:
w = 100
mem = np.zeros((w, w, w), dtype = np.uint8)
mem[20:80, 20:80, 20:80] = 1
nuc = np.zeros((w, w, w), dtype = np.uint8)
nuc[40:60, 40:60, 30:50] = 1
# Create an FP signal located in the top half of the cell and outside the
# nucleus:
gfp = np.random.rand(w**3).reshape(w,w,w)
gfp[mem==0] = 0
gfp[:, w//2:] = 0
gfp[nuc>0] = 0
# Vizualize a center xy cross-section of our cell:
plt.imshow((mem + nuc)[w//2], cmap='gray')
plt.imshow(gfp[w // 2], cmap='gray', alpha=0.25)
plt.axis('off')
# Use aicsshparam to expand both cell and nuclear shapes in terms of spherical
# harmonics:
coords, coeffs_centroid = cytoparam.parameterize_image_coordinates(
seg_mem=mem,
seg_nuc=nuc,
lmax=16, # Degree of the spherical harmonics expansion
nisos=[32, 32] # Number of interpolation layers
)
coeffs_mem, centroid_mem, coeffs_nuc, centroid_nuc = coeffs_centroid
# Run the cellular mapping to create a parameterized intensity representation
# for the FP image:
gfp_representation = cytoparam.cellular_mapping(
coeffs_mem=coeffs_mem,
centroid_mem=centroid_mem,
coeffs_nuc=coeffs_nuc,
centroid_nuc=centroid_nuc,
nisos=[32, 32],
images_to_probe=[('gfp', gfp)]
).data.squeeze()
# The FP image is now encoded into a representation of its shape:
print(gfp_representation.shape)
(65, 8194)
# Now we want to morph the FP image into a round cell.
# First we create the round cell:
from skimage import morphology as skmorpho
mem_round = skmorpho.ball(w // 3) # radius of our round cell
nuc_round = skmorpho.ball( w// 3) # radius of our round nucleus
# Erode the nucleus so it becomes smaller than the cell
nuc_round = skmorpho.binary_erosion(
nuc_round, selem=np.ones((20, 20, 20))
).astype(np.uint8)
# Vizualize a center xy cross-section of our round cell:
plt.imshow((mem_round + nuc_round)[w // 3], cmap='gray')
plt.axis('off')
# Next we need to parameterize the coordinates of our round
# cell:
coords_round, _ = cytoparam.parameterize_image_coordinates(
seg_mem=mem_round,
seg_nuc=nuc_round,
lmax=16,
nisos=[32, 32]
)
# Now we are ready to morph the FP image into our round cell:
gfp_morphed = cytoparam.morph_representation_on_shape(
img=mem_round + nuc_round,
param_img_coords=coords_round,
representation=gfp_representation
)
# Visualize the morphed FP image:
plt.imshow((mem_round + nuc_round)[w // 3], cmap='gray')
plt.imshow(gfp_morphed[w // 3], cmap='gray', alpha=0.25)
plt.axis('off')
参考文献
有关如何使用此包分析艾伦细胞研究所超过200k个单细胞图像数据集的示例,请参阅我们的bioaRxiv论文。
开发
有关开发代码的信息,请参阅CONTRIBUTING.md。
有问题吗?
如果您有任何问题,请自由地在我们艾伦细胞论坛上留下评论: https://forum.allencell.org/。
免费软件:艾伦研究所软件许可证
项目详情
下载文件
下载适合您平台的应用程序文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
aicscytoparam-0.1.12.tar.gz (148.2 kB 查看哈希值)
构建分发
关闭
aicscytoparam-0.1.12.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 13f3e622b24860ab47b0d2546e845d1fd56b66088e0edb38ed7f661f6017ad7a |
|
MD5 | 96deb77aba1f86465c839f5b2e5ed3b8 |
|
BLAKE2b-256 | c262a18650d39ef24106e00d776f65d17760123ef716a10df565419213d3259e |
关闭
aicscytoparam-0.1.12-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | a621d95e9febbb02448309fb7b33803aa98386586703a1ed41623a4cb0d36279 |
|
MD5 | e6fc18dfafced59579cfe310395a0f2e |
|
BLAKE2b-256 | 9f000e5180689512deb3c6f737e1a6308dabcf03e7a49910c4d531710dc2454d |