#!D:\IDE\Anaconda3\envs\Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
@FileName   : FocusingConfigModel.py
@Account    : Administrator
@Time       : 2025/8/29 17:10
@Author     : xsh
@Description: 
"""
from PyQt5 import Qt
from datetime import datetime, date
import copy
from AppCore.AppDBModels.CoreModel import (CoreModel, DBManager, dbController)
from sqlalchemy.orm import declarative_base, mapper, sessionmaker, Session
from sqlalchemy.orm import (declarative_base, Mapped, mapped_column, relationship, mapper, sessionmaker)
from sqlalchemy import Table, Engine, create_engine, Column, ForeignKey, and_, or_, insert, delete, update, select, func, ColumnElement,distinct
from sqlalchemy.types import (Text, VARCHAR, REAL, Float, Integer, String, SmallInteger, DateTime, Date, ARRAY,Boolean, JSON)
from sqlalchemy.orm.decl_api import DeclarativeBase, MetaData
from AppUtils.utils import *
from AppCore.Levels import *


class FocusingConfigModel(CoreModel):
    __tablename__ = 't_FocusingConfigModel'
    ID                              : Mapped[int    ] = mapped_column(primary_key=True                                  , nullable=False, doc='数据序号　　　　', comment='数据序号　　　　')
    Level                           : Mapped[int    ] = mapped_column(default=ObjectiveLevel.Objective1                 , nullable=True , doc='物镜类型　　　　', comment='物镜类型　　　　')
    FocusingLevel                   : Mapped[int    ] = mapped_column(default=ScanStatusLevel.Low_First_Focus_Status    , nullable=True , doc='定焦类型　　　　', comment='定焦类型　　　　')
    MinCellCount                    : Mapped[int    ] = mapped_column(default=50                                        , nullable=True , doc='最小细胞数量　　', comment='最小细胞数量　　')
    CellThreshold                   : Mapped[int    ] = mapped_column(default=110                                       , nullable=True , doc='定焦阈值　　　　', comment='定焦阈值　　　　')
    FocusingThreshold               : Mapped[int    ] = mapped_column(default=160                                       , nullable=True , doc='定焦评分阈值　　', comment='定焦评分阈值　　')
    FocusingColorThreshold          : Mapped[int    ] = mapped_column(default=220                                       , nullable=True , doc='定焦评分阈值　　', comment='定焦评分阈值　　')
    FocusingFinishCount             : Mapped[int    ] = mapped_column(default=4                                         , nullable=True , doc='结束定焦条件　　', comment='结束定焦条件　　')
    MaxImageCount                   : Mapped[int    ] = mapped_column(default=2                                         , nullable=True , doc='定焦图片数量　　', comment='定焦图片数量　　')
    FocusingRange                   : Mapped[float  ] = mapped_column(default=200000.0                                  , nullable=True , doc='定焦距离　　　　', comment='定焦距离　　　　')
    FocusingSpeed                   : Mapped[float  ] = mapped_column(default=6000.0                                    , nullable=True , doc='定焦速度　　　　', comment='定焦速度　　　　')
    FocusingRetryCount              : Mapped[int    ] = mapped_column(default=5                                         , nullable=True , doc='定焦重试次数　　', comment='定焦重试次数　　')
    MinContourArea                  : Mapped[int    ] = mapped_column(default=50                                        , nullable=True , doc='最小细胞面积　　', comment='最小细胞面积　　')
    MinStripCount                   : Mapped[int    ] = mapped_column(default=5                                         , nullable=True , doc='最小条带数量　　', comment='最小条带数量　　')
    MaxStripCount                   : Mapped[int    ] = mapped_column(default=30                                        , nullable=True , doc='最大条带数量　　', comment='最大条带数量　　')
    FocusingOffset                  : Mapped[int    ] = mapped_column(default=0                                         , nullable=True , doc='定焦徧移步长　　', comment='定焦徧移步长　　')
    def __init__(self, **args):
        super(FocusingConfigModel, self).__init__()
        self.initialize()
        self.initParameter(**args)

    def initValue(self):
        super(FocusingConfigModel, self).initValue()
        self.ID                     = 1                                            #
        self.Level                  = ObjectiveLevel.Objective1                    #
        self.FocusingLevel          = ScanStatusLevel.Low_First_Focus_Status       #
        self.MinCellCount           = 50                                           #
        self.CellThreshold          = 110                                          #
        self.FocusingThreshold      = 160                                          #
        self.FocusingFinishCount    = 4                                            #
        self.MaxImageCount          = 2                                            #
        self.FocusingRange          = 200000.0                                     #
        self.FocusingSpeed          = 6000.0                                       #
        self.FocusingRetryCount     = 3                                            #
        self.FocusingOffset         = 0                                            #
        self.MaxStripCount          = 50                                           #
        self.MinContourArea          = 3                                            #
        self.FocusingColorThreshold = 200                                          #

    @classmethod
    def FocusingConfig(cls, level: int, FocusingStatus: int):
        item: cls = cls.get(cls.Level== level, cls.FocusingLevel == FocusingStatus)
        if item is None:
            item = cls.instance(Level = level      , FocusingConfigModel=FocusingStatus    )
        return item


    @classmethod
    def FocusingRangeAndSpeed(cls, level: int, FocusingStatus: int) -> (int, int):
        item: cls = cls.FocusingConfig(level, FocusingStatus)
        return item.FocusingRange, item.FocusingSpeed

    @classmethod
    def FocusingParameter(cls, level: int, FocusingStatus: int) -> (int, int, int, int, int):
        item: cls = cls.FocusingConfig(level, FocusingStatus)
        return item.MinCellCount       ,item.CellThreshold      ,item.FocusingThreshold  ,item.FocusingFinishCount,item.MaxImageCount

    @classmethod
    def initModels(cls) -> list:
        items: list[cls] = [
            cls.instance(ID=1  , Level = ObjectiveLevel.Objective1      , FocusingLevel=ScanStatusLevel.Low_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 200000 ,FocusingSpeed        = 6000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=2  , Level = ObjectiveLevel.Objective1      , FocusingLevel=ScanStatusLevel.Low_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 100000 ,FocusingSpeed        = 3000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=3  , Level = ObjectiveLevel.Objective1      , FocusingLevel=ScanStatusLevel.Low_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  50000 ,FocusingSpeed        =  500.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=4  , Level = ObjectiveLevel.Objective1      , FocusingLevel=ScanStatusLevel.Low_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  10000 ,FocusingSpeed        =  100.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=5  , Level = ObjectiveLevel.Objective10     , FocusingLevel=ScanStatusLevel.Low_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 200000 ,FocusingSpeed        = 6000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=6  , Level = ObjectiveLevel.Objective10     , FocusingLevel=ScanStatusLevel.Low_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 100000 ,FocusingSpeed        = 3000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=7  , Level = ObjectiveLevel.Objective10     , FocusingLevel=ScanStatusLevel.Low_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  50000 ,FocusingSpeed        =  500.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=8  , Level = ObjectiveLevel.Objective10     , FocusingLevel=ScanStatusLevel.Low_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  10000 ,FocusingSpeed        =  100.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=9  , Level = ObjectiveLevel.Objective20     , FocusingLevel=ScanStatusLevel.Low_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 200000 ,FocusingSpeed        = 6000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=10 , Level = ObjectiveLevel.Objective20     , FocusingLevel=ScanStatusLevel.Low_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 100000 ,FocusingSpeed        = 3000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=11 , Level = ObjectiveLevel.Objective20     , FocusingLevel=ScanStatusLevel.Low_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  50000 ,FocusingSpeed        =  500.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=12 , Level = ObjectiveLevel.Objective20     , FocusingLevel=ScanStatusLevel.Low_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  10000 ,FocusingSpeed        =  100.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=13 , Level = ObjectiveLevel.Objective40     , FocusingLevel=ScanStatusLevel.Hig_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   5000 ,FocusingSpeed        =  200.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=14 , Level = ObjectiveLevel.Objective40     , FocusingLevel=ScanStatusLevel.Hig_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   500  ,FocusingSpeed        =   20.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=15 , Level = ObjectiveLevel.Objective40     , FocusingLevel=ScanStatusLevel.Hig_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   200  ,FocusingSpeed        =   10.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=16 , Level = ObjectiveLevel.Objective40     , FocusingLevel=ScanStatusLevel.Hig_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   100  ,FocusingSpeed        =    5.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=17 , Level = ObjectiveLevel.Objective63     , FocusingLevel=ScanStatusLevel.Hig_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   5000 ,FocusingSpeed        =  200.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=18 , Level = ObjectiveLevel.Objective63     , FocusingLevel=ScanStatusLevel.Hig_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   500  ,FocusingSpeed        =   20.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=19 , Level = ObjectiveLevel.Objective63     , FocusingLevel=ScanStatusLevel.Hig_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   200  ,FocusingSpeed        =   10.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=20 , Level = ObjectiveLevel.Objective63     , FocusingLevel=ScanStatusLevel.Hig_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   100  ,FocusingSpeed        =    5.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=21 , Level = ObjectiveLevel.Objective100    , FocusingLevel=ScanStatusLevel.Hig_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   5000 ,FocusingSpeed        =  200.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=22 , Level = ObjectiveLevel.Objective100    , FocusingLevel=ScanStatusLevel.Hig_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   500  ,FocusingSpeed        =   20.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=23 , Level = ObjectiveLevel.Objective100    , FocusingLevel=ScanStatusLevel.Hig_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   200  ,FocusingSpeed        =   10.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=24 , Level = ObjectiveLevel.Objective100    , FocusingLevel=ScanStatusLevel.Hig_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =   100  ,FocusingSpeed        =    5.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=25 , Level = ObjectiveLevel.ObjectiveNone   , FocusingLevel=ScanStatusLevel.Low_First_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 200000 ,FocusingSpeed        = 6000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=26 , Level = ObjectiveLevel.ObjectiveNone   , FocusingLevel=ScanStatusLevel.Low_Second_Focus_Status   ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        = 100000 ,FocusingSpeed        = 3000.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=27 , Level = ObjectiveLevel.ObjectiveNone   , FocusingLevel=ScanStatusLevel.Low_Three_Focus_Status    ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  50000 ,FocusingSpeed        =  500.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
            cls.instance(ID=28 , Level = ObjectiveLevel.ObjectiveNone   , FocusingLevel=ScanStatusLevel.Low_Four_Focus_Status     ,MinCellCount         = 50     ,CellThreshold        = 110    ,FocusingThreshold    = 160    ,FocusingColorThreshold = 200, FocusingFinishCount  = 10      ,MaxImageCount        = 150      ,FocusingRange        =  10000 ,FocusingSpeed        =  100.0 ,FocusingRetryCount   = 3      , MinStripCount = 5, MaxStripCount = 50, MinContourArea=50, FocusingOffset = 0) ,
        ]
        return items

    @classmethod
    def getFocusingConfig(cls, level: int, focusing_level: int) -> (int, int, int, int, int, int):
        item: cls = cls.get(cls.Level == level, cls.FocusingLevel == focusing_level)
        if item is None:
            item = cls.get(cls.Level == ObjectiveLevel.ObjectiveNone, cls.FocusingLevel == ScanStatusLevel.Low_First_Focus_Status)
        return item.CellThreshold       ,item.MinCellCount        ,item.FocusingThreshold   ,item.FocusingColorThreshold   ,item.FocusingFinishCount ,item.MaxImageCount, item.MinContourArea

    @classmethod
    def getMinContourArea(cls, level: int, focusing_level: int) -> int:
        item: cls = cls.get(cls.Level == level, cls.FocusingLevel == focusing_level)
        if item is None:
            item = cls.get(cls.Level == ObjectiveLevel.ObjectiveNone, cls.FocusingLevel == ScanStatusLevel.Low_First_Focus_Status)
        return item.MinContourArea

    @classmethod
    def getFocusingRange(cls, level: int, focusing_level: int) -> (int, int, int):
        item: cls = cls.get(cls.Level == level, cls.FocusingLevel == focusing_level)
        if item is None:
            item = cls.get(cls.Level == ObjectiveLevel.ObjectiveNone,
                           cls.FocusingLevel == ScanStatusLevel.Low_First_Focus_Status)
        return item.FocusingRange, item.FocusingSpeed, item.FocusingRetryCount

    @classmethod
    def RetryCount(cls, level: int, focusing_level: int) -> (int, int, int):
        item: cls = cls.get(cls.Level == level, cls.FocusingLevel == focusing_level)
        if item is None:
            item = cls.get(cls.Level == ObjectiveLevel.ObjectiveNone, cls.FocusingLevel == ScanStatusLevel.Low_First_Focus_Status)
        return item.FocusingRetryCount

    @classmethod
    def getConfig(cls, level: int, focusing_level: int):
        item: cls = cls.get(cls.Level == level, cls.FocusingLevel == focusing_level)
        if item is None:
            item = cls.get(cls.Level == ObjectiveLevel.ObjectiveNone,
                           cls.FocusingLevel == ScanStatusLevel.Low_First_Focus_Status)
        return item

    __field__ = (
        'ID'                  ,
        'Level'               ,
        'FocusingLevel'       ,
        'MinCellCount'        ,
        'CellThreshold'       ,
        'FocusingThreshold'   ,
        'FocusingFinishCount' ,
        'MaxImageCount'       ,
        'FocusingRange'       ,
        'FocusingSpeed'       ,
        'FocusingRetryCount'  ,
        'MinStripCount'       ,
        'MinContourArea'      ,
        'MaxStripCount'       ,
        'FocusingOffset'      ,
    )
    __types__ = (
        int     ,
        int     ,
        int     ,
        int     ,
        int     ,
        int     ,
        int     ,
        int     ,
        float   ,
        float   ,
        int     ,
        int     ,
        int     ,
        int     ,
        int     ,
    )

    @property
    def has_ID                  (self) -> bool:
        return hasattr(self, 'ID'                    ) and isinstance(self.ID                 , int)

    @property
    def has_Level               (self) -> bool:
        return hasattr(self, 'Level'                 ) and isinstance(self.Level              , int)

    @property
    def has_FocusingLevel       (self) -> bool:
        return hasattr(self, 'FocusingLevel'         ) and isinstance(self.FocusingLevel      , int)

    @property
    def has_MinCellCount        (self) -> bool:
        return hasattr(self, 'MinCellCount'          ) and isinstance(self.MinCellCount       , int)

    @property
    def has_CellThreshold       (self) -> bool:
        return hasattr(self, 'CellThreshold'         ) and isinstance(self.CellThreshold      , int)

    @property
    def has_FocusingThreshold   (self) -> bool:
        return hasattr(self, 'FocusingThreshold'     ) and isinstance(self.FocusingThreshold  , int)

    @property
    def has_FocusingFinishCount (self) -> bool:
        return hasattr(self, 'FocusingFinishCount'   ) and isinstance(self.FocusingFinishCount, int)

    @property
    def has_MaxImageCount       (self) -> bool:
        return hasattr(self, 'MaxImageCount'         ) and isinstance(self.MaxImageCount      , int)

    @property
    def has_FocusingRange       (self) -> bool:
        return hasattr(self, 'FocusingRange'         ) and isinstance(self.FocusingRange      , int)

    @property
    def has_FocusingSpeed       (self) -> bool:
        return hasattr(self, 'FocusingSpeed'         ) and isinstance(self.FocusingSpeed      , int)

    @property
    def has_FocusingRetryCount  (self) -> bool:
        return hasattr(self, 'FocusingRetryCount'    ) and isinstance(self.FocusingRetryCount , int)

    @property
    def hasID                              (self) -> bool:
        return hasattr(self, 'ID'                  ) and isinstance(self.ID                              , int)

    @property
    def hasLevel                           (self) -> bool:
        return hasattr(self, 'Level'               ) and isinstance(self.Level                           , int)

    @property
    def hasFocusingLevel                   (self) -> bool:
        return hasattr(self, 'FocusingLevel'       ) and isinstance(self.FocusingLevel                   , int)

    @property
    def hasMinCellCount                    (self) -> bool:
        return hasattr(self, 'MinCellCount'        ) and isinstance(self.MinCellCount                    , int)

    @property
    def hasCellThreshold                   (self) -> bool:
        return hasattr(self, 'CellThreshold'       ) and isinstance(self.CellThreshold                   , int)

    @property
    def hasFocusingThreshold               (self) -> bool:
        return hasattr(self, 'FocusingThreshold'   ) and isinstance(self.FocusingThreshold               , int)

    @property
    def hasFocusingFinishCount             (self) -> bool:
        return hasattr(self, 'FocusingFinishCount' ) and isinstance(self.FocusingFinishCount             , int)

    @property
    def hasMaxImageCount                   (self) -> bool:
        return hasattr(self, 'MaxImageCount'       ) and isinstance(self.MaxImageCount                   , int)

    @property
    def hasFocusingRange                   (self) -> bool:
        return hasattr(self, 'FocusingRange'       ) and isinstance(self.FocusingRange                   , int)

    @property
    def hasFocusingSpeed                   (self) -> bool:
        return hasattr(self, 'FocusingSpeed'       ) and isinstance(self.FocusingSpeed                   , int)

    @property
    def hasFocusingRetryCount              (self) -> bool:
        return hasattr(self, 'FocusingRetryCount'  ) and isinstance(self.FocusingRetryCount              , int)

    @property
    def hasMinStripCount                   (self) -> bool:
        return hasattr(self, 'MinStripCount'       ) and isinstance(self.MinStripCount                   , int)

    @property
    def hasMinContourArea                  (self) -> bool:
        return hasattr(self, 'MinContourArea'      ) and isinstance(self.MinContourArea                  , int)

    @property
    def hasMaxStripCount                   (self) -> bool:
        return hasattr(self, 'MaxStripCount'       ) and isinstance(self.MaxStripCount                   , int)

    @property
    def hasFocusingOffset                  (self) -> bool:
        return hasattr(self, 'FocusingOffset'      ) and isinstance(self.FocusingOffset                  , int)
