Select Masks π₯π ₯π π ’(SelectMasks)
This node takes a tensor containing multiple masks as input and determines which masks to retain by parsing the index string provided by the user.
Select Masks
The Select Masks π₯π ₯π π ’ node receives a tensor containing multiple masks as input and determines which masks to retain by parsing a user-provided index string.
The Select Masks node is a tool used to filter specific masks from a set of MASK data based on specified index values. Its core function is to allow users to precisely select a portion of a mask sequence for subsequent independent processing or analysis.
Node Function
This node receives a tensor containing multiple masks as input and determines which masks to retain by parsing a user-provided index string. The index supports various flexible formats, such as a single number (e.g., "2"), a comma-separated list (e.g., "0,3,5"), or a range expression (e.g., "1:4"), making batch selection and slicing operations very convenient.
Node Parameter Description - Select Masks π₯π ₯π π ’
Connection Inputs (Inputs)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
mask | MASK | Yes | - | - | mask (input parameter): Input a tensor sequence containing multiple masks from which the node will filter. |
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
indexes | STRING | Yes | 0 | - | Comma-separated list or colon range format. |
err_if_missing | BOOLEAN | Yes | True | - | err_if_missing (input parameter): When set to True, the node will report an error if a specified index is out of the mask sequence range. |
err_if_empty | BOOLEAN | Yes | True | - | err_if_empty (input parameter): When set to True, the node will report an error if the filtered result based on the index is empty. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| MASK | MASK | MASK (output parameter): Outputs the filtered mask tensor based on the index. |
Usage Scenarios
This node is very useful in video processing workflows. For example, after loading a sequence containing multi-frame masks using the "VHS Batch Load Masks" node, you can use this node to extract only the masks of key frames (e.g., frames 0, 15, 30). These selected masks can then be fed into the "Apply Mask to Batch" node for special effects processing on specific video segments.
Notes
Please note that index values are zero-based. If a provided index exceeds the actual range of the input mask sequence, or if the filtered result is empty, the node's behavior will depend on the settings of the err_if_missing and err_if_empty parameters and may throw an error.
Select Masks π₯π ₯π π ’ Node Source Code Link
The Select Masks π₯π ₯π π ’ node is from the ComfyUI-VideoHelperSuite node package.
Comments
Sign in with GitHub to join the discussion.