itk_option

itk_option add optName ? optName optName ...? Adds one or more options to the composite option list for a mega-widget. Here, optName can have one of the following forms:
component. option
Accesses an option belonging to a component with the symbolic name component. The option name is specified without a leading " -" sign.
className:: option
Accesses an option defined by the " itk_option define" command in class className. The option name is specified without a leading " -" sign.

Options are normally integrated into the composite option list when a component widget is first created. This method can be used to add options at a later time. For example, the Widget and Toplevel base classes keep only the bare minimum options for their "hull" component: -background and -cursor. A derived class can override this decision, and add options that control the border of the "hull" component as well:

itcl::class MyWidget {
    inherit Widget

    constructor {args} {
        itk_option add hull.borderwidth hull.relief

        itk_component add label {
            label $itk_interior.l1 -text "Hello World!"
        }
        pack $itk_component(label)

        eval itk_initialize $args
    }
}
itk_option define switchName resourceName resourceClass init ? config?
This command is used at the level of the class definition to define a synthetic mega-widget option. Within the configure and cget methods, this option is referenced by switchName, which must start with a " -" sign. It can also be modified by setting values for resourceName and resourceClass in the X11 resource database. The init value string is used as a last resort to initialize the option if no other value can be used from an existing option, or queried from the X11 resource database. If any config code is specified, it is executed whenever the option is modified via the configure method. The config code can also be specified outside of the class definition via the configbody command.
In the following example, a synthetic "-background" option is added to the class, so that whenever the background changes, the new value is reported to standard output. Note that this synthetic option is integrated with the rest of the "-background" options that have been kept from component widgets:
itcl::class MyWidget {
    inherit Widget
    constructor {args} {
        itk_component add label {
            label $itk_interior.l1 -text "Hello World!"
        }
        pack $itk_component(label)

        eval itk_initialize $args
    }
    itk_option define -background background Background #d9d9d9 {
        puts "new background: $itk_option(-background)"
    }
}
itk_option remove optName ? optName optName ...?
Removes one or more options from the composite option list for a mega-widget. Here, optName can have one of the forms described above for the " itk_option add" command.
Options are normally integrated into the composite option list when a component widget is first created. This method can be used to remove options at a later time. For example, a derived class can override an option defined in a base class by removing and redefining the option:
itcl::class Base {
    inherit itk::Widget
    constructor {args} {
        eval itk_initialize $args
    }

    itk_option define -foo foo Foo "" {
        puts "Base: $itk_option(-foo)"
    }
}

itcl::class Derived {
    inherit Base

    constructor {args} {
        itk_option remove Base::foo
        eval itk_initialize $args
    }
    itk_option define -foo foo Foo "" {
        puts "Derived: $itk_option(-foo)"
    }
}
Without the " itk_option remove" command, the code fragments for both of the "-foo" options would be executed each time the composite "-foo" option is configured. In the example above, the Base::foo option is suppressed in all Derived class widgets, so only the Derived::foo option remains.

转载于:https://www.cnblogs.com/greencolor/archive/2011/06/13/2080098.html

2025-06-04 16:58:12,168 - Grad-CAM-Mask - INFO - 🚀 开始Grad-CAM处理流程... 2025-06-04 16:58:12,169 - Grad-CAM-Mask - INFO - ⚡ 使用设备: cuda 2025-06-04 16:58:12,323 - Grad-CAM-Mask - INFO - 🎯 正在初始化模型... 2025-06-04 16:58:13,837 - Grad-CAM-Mask - INFO - ⚙️ 正在加载模型权重... C:\Users\53145\AppData\Local\Temp\ipykernel_8884\1629840245.py:208: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. state_dict = torch.load(weights_path, map_location=device) 2025-06-04 16:58:14,519 - Grad-CAM-Mask - INFO - 💾 从 D:/monaisj/3/50_0.7941_0.7.pth加载权重 2025-06-04 16:58:14,545 - Grad-CAM-Mask - INFO - ✅ 权重加载成功 2025-06-04 16:58:14,550 - Grad-CAM-Mask - INFO - 📊 加载了 324/324参数 2025-06-04 16:58:14,552 - Grad-CAM-Mask - INFO - 🖼️ 正在预处理图像数据... 2025-06-04 16:58:14,554 - Grad-CAM-Mask - ERROR - ❌ 预处理失败: required package `itk` is not installed or the version doesn't match requirement. 2025-06-04 16:58:14,554 - Grad-CAM-Mask - ERROR - ❌ 处理失败 什么处理失败?为什么失败?
06-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值