|
Bsoft
1.9
Bernard's software package
|
Header file for mask operation tools. More...
#include "rwimg.h"Go to the source code of this file.
Functions | |
| int | img_plane_mask (Bimage *p, Vector3< float > origin, Vector3< float > normal, int operation) |
| Generates a mask on one side of a plane. More... | |
| int | img_rectangular_mask (Bimage *p, float length, float width, float rect_angle, int wrap, int operation) |
| Generates a mask along an axis within a 2D image. More... | |
| Bimage * | img_composite_mask (int nfiles, Bstring *file_list, int mask_type) |
| Generates a composite of multiple masks. More... | |
| int * | img_mask_interface_matrix (Bimage *pmask, int img_num, int *nmat) |
| Calculates the interfaces between regions. More... | |
| int | img_mask_region_interfaces (Bimage *pmask, int reg_num) |
| Reports the whole interface matrix or interfaces for one region only. More... | |
| int | img_mask_merge_delete (Bimage *pmask, int min_size, int min_if) |
| Calculates the interfaces between regions and deletes/merges small ones. More... | |
Header file for mask operation tools.
Definition in file img_mask.h.
Generates a composite of multiple masks.
| nfiles | number of files. |
| *file_list | list of file names. |
| mask_type | type of mask to generate (2/3). |
The composite mask can be either a multi-bit mask (mask_type = 2), or a multi-level mask (mask_type = 3).
Definition at line 156 of file img_mask.cpp.
| int* img_mask_interface_matrix | ( | Bimage * | pmask, |
| int | img_num, | ||
| int * | nmat | ||
| ) |
Calculates the interfaces between regions.
| *pmask | mask (must be int). |
| img_num | sub-image number. |
| *nmat | number of regions + 1 = size of matrix. |
The mask must be an integer image. An interface matrix is calculated to count the number of connected voxels between every pair of regions. Each value i in a row j gives the number of voxels of the region j that are adjacent to one or more voxels in region i. Row 0 and column 0 are excluded from the calculation.
Definition at line 248 of file img_mask.cpp.
| int img_mask_merge_delete | ( | Bimage * | pmask, |
| int | min_size, | ||
| int | min_if | ||
| ) |
Calculates the interfaces between regions and deletes/merges small ones.
| *pmask | mask. |
| min_size | minimum size to accept regions, small ones are deleted/merged. |
| min_if | minimum interface size to consider a small region connected. |
The mask is converted to an integer mask. An interface matrix is calculated to count the number of connected voxels between every pair of regions. Regions that are smaller than the minimum size are either deleted or merged with other regions. If the maximum interface size for a small region is less than the minimum specified, the region is deleted, otherwise, it is added to that neighboring region with which it shares the biggest interface.
Definition at line 370 of file img_mask.cpp.
| int img_mask_region_interfaces | ( | Bimage * | pmask, |
| int | reg_num | ||
| ) |
Reports the whole interface matrix or interfaces for one region only.
| *pmask | mask. |
| reg_num | region to report for (<0 whole interface matrix). |
The mask is converted to an integer mask. An interface matrix is calculated to count the number of connected voxels between every pair of regions.
Definition at line 318 of file img_mask.cpp.
Generates a mask on one side of a plane.
| *p | image. |
| origin | any point on plane. |
| normal | plane normal. |
| operation | 0=replace, 1=and, 2=or, 3=xor. |
The given image is used to generate a binary mask of the same size.
Definition at line 31 of file img_mask.cpp.
| int img_rectangular_mask | ( | Bimage * | p, |
| float | length, | ||
| float | width, | ||
| float | rect_angle, | ||
| int | wrap, | ||
| int | operation | ||
| ) |
Generates a mask along an axis within a 2D image.
| *p | image (converted to byte and modified). |
| length | length along axis (pixels). |
| width | width perpendicular to axis (pixels). |
| rect_angle | angle from x-axis (radians). |
| wrap | flag to wrap around boundaries. |
| operation | 0=replace, 1=and, 2=or, 3=xor. |
The input image is assumed to be a mask of 0's and 1's and is modified according to the operation requested (see img_mask_combine). Only an axis in the xy plane is used, generating a rectangular mask of given length and width around the axis, with its center at the origins given in the image structure.
Definition at line 90 of file img_mask.cpp.