| 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
img_feature.h File Reference

Header file for feature extraction tools. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include "marker.h"`
`#include "rwimg.h"`

Go to the source code of this file.

## Functions
int | img_replace_maxima (Bimage *p, float threshold)
| Replaces maxima above a threshold using local averages. More...
Bmarker * | img_extract_features (Bimage *p, int extract_method, int target_num, float threshold)
| Finds local minimums in a grey scale image and uses those as features. More...
Bimage * | img_find_features (Bimage *p, float threshold, int sign, int wrap)
| Segments an image into contiguous regions (features). More...
double | img_average_feature_size (Bimage *p)
| Calculates the average size of regions (features) in a level mask. More...
int | img_assignAllMyNeighbors (Bimage *p, int *feature_mask, unsigned long index, int feature_number, float threshold, int sign, int wrap)
| Finds all the pixels that are part of the same feature. More...

## Detailed Description

Header file for feature extraction tools.

Author
  Samuel Payne and Bernard Heymann

Date
  Created: 20010516 Modified: 20121016 (BH)

Definition in file img_feature.h.

## Function Documentation

int img_assignAllMyNeighbors | ( | Bimage * | p,
|  | int * | feature_mask,
|  | unsigned long | index,
|  | int | feature_number,
|  | float | threshold,
|  | int | sign,
|  | int | wrap
| ) |  |

Finds all the pixels that are part of the same feature.

Author
  Samuel Payne and Bernard Heymann

Parameters

  *p | the image.
  *feature_mask | a mask holding feature assignments.
  index | the first voxel of a feature.
  feature_number | the feature number that voxels are assigned.
  threshold | the level at which things are ignored.
  sign | sign controlling direction of thresholding.
  wrap | flag to wrap around image boundaries.

Returns
  int 0.

      This method uses a list to keep track of voxels assigned to a feature.
      In subsequent iterations the non-assigned voxels next to those in
      the list are assigned if they exceed the threshold, and their indices
      are kept in a new list. The new list is transferred to the old list
      and the process iteratively continued until the new list contains
      no more voxels.

Definition at line 543 of file img_feature.cpp.

double img_average_feature_size | ( | Bimage * | p | ) |

Calculates the average size of regions (features) in a level mask.

Parameters

  *p | the image.

Returns
  double average feature size.

Definition at line 455 of file img_feature.cpp.

Bmarker* img_extract_features | ( | Bimage * | p,
|  | int | extract_method,
|  | int | target_num,
|  | float | threshold
| ) |  |

Finds local minimums in a grey scale image and uses those as features.

Author
  Samuel Payne and Bernard Heymann

Parameters

  *p | image (modified to floating point).
  extract_method | The method to determine the center of the particle
  target_num | Max number of desired features (-1 will return all)
  threshold | Threshold value used to determine whether a pixel is considered a feature.

Returns
  Bmarker* a set containing xyz coordinates of features

      The input image is expected to have been cleaned in the following manner.
      With each suggestion is listed the corresponding bsoft function call.
      1.  Any extremes such as white lettering, or black edges have been removed.
          bfilter -e filname filename
      2. Edge filter to smooth out the edges.
          bedge -x<xsize>,<ysize>,<zsize> -o150,150,0 -g75 filename filename
      3. Bandpass filtered to reduce the noise.
          bfilter -b1000,2000 -df filename filename

      The algorithm finds blocks of dark grey. The features are black dots
      in the image, which could be particles, but don't have to be.  As long
      as the picking is consistent, it does not matter what is picked.
      (it could be a pickle).  The method used to find the center of the feature
      depends on the input. (0=Center of Mass, 1=Center of Area, 2=Darkest pixel)

Definition at line 249 of file img_feature.cpp.

Bimage* img_find_features | ( | Bimage * | p,
|  | float | threshold,
|  | int | sign,
|  | int | wrap
| ) |  |

Segments an image into contiguous regions (features).

The image is segmented into contiguous regions where a region is defined as all those voxels exceeding the given threshold and adjacent to each other. This method uses a list to keep track of voxels assigned to a feature. In subsequent iterations the non-assigned voxels next to those in the list are assigned if they exceed the threshold, and their indices are kept in a new list. The new list is transferred to the old list and the process iteratively continued until the new list contains no more voxels. The indices of all the features are packed into an integer data block within a new image. The new image maps the indices of the features starting from one to as many features as were found (the maximum gives the number of features). The new image has zeroes for all voxels outside the features.

Parameters

  *p | the image.
  threshold | the level at which things are ignored.
  sign | sign controlling direction of thresholding.
  wrap | flag to wrap around image boundaries.

Returns
  Bimage* integer image containing feature index numbers.

Definition at line 407 of file img_feature.cpp.

int img_replace_maxima | ( | Bimage * | p,
|  | float | threshold
| ) |  |

Replaces maxima above a threshold using local averages.

The image is first segemented into features, each defined as a contiguous cluster of voxels with values above the threshold. Each feature is encoded in an integer image, with all the values in this image set to the indices of the features, or zero elsewhere. The features are iteratively filled in, where in every iteration, the border values of the features are replaced by the average of the neighbouring voxels outside the feature. After each iteration, every feature is shrunk by excluding the newly replaced voxels.

Parameters

  *p | image (modified to floating point).
  threshold | threshold.

Returns
  int 0.

Definition at line 39 of file img_feature.cpp.