neurotorchmz.utils.signal_detection#
Module to detect signals in an ImageObject
Classes
Abstract base class for a detection algorithm for signals. |
|
|
A SignalObject holds a) references to the detected signal peaks of an ImageObject (for example stimulation) b) provides a signal used for determing those peaks and c) provides a sliced image including only / no peak frames. |
- class neurotorchmz.utils.signal_detection.ISignalDetectionAlgorithm#
Bases:
objectAbstract base class for a detection algorithm for signals. Must only implement a get_signal method
- get_signal(imgObj: ImageObject) ndarray | None#
This method should return an 1D array (t,) interpretated as signal of the image
- class neurotorchmz.utils.signal_detection.SigDetect_DiffMax#
Bases:
ISignalDetectionAlgorithm- get_signal(imgObj: ImageObject) ndarray | None#
This method should return an 1D array (t,) interpretated as signal of the image
- class neurotorchmz.utils.signal_detection.SigDetect_DiffStd#
Bases:
ISignalDetectionAlgorithm- get_signal(imgObj: ImageObject) ndarray | None#
This method should return an 1D array (t,) interpretated as signal of the image
- class neurotorchmz.utils.signal_detection.SignalObject(imgObj: ImageObject)#
Bases:
objectA SignalObject holds a) references to the detected signal peaks of an ImageObject (for example stimulation) b) provides a signal used for determing those peaks and c) provides a sliced image including only / no peak frames. It is bound to an ImageObject and calculates its values lazy. The ImageObject is reponsible to call clear() when the underlying images (e.g. through a convolution of loading a new image) have changed.
- Variables:
peakWidth_L (int) – When providing the sliced image without the signal peaks, n frames to the left are also excluded
peakWidth_R (int) – When providing the sliced image without the signal peaks, n frames to the right are also excluded
- ALGORITHM: ISignalDetectionAlgorithm = <neurotorchmz.utils.signal_detection.ISignalDetectionAlgorithm object>#
- PEAK_WIDTH_LEFT: int = 1#
- PEAK_WIDTH_RIGHT: int = 6#
- clear()#
Calling clear() will forget the current signal and found peaks. Should be called, when the underlying images of the ImageObject change
- clear_peaks()#
Clears the peaks and the cached sliced images.
- export_img_only_signal(path: Path) None#
Export the current img
- export_img_without_signal(path: Path) None#
Export the current img
- get_view(img_type: Literal['img', 'img_diff'], slice_type: Literal['only_signal', 'without_signal'], mode: ImageView) AxisImage#
Internal function to get a view for every combination of img/img_diff and with or without signal frames
- property img_diff_props_only_signal: ImageProperties#
- property img_diff_props_without_signal: ImageProperties#
- property img_props_only_signal: ImageProperties#
- property img_props_without_signal: ImageProperties#
- classmethod load_settings() None#
- property peaks: list[int] | None#
Returns the peaks given the current signal and prominence as sorted interger list (ascending). The peaks are calculated on first call
- property prominence_factor: float#
The prominence factor is used to find peaks in the signal, as scipy.signal.find_peaks with prominence = factor*(max(signal)-min(signal)) is used
- classmethod set_settings(peak_width_left: int | None = None, peak_width_right: int | None = None) None#
- property signal: ndarray | None#
Returns the signal from the image by calculating it using SignalObject.ALGORITHM on the first call