Project

General

Profile

Feature #944 » ConfigReader.py

Xinai ZHANG , 01/18/2024 01:22 PM

 
1
#!/usr/bin/env python3
2
#-*- coding: utf-8 -*-
3

    
4
import configparser
5

    
6
##
7
# @brief Responsible for reading and parsing configuration data.
8
#
9
# This class uses the configparser library to read configuration data from a file.
10
##
11
class ConfigReader:
12

    
13
    ##
14
    # @brief Initializes the ConfigReader object with a configuration file path.
15
    #
16
    # @param config_path str: The file path of the configuration file.
17
    ##
18
    def __init__(self, config_path):
19
        self.config_parser = configparser.ConfigParser()
20
        self.config_parser.read(config_path)
21

    
22
    ##
23
    # @brief Retrieves the name of the image from the configuration.
24
    #
25
    # @return str: The name of the image.
26
    ##
27
    def getImageName(self):
28
        return str(self.config_parser['DEFAULT']['image_name'])
29

    
30
    ##
31
    # @brief Retrieves the width of the projected image from the configuration.
32
    #
33
    # @return int: The width of the projected image.
34
    ##
35
    def getProjectedImageWidth(self):
36
        return int(self.config_parser['DEFAULT']['projected_image_width'])
37

    
38
    ##
39
    # @brief Retrieves the overlap width of the projected image from the configuration.
40
    #
41
    # @return int: The overlap width of the projected image.
42
    ##
43
    def getProjectedOverlapWidth(self):
44
        pass
45

    
46
    # [Other methods with similar Doxygen comments]
(3-3/3)