visiannot.visiannot.ViSiAnnoTLongRecFromConfigGUI

Module defining ViSiAnnoTLongRecFromConfigGUI

Summary

Classes

visiannot.visiannot.ViSiAnnoTLongRecFromConfigGUI.ViSiAnnoTLongRecFromConfigGUI(…)

Subclass of ViSiAnnoT for managing a long recording with several files

API

Class ViSiAnnoTLongRecFromConfigGUI

class visiannot.visiannot.ViSiAnnoTLongRecFromConfigGUI.ViSiAnnoTLongRecFromConfigGUI(**kwargs)[source]

Bases: visiannot.visiannot.ViSiAnnoTLongRecFromConfigFile.ViSiAnnoTLongRecFromConfigFile

Subclass of ViSiAnnoT for managing a long recording with several files

First, it searches the list of paths to the video/signal files. If signals are not synchronized with videos, then it creates temporary files with info for synchronization. Each created file corresponds to one video file and contains the path to the signal file to use with the starting second.

Parameters
  • video_dict (dict) –

    video configuration, each item corresponds to one camera. Key is the camera ID (string). Value is a configuration list of length 5:

    • (str) Directory where to find the video files,

    • (str) Pattern to find video files (e.g. "*.mp4"),

    • (str) Delimiter to get beginning datetime in the video file name,

    • (int) Position of the beginning datetime in the video file name, according to the delimiter,

    • (str) Format of the beginning datetime in the video file name (either "posix" or a format compliant with datetime.strptime()).

  • signal_dict (dict) –

    signal configuration, each item corresponds to one signal widget. Key is the widget ID (Y axis label, string). Value is a nested list of signal configurations. Each element of the nested list corresponds to one signal plot and is a configuration list of 8 elements:

    • (str) Directory where to find the signal files, see positional argument signal_dict of ViSiAnnoT constructor for detail about data storing format,

    • (str) Key to access the data (in case of .mat or .h5 file),

    • (int or float or str) Signal frequency, set it to 0 if signal non regularly sampled, set it to -1 if same frequency as ViSiAnnoT.fps, it may be a string with the path to the frequency attribute in a .h5 file,

    • (str) Pattern to find signal files,

    • (str) Delimiter to get beginning datetime in the signal file name,

    • (int) Position of the beginning datetime in the signal file name, according to the delimiter,

    • (str) Format of the beginning datetime in the signal file name (either "posix" or a format compliant with datetime.strptime()),

    • (dict) Plot style, see https://pyqtgraph.readthedocs.io/en/latest/graphicsItems/plotdataitem.html for details, set it to None for default.

    Here is an example:

    {
    "sig_1": [
        [
            "path/to/folder1", "", 50, "*_motion.txt", '_', 1,
            "%Y-%m-%dT%H-%M-%S", None
        ]
    ],
    "sig_2": [
        [
            "path/to/folder2", "ecg", 0, "*_physio.h5", '_', 0,
            "posix", {'pen': {'color': 'm', 'width': 1}
        ],
        [
            "path/to/folder2", "resp", -1, "*_physio.h5", '_', 0,
            "posix",None
        ]
    ]
    }
    

    In case of audio signal to plot, the configuration list is slightly different. The second element (key to access data) is a string to specify which channel to plot. It must contain "left" or "right", whatever the letter capitalization is. Otherwise, by default the left channel is plotted. Moreover, the frequency is directly retrieved from the wav file, so the third element of the configuration list (signal frequency) is ignored.

    Here is an example for audio:

    {
    "Audio L": [[
        "path/to/folder", "Left channel", 0, "*_audio.wav", '_',
        1, "%Y-%m-%dT%H-%M-%S", None
    ]],
    "Audio R": [[
        "path/to/folder", "Right channel", 0, "*_audio.wav", '_',
        1, "%Y-%m-%dT%H-%M-%S", None]]
    }
    

  • interval_dict (dict) –

    interval configuration. Each item corresponds to a signal widget on which to plot intervals. The key must be the same as in signal_dict. Value is a nested list of interval configurations. Each element of the nested list corresponds to a type of interval to be plotted in the same signal widget and is a configuration list of 8 elements:

    • (str) Directory where to find interval files, see positional argument interval_dict of ViSiAnnoT constructor for detail about data storing format,

    • (str) Key to access the data (in case of .mat or .h5 file),

    • (int) Signal frequency, set it to -1 if same frequency as ViSiAnnoT.fps, it may be a string with the path to the frequency attribute in a .h5 file,

    • (str) Pattern to find interval files,

    • (str) Delimiter to get beginning datetime in the interval file name,

    • (int) Position of the beginning datetime in the interval file name, according to the delimiter,

    • (str) Format of the beginning datetime in the interval file name (either "posix" or a format compliant with datetime.strptime()),

    • (tuple or list) Plot color (RGBA).

  • flag_synchro (bool) – specify if video and signal are synchronized, in case there is no video and several signals that are not synchronized with each other, then flag_synchro can be set to False and the synchronization reference is the first signal

  • layout_mode (int) –

    layout mode of the window for positioning the widgets, one of the following:

    • 1 (focus on video, works better with a big screen),

    • 2 (focus on signal, suitable for a laptop screen),

    • 3 (compact display with some features disabled),

    • 4 (even more compact display, image extraction tool is disabled).

  • poswid_dict (dict) –

    custom position of the widgets in the window, default {} to use the positions defined by the layout mode (see input layout_mode). Value is a tuple of length 2 (row, col) or 4 (row, col, rowspan, colspan). Key identifies the widget:

    • "logo"

    • "select_trunc"

    • "select_manual"

    • "select_from_cursor"

    • "annot_event"

    • "annot_image"

    • "visi"

    • "zoomin"

    • "zoomout"

    • "previous"

    • "next"

    • "rec_choice"

    • "progress"

  • kwargs – keyword arguments of ViSiAnnoT constructor