Bsoft  1.9
Bernard's software package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
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
*pimage (not altered).
img_numberimage 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
*pimage (not altered).
img_numberimage number from which to extract, -1 indicates all images.
startthree-value vector = start of extracted image.
sizethree-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
*pmicrograph to extract filament from.
img_numimage number from which to extract filament.
widthwidth of filament image to extract.
axishelical axis alignment: x=1, y=2, z=3.
nsplinenumber of coordinates in spline curve.
*splinespline 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
*pimage.
img_numimage number to extract.
centercenter of region to magnify.
sizesize of region to magnify.
scaledimensional 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
*pimage.
img_numimage number to extract.
voxelvoxel of intersection.
sizesize 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
*pimage.
radiusradius of box to extract.
bad_radiusradius of bad areas.
ncoordnumber of coordinates.
nbadnumber of bad area coordinates.
*coordscoordinates (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
*pimage (not altered).
img_numberimage number from which to extract, -1 indicates all images.
minradminimum shell radius.
maxradmaximum 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
*pimage.
aflagaveraging 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
*pimage (not altered).
img_numberimage number from which to extract.
start3-vector start for first tile to be extracted.
size3-vector size of part of image to be extracted (0 = whole image).
tile_size3-vector size of extracted image.
exceedflag 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
*pimage (not altered).
img_numberimage number from which to extract, -1 indicates all images.
ntilesnumber of tiles to extract.
*coordscoordinates for the tile origins.
tile_size3-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.