Shortest Path Finder¶
-
class
particle_tracker_one_d.ShortestPathFinder(frames, time, automatic_update=True)[source]¶ Class for finding shortest path between points in a set of frames.
Parameters: - frames: np.array
The frames in which trajectories are to be found. The shape of the np.array should be (nFrames,xPixels). The intensity of the frames should be normalised according to \(I_n = (I-I_{min})/(I_{max}-I_{min})\), where \(I\) is the intensity of the frames, \(I_{min}\), \(I_{max}\) are the global intensity minima and maxima of the frames.
- time: np.array
The corresponding time of each frame.
- automatic_update: bool
Choose if the class should update itself when changing properties.
Attributes: framesnp.array:
- time
boxcar_widthint:
integration_radius_of_intensity_peaksint:
particle_detection_thresholdfloat:
particle_positionsnp.array:
- static_points
start_pointtuple:
end_pointtuple:
Methods
change_cost_coefficients([a, b, c])Change the coefficients of the cost function \(c(p_1,p_2) = a\cdot (x_{p_1} - x_{p_2})^2 + b \cdot (m_0(p_1)-m_0(p_2))^2 + b \cdot (m_2(p_1)-m_2(p_2))^2)\) plot_all_frames([ax])ax: matplotlib axes instance plot_moments([ax])ax: matplotlib axes instance -
boxcar_width¶ - int:
- Number of values used in the boxcar averaging of the frames.
-
change_cost_coefficients(a=1, b=1, c=1)[source]¶ Change the coefficients of the cost function \(c(p_1,p_2) = a\cdot (x_{p_1} - x_{p_2})^2 + b \cdot (m_0(p_1)-m_0(p_2))^2 + b \cdot (m_2(p_1)-m_2(p_2))^2)\)
a: float
b: float
c: float
-
end_point¶ - tuple:
- (frame_index, position_index), The end point of the path you want to find.
-
frames¶ - np.array:
- The frames which the particle tracker tries to find trajectories in. If the property boxcar_width!=0 it will return the smoothed frames.
-
integration_radius_of_intensity_peaks¶ - int:
- Number of pixels used when integrating the intensity peaks. No particles closer than twice this value will be found. If two peaks are found within twice this value, the one with highest intensity moment will be kept.
-
particle_detection_threshold¶ - float:
- Defines the threshold value for finding intensity peaks. Local maximas below this threshold will not be considered as particles.
-
particle_positions¶ - np.array:
- Numpy array with all particle positions on the form np.array((nParticles,), dtype=[(‘frame_index’, np.int16), (‘time’, np.float32),(‘integer_position’, np.int16), (‘refined_position’, np.float32)])
-
plot_all_frames(ax=None, **kwargs)[source]¶ - ax: matplotlib axes instance
- The axes which you want the frames to plotted on. If none is provided a new instance will be created.
- **kwargs:
- Plot settings, any settings which can be used in matplotlib.pyplot.imshow method.
Returns: - matplotlib axes instance
Returns the axes input argument or creates and returns a new instance of an matplotlib axes object.
-
plot_moments(ax=None, **kwargs)[source]¶ - ax: matplotlib axes instance
- The axes which you want the frames to plotted on. If none is provided a new instance will be created.
- **kwargs:
- Plot settings, any settings which can be used in matplotlib.pyplot.scatter method.
Returns: - matplotlib axes instance
Returns the axes input argument or creates and returns a new instance of an matplotlib axes object.
-
shortest_path¶ - dict:
- The shortest path between the start and end point, defined by the cost function. Cost, length and association matrix.
-
start_point¶ - tuple:
- (frame_index, position_index), The start point of the path you want to find.
-
trajectory¶ - trajectory:
- The shortest path between the start and end point represented as a trajectory.