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

Header file for functions to extract parts of images. More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <ctype.h>`
`#include <unistd.h>`
`#include <math.h>`
`#include <time.h>`
`#include "rwimg.h"`

Go to the source code of this file.

## Functions
Bimage * | img_extract (Bimage *p, int img_number)
| Extracts part of an image into a new image. More...
Bimage * | img_extract (Bimage *p, int img_number, Vector3< float > start, Vector3< int > size)
| Extracts part of an image into a new image. More...
Bimage * | img_extract_shell (Bimage *p, int img_number, float minrad, float maxrad)
| Extracts a shell from an image into a new image. More...
Bimage * | img_extract_tiles (Bimage *p, int img_number, Vector3< int > start, Vector3< int > size, Vector3< int > tile_size, int exceed)
| Extracts a set of tiles from an image into a new image. More...
Bimage * | img_extract_tiles_at_coords (Bimage *p, int img_number, int ntiles, Vector3< int > *coords, Vector3< int > tile_size)
| Extracts a set of tiles at specified positions from an image into a new image. More...
Bimage * | img_extract_orthogonal_slices (Bimage *p, int img_num, Vector3< int > voxel, Vector3< int > size)
| Extracts orthogonal views around a voxel. More...
Bimage * | img_extract_show (Bimage *p, int aflag)
| Converts a slice from an image to a 2D plane for display. More...
Bimage * | img_extract_magnifying (Bimage *p, int img_num, Vector3< int > center, Vector3< int > size, float scale)
| Extracts a region from an image to magnify. More...
Bimage * | img_extract_particles (Bimage *p, float radius, float bad_radius, int ncoord, int nbad, float *coords)
| Extracts particles defined by a series of coordinates. More...
Bimage * | img_extract_filament (Bimage *p, int img_num, double width, int axis, long nspline, Vector3< float > *spline)
| Extracts a filament defined by a series of coordinates. More...

## Detailed Description

Header file for functions to extract parts of images.

Author
  Bernard Heymann

Date
  Created: 20000430
  Modified: 20150310

Definition in file img_extract.h.

## Function Documentation

Bimage* img_extract | ( | Bimage * | p,
|  | int | img_number
| ) |  |

Extracts part of an image into a new image.

Parameters

  *p | image (not altered).
  img_number | image number from which to extract, -1 indicates all images.

Returns
  Bimage* p extracted image.

      A single image (only one sub-image) is extracted from an image.
      The old data is not affected.
      Statistics for the extracted image are calculated.

Definition at line 35 of file img_extract.cpp.

Bimage* img_extract | ( | Bimage * | p,
|  | int | img_number,
|  | Vector3< float > | start,
|  | Vector3< int > | size
| ) |  |

Extracts part of an image into a new image.

Parameters

  *p | image (not altered).
  img_number | image number from which to extract, -1 indicates all images.
  start | three-value vector = start of extracted image.
  size | three-vector size of extracted image.

Returns
  Bimage* p extracted image.

      A single image (only one sub-image) is extracted from a given sub-image
      in an image structure, starting at a specified point and with a
      specified size.
      The old data is not affected.
      Statistics for the extracted image are calculated.

Definition at line 62 of file img_extract.cpp.

Bimage* img_extract_filament | ( | Bimage * | p,
|  | int | img_num,
|  | double | width,
|  | int | axis,
|  | long | nspline,
|  | Vector3< float > * | spline
| ) |  |

Extracts a filament defined by a series of coordinates.

Parameters

  *p | micrograph to extract filament from.
  img_num | image number from which to extract filament.
  width | width of filament image to extract.
  axis | helical axis alignment: x=1, y=2, z=3.
  nspline | number of coordinates in spline curve.
  *spline | spline curve.

Returns
  Bimage* one filament image.

      A single filament is extracted and written into a pre-existing image.

Definition at line 966 of file img_extract.cpp.

Bimage* img_extract_magnifying | ( | Bimage * | p,
|  | int | img_num,
|  | Vector3< int > | center,
|  | Vector3< int > | size,
|  | float | scale
| ) |  |

Extracts a region from an image to magnify.

Parameters

  *p | image.
  img_num | image number to extract.
  center | center of region to magnify.
  size | size of region to magnify.
  scale | dimensional scaling.

Returns
  Bimage* extracted slice for 2D and 3 slices for 3D.

      Only the desired region is extracted from the original image and
      resized based on the given scale argument.
      The dynamic range is rescaled using the image display minimum and
      maximum:
          new_data = data*255/(max-min)
      with truncation of the data below 0 and above 255.
      Bit data are converted to 0 (black) and 255 (white).
      RGB data are rescaled as for gray scale images.
      Complex data types are converted to intensities.

Definition at line 752 of file img_extract.cpp.

Bimage* img_extract_orthogonal_slices | ( | Bimage * | p,
|  | int | img_num,
|  | Vector3< int > | voxel,
|  | Vector3< int > | size
| ) |  |

Extracts orthogonal views around a voxel.

Parameters

  *p | image.
  img_num | image number to extract.
  voxel | voxel of intersection.
  size | size of slices to extract.

Returns
  Bimage* extracted slice for 2D and 3 slices for 3D.

      Only the desired region is extracted from the original image.
      The fill value is taken from the image background.

Definition at line 505 of file img_extract.cpp.

Bimage* img_extract_particles | ( | Bimage * | p,
|  | float | radius,
|  | float | bad_radius,
|  | int | ncoord,
|  | int | nbad,
|  | float * | coords
| ) |  |

Extracts particles defined by a series of coordinates.

Parameters

  *p | image.
  radius | radius of box to extract.
  bad_radius | radius of bad areas.
  ncoord | number of coordinates.
  nbad | number of bad area coordinates.
  *coords | coordinates (sets of x,y,z,n) including bad areas.

Returns
  Bimage* extracted particle images.

Definition at line 889 of file img_extract.cpp.

Bimage* img_extract_shell | ( | Bimage * | p,
|  | int | img_number,
|  | float | minrad,
|  | float | maxrad
| ) |  |

Extracts a shell from an image into a new image.

Parameters

  *p | image (not altered).
  img_number | image number from which to extract, -1 indicates all images.
  minrad | minimum shell radius.
  maxrad | maximum shell radius.

Returns
  Bimage* extracted image.

      A single image (only one sub-image) is extracted from a given sub-image
      in an image structure, starting at a specified point and with a
      specified size.
      The old data is not affected.
      Statistics for the extracted image are calculated.

Definition at line 237 of file img_extract.cpp.

Bimage* img_extract_show | ( | Bimage * | p,
|  | int | aflag
| ) |  |

Converts a slice from an image to a 2D plane for display.

Parameters

  *p | image.
  aflag | averaging flag.

Returns
  Bimage* extracted slice.

      Only the desired image slice is extracted from the original image and
      resized based on the given scale argument.
      The image, slice and scale values are encoded in the image structure.
      The dynamic range is rescaled using the image display minimum and maximum:
          new_data = data*255/(max-min)
      with truncation of the data below 0 and above 255.
      Bit data are converted to 0 (black) and 255 (white).
      RGB data are rescaled as for gray scale images.
      Complex data types are converted to intensities.

Definition at line 693 of file img_extract.cpp.

Bimage* img_extract_tiles | ( | Bimage * | p,
|  | int | img_number,
|  | Vector3< int > | start,
|  | Vector3< int > | size,
|  | Vector3< int > | tile_size,
|  | int | exceed
| ) |  |

Extracts a set of tiles from an image into a new image.

Parameters

  *p | image (not altered).
  img_number | image number from which to extract.
  start | 3-vector start for first tile to be extracted.
  size | 3-vector size of part of image to be extracted (0 = whole image).
  tile_size | 3-vector size of extracted image.
  exceed | flag to allow tiles to exceed the input image size.

Returns
  Bimage* p extracted set of sub-images.

      A set of tiles of specified size are extracted from a given sub-image
      in an image structure, starting from a point and generating
      as many tiles as would fit into the image size given. If the image size
      given is zero, then the whole image is used. The origins of the tiles
      are inserted into the sub-image origin fields.
      The old data is not affected.

Definition at line 347 of file img_extract.cpp.

Bimage* img_extract_tiles_at_coords | ( | Bimage * | p,
|  | int | img_number,
|  | int | ntiles,
|  | Vector3< int > * | coords,
|  | Vector3< int > | tile_size
| ) |  |

Extracts a set of tiles at specified positions from an image into a new image.

Parameters

  *p | image (not altered).
  img_number | image number from which to extract, -1 indicates all images.
  ntiles | number of tiles to extract.
  *coords | coordinates for the tile origins.
  tile_size | 3-vector size of extracted image.

Returns
  Bimage* p extracted set of sub-images.

      A set of tiles of specified size are extracted from a given sub-image
      in an image structure, using given coordinates for the tiles, which have
      to fit into the image size. The origins of the tiles are inserted into
      the sub-image origin fields.
      The old data is not affected.

Definition at line 445 of file img_extract.cpp.