[英]Particle tracking with trackpy gives 'keframe' error?
我有 1000 幀的 tiff 圖像堆棧,我試圖在其中跟蹤以布朗運動擴散的粒子。 所以我使用 trackpy 進行粒子跟蹤:導入 tiff 堆棧,定位特征(粒子),然后 plot 它們的軌跡。 我正在使用以下代碼(來自 trackpy 演練頁面):
import pims
import trackpy as tp
frames = pims.open("image.tif")
f = tp.locate(frames[0], 9, invert=False)
但是最后一行 (tp.locate) 給出了回溯:
AttributeError Traceback (most recent call last)
<ipython-input-78-0fbce96715a7> in <module>
----> 1 f = tp.locate(frames[0], 9, invert=False)
~\anaconda3\lib\site-packages\slicerator\__init__.py in __getitem__(self, i)
186 indices, new_length = key_to_indices(i, len(self))
187 if new_length is None:
--> 188 return self._get(indices)
189 else:
190 return cls(self, indices, new_length, propagate_attrs)
~\anaconda3\lib\site-packages\pims\base_frames.py in __getitem__(self, key)
96 """__getitem__ is handled by Slicerator. In all pims readers, the data
97 returning function is get_frame."""
---> 98 return self.get_frame(key)
99
100 def __iter__(self):
~\anaconda3\lib\site-packages\pims\tiff_stack.py in get_frame(self, j)
119 t = self._tiff[j]
120 data = t.asarray()
--> 121 return Frame(data, frame_no=j, metadata=self._read_metadata(t))
122
123 def _read_metadata(self, tiff):
~\anaconda3\lib\site-packages\pims\tiff_stack.py in _read_metadata(self, tiff)
124 """Read metadata for current frame and return as dict"""
125 # tags are only stored as a TiffTags object on the parent TiffPage now
--> 126 tags = tiff.keyframe.tags
127 md = {}
128 for name in ('ImageDescription', 'image_description'):
~\anaconda3\lib\site-packages\skimage\external\tifffile\tifffile.py in __getattr__(self, name)
2752 setattr(self, name, value)
2753 return value
-> 2754 raise AttributeError(name)
2755
2756 def __str__(self):
AttributeError: keyframe
我哪里錯了? 我也試過使用
imageio.imread("image.tif")
導入圖像然后使用
f=tp.locate(frames[0], 9, invert=False)
來定位粒子。 但是這個 output 應該是 x 和 y 坐標的數據,就像這樣
而我得到的只是 x 軸:
我剛剛遇到了同樣的問題,並通過在我的 anaconda 提示符中輸入“conda install pims”解決了這個問題。 我以前做過“pip install pims”,但我認為它搞砸了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.