Bsoft 2.1.4
Bernard's software package
model_mask.h File Reference

Functions to generate masks from models. More...

#include "rwimg.h"
#include "rwmodel.h"

Functions

Bimagemodel_create_mask (Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, double edge)
 Calculates a mask of the components and links of a model structure. More...
 
Bimagemodel_create_hull_mask (Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, int curv_flag, int fast)
 Calculates a mask based on the periphery of a model structure. More...
 
Bimagemodel_create_shell_mask (Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam, double shell_width, int curv_flag, int fast)
 Calculates a shell mask covering a model structure. More...
 
Bimagemodel_create_level_mask (Bmodel *model, Vector3< long > size, Vector3< double > origin, Vector3< double > sam)
 Calculates a mask with one level per model. More...
 
Bimageimg_extract_segments_using_model (Bimage *p, Bmodel *model, int multi_level)
 Extracts segmentss from a multi-level mask around points defined by a model.
More...
 
int img_add_model_to_mask (Bimage *p, Bmodel *model)
 Adds to the mask the component locations.
More...
 
Bmodelmodel_from_multilevel_mask (Bimage *p)
 Generates components at the center of mass of each mask level. More...
 
Bimagemodel_create_projected_mask (Bmodel *model, Vector3< long > size, Vector3< double > ori, Vector3< double > sam, double dang, Bsymmetry &sym)
 Calculates a set of 2D masks for the projections of a model structure. More...
 

Detailed Description

Functions to generate masks from models.

Author
Bernard Heymann
Date
Created: 20010828
Modified: 20200329

Function Documentation

◆ img_add_model_to_mask()

int img_add_model_to_mask ( Bimage p,
Bmodel model 
)

Adds to the mask the component locations.

Parameters
*pmask.
*modelmodel.
Returns
int 0, <0 on error.
At each component location, the voxel is added to the mask.

◆ img_extract_segments_using_model()

Bimage * img_extract_segments_using_model ( Bimage p,
Bmodel model,
int  multi_level 
)

Extracts segmentss from a multi-level mask around points defined by a model.

Parameters
*pmulti-level mask.
*modelmodel marking regions in mask.
multi_levelflag to retain multiple levels.
Returns
Bimage* new mask from marked segments.
Each segment should only be marked by a maximum of one component.

◆ model_create_hull_mask()

Bimage * model_create_hull_mask ( Bmodel model,
Vector3< long >  size,
Vector3< double >  ori,
Vector3< double >  sam,
int  curv_flag,
int  fast 
)

Calculates a mask based on the periphery of a model structure.

Parameters
*modelmodel structure.
sizesize of the new mask.
oriorigin of the new mask.
sampixel size of the new mask.
curv_flagflag to indicate curved surface.
fastflag to use fast algorithm.
Returns
Bimage* new mask.
Each point in the new image is tested for inclusion in the mask,
by calculating whether it falls inside the closest 3 vertices.
Only the first model in the linked list is used.

◆ model_create_level_mask()

Bimage * model_create_level_mask ( Bmodel model,
Vector3< long >  size,
Vector3< double >  ori,
Vector3< double >  sam 
)

Calculates a mask with one level per model.

Parameters
*modelmodel structure.
sizesize of the new mask.
oriorigin of the new mask.
sampixel size of the new mask.
Returns
Bimage* new mask.
A level is defined as those voxels closest to the vertices of one model.

◆ model_create_mask()

Bimage * model_create_mask ( Bmodel model,
Vector3< long >  size,
Vector3< double >  ori,
Vector3< double >  sam,
double  edge 
)

Calculates a mask of the components and links of a model structure.

Parameters
*modelmodel structure.
sizesize of the new mask.
oriorigin of the new mask.
sampixel size of the new mask.
edgeedge width in angstrom.
Returns
Bimage* new mask.
Each component is used to generate a sphere and each link a bar.
Only the first model in the linked list is used.

◆ model_create_projected_mask()

Bimage * model_create_projected_mask ( Bmodel model,
Vector3< long >  size,
Vector3< double >  ori,
Vector3< double >  sam,
double  dang,
Bsymmetry sym 
)

Calculates a set of 2D masks for the projections of a model structure.

Parameters
*modelmodel structure.
sizesize of the new mask.
oriorigin of the new mask.
sampixel size of the new mask.
dangangular step size.
sympoint group symmetry.
Returns
Bimage* new mask.
Each component is used to set  the corresponding projected pixel in each 2D image.
The projection directions are calculated within the asymmetric unit.

◆ model_create_shell_mask()

Bimage * model_create_shell_mask ( Bmodel model,
Vector3< long >  size,
Vector3< double >  ori,
Vector3< double >  sam,
double  shell_width,
int  curv_flag,
int  fast 
)

Calculates a shell mask covering a model structure.

Parameters
*modelmodel structure.
sizesize of the new mask.
oriorigin of the new mask.
sampixel size of the new mask.
shell_widthwidth of shell mask.
curv_flagflag to indicate curved surface.
fastflag to use fast algorithm.
Returns
Bimage* new mask.
Each point in the new image is tested for inclusion in the mask,
by calculating whether it falls inside the closest 3 vertices.
Only the first model in the linked list is used.

◆ model_from_multilevel_mask()

Bmodel * model_from_multilevel_mask ( Bimage p)

Generates components at the center of mass of each mask level.

Parameters
*pmulti-level mask.
Returns
Bmodel* new model.
The mask is expected to be of integer data type.