-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in calling trackpy.batch
with multi-frame TIFF file
#700
Comments
Can this problem be isolated to trackpy? I.e. is there a problem if you access all the frames like this:
You would want to try it with and without the preprocessing. |
Hi @nkeim, Thanks for the quick reply. Here is a snippet of the code I just tested follow your suggestion: import pims
import numpy as np
import imgrvt as rvt
from dataclasses import dataclass
from time import time
@dataclass(frozen=True)
class RVTSettings:
min_radius : int = 2
max_radius : int = 25
rvt_type : str = "normalized"
highpass : int = 5
coarse_factor : int = 1
coarse_mode : str = "add"
pad_mode : str = "constant"
@pims.pipeline
def apply_rvt(input_frame: np.ndarray,
rvt_settings: RVTSettings) -> np.ndarray:
""" Converts the input frame to float32 and applies
Radial Variance Transform.
"""
input_frame = input_frame.astype(np.float32)
start = time()
frame_rvt = rvt.rvt(input_frame,
rvt_settings.min_radius,
rvt_settings.max_radius,
rvt_settings.rvt_type,
highpass_size=rvt_settings.highpass,
coarse_factor=rvt_settings.coarse_factor,
coarse_mode=rvt_settings.coarse_mode,
pad_mode=rvt_settings.pad_mode)
print(f"RVT execution: {time() - start}")
return frame_rvt
filename = "C:\\git\\iScatRepoContainer\\test_data\\event2_MF_avF.tif"
for frame in apply_rvt(pims.open(filename), rvt_settings=RVTSettings()):
np.sum(frame.flat) RVT stands for Radial Variance Transform. The code works fine if sequencing the frames one by one, with or without |
Thanks. I have 2 more guesses:
|
One bonus guess: for i, features in enumerate(map_func(curried_locate, frames)):
image = frames[i]
if hasattr(image, 'frame_no') and image.frame_no is not None:
frame_no = image.frame_no Could there be a problem with using an index to access all the frames in your Tiff file? |
Just tried this first option within the loop of the snippet above; the attribute exists.
But this would defeat the purpose of using
I don't see why, just tried out and calling |
Just in case anyone comes across this thread in the future, I had this issue on macOS and running batch() with the processes=1 argument fixed the issue for me. |
Greetings,
I'm currently trying to use trackpy to localize some particles in a TIFF video recording. I'm using PIMS because I'm also applying a preprocessing function before calling the localization. Using
trackpy.locate
does no problem, but when I try to call it as a batch on the entire video I get the following stack trace:My multiframe TIFF is of size [4000, 200, 200]. Is there anything I can do to fix this?
Thanks.
The text was updated successfully, but these errors were encountered: