Skip to content

input_validator

input_validator

validate_inputs(json_str)

Validate and extract inputs from a JSON string.

Parameters:

Name Type Description Default
json_str str

The JSON string containing input parameters.

required
video_file_name str

The name of the video file.

required

Returns:

Name Type Description
tuple

A tuple containing the extracted inputs: - uuid (str): The UUID value from the JSON. - source_path (str): The path to the video file. - save_results (str): The method for saving results (e.g., 'video'). - record_videos (bool): Whether to record videos or not. - scan_duration (int): The duration of the scan. - motion_tracking (bool): Whether to enable motion tracking. - skin_segmentor (str): The skin segmentation method. - collect_truth_values (bool): Whether to collect truth values or not. - extreme_pixel_removal (bool): Whether to perform extreme pixel removal or not. - gamma_value (float): The gamma value.

Source code in redesign_pipeline/flask_utils/input_validator.py
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
def validate_inputs(json_str):
    """
    Validate and extract inputs from a JSON string.

    Args:
        json_str (str): The JSON string containing input parameters.
        video_file_name (str): The name of the video file.

    Returns:
        tuple: A tuple containing the extracted inputs:
            - uuid (str): The UUID value from the JSON.
            - source_path (str): The path to the video file.
            - save_results (str): The method for saving results (e.g., 'video').
            - record_videos (bool): Whether to record videos or not.
            - scan_duration (int): The duration of the scan.
            - motion_tracking (bool): Whether to enable motion tracking.
            - skin_segmentor (str): The skin segmentation method.
            - collect_truth_values (bool): Whether to collect truth values or not.
            - extreme_pixel_removal (bool): Whether to perform extreme pixel removal or not.
            - gamma_value (float): The gamma value.

    """

    json_str = json.loads(json_str)
    source_path = 'stream'
    save_results = 'stream'
    record_videos = False
    scan_duration = -1
    motion_tracking = json_str['motion_tracking']
    skin_segmentor = json_str['skin_segmentor']
    uuid = json_str['uuid']
    #TODO discuss this with umair
    collect_truth_values = False
    extreme_pixel_removal = json_str['extreme_pixel_removal']
    gamma_value =  json_str['gamma_value']
    return uuid, source_path, save_results, record_videos, scan_duration, motion_tracking, skin_segmentor, collect_truth_values, extreme_pixel_removal, gamma_value