Closed p-j-smith closed 11 months ago
Most likely it's related to this: https://github.com/quantumjot/btrack/blob/9f22f4d056aa55e8022f490c462f89240e21f89a/btrack/utils.py#L160-L163
It is indeed related to that. The issue is that in the above example, the volume is set be two dimensional:
tracker.volume=((0, 1600), (0, 1200))
but not all z
values are 0. When tracker.to_napari()
is called, the dimensionality is determined from the volume we have set:
However, when the tracks are exported to HDF the information about the volume is lost. So after loading tracks from the HDF file, when we convert the tracks to a napari layer the z
values are used to determine the dimensionality:
As not all z
values are 0, it is assumed the tracks are 3D.
I'm not sure what the best solution is, but potential ideas are:
z
values are 0z
values to 0 if a 2D volume is setOr perhaps there's a better solution??
Yes - this is a problem that I've been meaning to deal with for some time! It's weird that there are some non-zero values, but I expect that may be due to dummies? Perhaps we could filter those out and everything would just work
I expect that option 2 is the easiest to implement, but I also like 1 & 3
Yep, it's due to the dummy objects that are inserted into the tracks:
So... you could replace this:
with
z = np.concatenate([np.asarray(track.z)[~np.asarray(track.dummy)] for track in tracks])
and it'll likely fix things for now.
Describe the bug I started working on exporting the tracks in the plugin, but came across an issue whereby the shape of the tracks layer changes after exporting and re-loading.
Before saving the data, the tracks data is 4D. However, after exporting and loading it becomes 5D. This means the exported data can't be visualised on top of the original segmentation, because they have different axes.
Your setup: btrack_version: 0.6.4.dev29 system_platform: macOS-13.4.1-x86_64-i386-64bit system_python: 3.10.12 Comments To reproduce:
which prints: