| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Functions | Variables
img_segment.cpp File Reference

Functions used to segment/interpret images. More...

`#include "rwimg.h"`
`#include "img_segment.h"`
`#include "img_feature.h"`
`#include "img_combine.h"`
`#include "linked_list.h"`
`#include "utilities.h"`

Go to the source code of this file.

## Functions
int | img_blobs (Bimage *p, float threshold, float min_size, float max_size, float setvalue, int sign)
| Identifies contiguous regions above a given threshold (blobs) and eliminate those less than a minimum size. More...
float | img_find_threshold (Bimage *p, int img_num, double mol_weight, float rho)
| Finds the density threshold associated with a particular molecular weight. More...
float | img_mass_at_threshold (Bimage *p, int img_num, float threshold, float rho)
| Calculates the mass from the density threshold. More...
int | img_internal_volume (Bimage *p, float threshold, int mask_out_freq)
| Finds the density threshold associated with a particular molecular weight. More...
int | img_segment_threshold_series (Bimage *p, float threshold_first, float threshold_last, float threshold_step)
| Segments a map through a series of thresholds and reports results. More...
Bimage * | img_flood_fill (Bimage *p, Bimage *pfeature, float threshold_hi, float threshold_lo, float threshold_step, int fill_borders)
| Creates and expands a feature map from a starting to ending threshold value. More...
Bimage * | img_flood_peaks (Bimage *p, int kernel_size, float threshold)
| Generates a segmented image from peaks above a threshold value. More...
int | img_set_second_mask (Bimage *p, Bimage *pmask, float threshold)
| A second level mask is added to a primary mask based on a threshold. More...
int | img_check_neighbors (Bimage *p, unsigned long index)
| Check neighbors in feature map and assign a value if a neighbor is assigned. More...
long | img_find_highest_in_kernel (Bimage *p, unsigned long index, int size)
| Finds the highest value in a kernel excluding the central voxel. More...
Bimage * | img_excise_feature (Bimage *p, Bimage *pfeature, Bmarker *markers)
| Finds the density around a voxel associated with a particular feature. More...
Bimage * | img_excise_all_features (Bimage *p, Bimage *pfeature)
| Extracts all the features associated with a multi-level mask. More...

## Variables
int | verbose

## Detailed Description

Functions used to segment/interpret images.

Author
  Bernard Heymann

Date
  Created: 19990321
  Modified: 20131231

Definition in file img_segment.cpp.

## Function Documentation

int img_blobs | ( | Bimage * | p,
|  | float | threshold,
|  | float | min_size,
|  | float | max_size,
|  | float | setvalue,
|  | int | sign
| ) |  |

Identifies contiguous regions above a given threshold (blobs) and eliminate those less than a minimum size.

Parameters

  *p | image.
  threshold | threshold to define contiguous regions.
  min_size | minimum number of voxels to keep a region.
  max_size | maximum number of voxels to keep a region.
  setvalue | value to assign to deleted regions (typically set to threshold).
  sign | sign controlling direction of thresholding.

Returns
  int number of voxels set to threshold.

      All contiguous regions in an image are indexed and their sizes
      calculated. Whether a region is contiguous is defined by a
      threshold. Regions smaller than a minimum number of voxels are
      set to the threshold value. The input image is modified and
      left as a floating point image.

Definition at line 37 of file img_segment.cpp.

int img_check_neighbors | ( | Bimage * | p,
|  | unsigned long | index
| ) |  |

Check neighbors in feature map and assign a value if a neighbor is assigned.

Parameters

  *p | the integer image mask.
  index | index in multi-image.

Returns
  int new value assigned.

      The mask must be of type integer.

Definition at line 731 of file img_segment.cpp.

Bimage* img_excise_all_features | ( | Bimage * | p,
|  | Bimage * | pfeature
| ) |  |

Extracts all the features associated with a multi-level mask.

Parameters

  *p | density map.
  *pfeature | multi-level feature mask map.

Returns
  Bimage* image with excised features.

      The feature index is found in a feature map and the corresponding voxels
      in the density maps are extracted.
      An image is assumed to have density represented by higher (white) values.

Definition at line 944 of file img_segment.cpp.

Bimage* img_excise_feature | ( | Bimage * | p,
|  | Bimage * | pfeature,
|  | Bmarker * | markers
| ) |  |

Finds the density around a voxel associated with a particular feature.

Parameters

  *p | density map (modified, omission map).
  *pfeature | feature map.
  *markers | marker coordinates within features to be extracted.

Returns
  Bimage* image with excised feature.

      The feature index is found in a feature map and the corresponding voxels
      in the density maps are extracted.
      An image is assumed to have density represented by higher (white) values.
      Each voxel is specified as x, y, z and image number.

Definition at line 850 of file img_segment.cpp.

long img_find_highest_in_kernel | ( | Bimage * | p,
|  | unsigned long | index,
|  | int | size
| ) |  |

Finds the highest value in a kernel excluding the central voxel.

Parameters

  *p | image.
  index | index in multi-image.
  size | kernel edge half size

Returns
  int index of highest value.

      The image must be floating point.

Definition at line 796 of file img_segment.cpp.

float img_find_threshold | ( | Bimage * | p,
|  | int | img_num,
|  | double | mol_weight,
|  | float | rho
| ) |  |

Finds the density threshold associated with a particular molecular weight.

Parameters

  *p | image.
  img_num | sub-image number (first = 0, -1 means all).
  mol_weight | molecular weight.
  rho | protein density in Da/A3.

Returns
  float threshold.

      A threshold value is determined which contour a density such that
      it corresponds to 100% of the given molecular weight.
      An image is assumed to have density represented by higher (white) values.

Definition at line 127 of file img_segment.cpp.

Bimage* img_flood_fill | ( | Bimage * | p,
|  | Bimage * | pfeature,
|  | float | threshold_hi,
|  | float | threshold_lo,
|  | float | threshold_step,
|  | int | fill_borders
| ) |  |

Creates and expands a feature map from a starting to ending threshold value.

Parameters

  *p | the image.
  *pfeature | feature map (if NULL, generate from high threshold).
  threshold_hi | the level to pick initial regions.
  threshold_lo | the lowest level to include voxels in regions.
  threshold_step | the incremental change in threshold.
  fill_borders | flag to assign borders between regions (default not).

Returns
  Bimage* integer image containing feature index numbers.

      A feature map is calculated at the threshold furthest from the average.
      The feature map is then expanded by lowering the threshold gradually
      and assigning newly included voxels to neighboring regions (i.e., flooding).
      Voxels with neighbours assigned to two or more different regions are tagged
      as indeterminate to indicate borders between regions. These border voxels
      are counted and can be used to estimate the extent of interfaces.
      The indices of all the final regions are packed into an integer data block
      within a new image.

Definition at line 439 of file img_segment.cpp.

Bimage* img_flood_peaks | ( | Bimage * | p,
|  | int | kernel_size,
|  | float | threshold
| ) |  |

Generates a segmented image from peaks above a threshold value.

Parameters

  *p | the image.
  kernel_size | size of kernel to determine peaks.
  threshold | the lowest level to include voxels in regions.

Returns
  Bimage* integer image containing region index numbers.

      Every voxel with a value above the threshold is tagged by a pointer
      pointing to the highest value within a kernel.
      A peak is defined as pointing to itself, while every other voxel
      points towards a peak.
      The voxels in the mask are then iteratively assigned to the peaks
      they point to.
      The indices of all the final regions are packed into an integer data block
      within a new image.

Definition at line 612 of file img_segment.cpp.

int img_internal_volume | ( | Bimage * | p,
|  | float | threshold,
|  | int | mask_out_freq
| ) |  |

Finds the density threshold associated with a particular molecular weight.

Parameters

  *p | image (modified to generate mask).
  threshold | threshold to define density.
  mask_out_freq | mask output frequency.

Returns
  int 0.

      A threshold value is determined which contour a density such that
      it corresponds to 100% of the given molecular weight.
      An image is assumed to have density represented by higher (white) values.

Definition at line 264 of file img_segment.cpp.

float img_mass_at_threshold | ( | Bimage * | p,
|  | int | img_num,
|  | float | threshold,
|  | float | rho
| ) |  |

Calculates the mass from the density threshold.

Parameters

  *p | image.
  img_num | sub-image number (first = 0).
  threshold | density threshold.
  rho | protein density in Da/A3.

Returns
  float threshold.

      An image is assumed to have density represented by higher (white) values.

Definition at line 222 of file img_segment.cpp.

int img_segment_threshold_series | ( | Bimage * | p,
|  | float | threshold_first,
|  | float | threshold_last,
|  | float | threshold_step
| ) |  |

Segments a map through a series of thresholds and reports results.

Parameters

  *p | the image.
  threshold_first | the level to pick initial regions.
  threshold_last | the lowest level to include voxels in regions.
  threshold_step | the incremental change in threshold.

Returns
  int 0.

Definition at line 382 of file img_segment.cpp.

int img_set_second_mask | ( | Bimage * | p,
|  | Bimage * | pmask,
|  | float | threshold
| ) |  |

A second level mask is added to a primary mask based on a threshold.

Parameters

  *p | the image.
  *pmask | the integer image mask.
  threshold | threshold for secondary mask.

Returns
  int 0.

      A new level is created in the mask image (i.e., max+1) for all voxels
      above the threshold and not included in the mask already.

Definition at line 701 of file img_segment.cpp.

## Variable Documentation

int verbose