首页 > 解决方案 > Trackpy tp.batch 有效,但 annotate.3d 给出与图像尺寸相关的属性错误?

问题描述

我有一个来自我在斐济创建的视频的 tiff 堆栈。我想跟踪粒子并随时间跟踪它们的强度。

我遵循了 Trackpy 的演练,它似乎适用于 tp.batch,但是当我尝试使用 annotate 3d 可视化结果时,出现错误:

if image.ndim != 3 and not (image.ndim == 4 and image.shape[-1] in (3, 4)):

  File "PATH", line 256, in __getattr__
    raise AttributeError

AttributeError

以下是带有 head() 的 tp.batch 的结果

Frame 5: 1 features
Frame 6: 1 features
Frame 7: 1 features
Frame 8: 1 features
Frame 9: 1 features
Frame 10: 1 features
Frame 11: 2 features
Frame 12: 2 features
Frame 13: 2 features
Frame 14: 2 features
Out[77]: 
          y           x          mass  ...      ep_y      ep_x  frame
0  9.478312  642.114524  11851.919420  ...  0.021276  0.085622      5
1  9.298654  608.647362  10689.680487  ...  0.024296  0.097777      6
2  9.034290  575.615509  10385.377583  ...  0.025193  0.101387      7
3  9.060161  541.555573  10356.535314  ...  0.025626  0.103128      8
4  8.994890  507.360459   9833.859577  ...  0.029229  0.117628      9

这是来自 FIJI 的有关 tiff 的信息

Title: stack4.tif
Width:  1330 pixels
Height:  24 pixels
Depth:  301 pixels
Size:  9.2MB
Voxel size: 1x1x1 pixel^3
ID: -4
Bits per pixel: 8 (grayscale LUT)
Display range: 0-255
Frame: 1/301 (slice:600)
Frame rate: 5.88235 fps
Frame interval: 0.01700 sec
No threshold
ScaleToFit: false
Uncalibrated
Path: PATH/stack4.tif
Screen location: 100,245 (1440x900)
SetMenuBarCount: 5 (0ms)
Coordinate origin:  0,0,0
No properties
No overlay
No selection

这是我的代码

import pims
import trackpy as tp

frames=pims.open('PATH/stack4.tif');
plt.imshow(frames[10]);
plt.show()
f = tp.locate(frames[10], (11,39), threshold=75, minmass=100, separation=5);
tp.annotate(f, frames[10]);
f = tp.batch(frames[5:15], (11,39), threshold=75, minmass=100, separation=5);
f.head()
tp.annotate3d(f, frames[5:15]);

标签: pythontrackingtifffijitrackpy

解决方案


推荐阅读