Bsoft  1.9
Bernard's software package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
img_afm.h File Reference

Header file for AFM functions. More...

#include "rwimg.h"
#include "ps_plot.h"

Go to the source code of this file.

Functions

int img_to_surface (Bimage *p, Bimage *psd, int nz, double density, double resolution)
 Converts a 2D AFM image to a 3D density map. More...
 
Bimage * img_3D_to_height (Bimage *p, double threshold)
 Converts a 3D image to a 2D height image. More...
 
Bimage * afm_generate_tip (Vector3< int > size, Vector3< float > sampling, double radius, double resolution)
 Generates a rounded conical AFM tip. More...
 
Bplot * afm_simulate (Bimage *ptip, Bimage *p, double spring, double modulus, double thick)
 Simulates and AFM experiment. More...
 
Bimage * afm_force_to_height (Bimage *pf, double force_step)
 Converts an AFM force map into a set of 2D height images at different constant force values. More...
 

Detailed Description

Header file for AFM functions.

Author
Bernard Heymann
Date
Created: 19990124
Modified: 20141230

Definition in file img_afm.h.

Function Documentation

Bimage* afm_force_to_height ( Bimage *  pf,
double  force_step 
)

Converts an AFM force map into a set of 2D height images at different constant force values.

Parameters
*pfforce map.
force_stepforce intervals for height images
Returns
Bimage* ph height images.

Definition at line 400 of file img_afm.cpp.

Bimage* afm_generate_tip ( Vector3< int >  size,
Vector3< float >  sampling,
double  radius,
double  resolution 
)

Generates a rounded conical AFM tip.

Parameters
sizesize of the tip density
samplingsampling/spacing (in angstrom/pixel)
radiusradius of the tip curvature (in angstrom)
resolutionthe resolution affects the tip surface softness
Returns
Bimage* tip 3D map.
A 2D image of a conical tip is generated, with a 45 degree angle and
a rounding tip with the desired radius and softness.
The 2D image is then converted to a 3D surface using the function 
img_to_surface and returned.  The density of beta-silicon nitride
of 1.925 Da/A3 is used.

Definition at line 165 of file img_afm.cpp.

Bplot* afm_simulate ( Bimage *  ptip,
Bimage *  p,
double  spring,
double  modulus,
double  thick 
)

Simulates and AFM experiment.

Parameters
*ptipAFM tip density map - converted to force map.
*pspecimen density map.
springAFM cantilever spring constant (N/m).
modulusbulk modules (N/m2).
thicksample thickness (angstrom).
Returns
Bplot* force curve.
The elastic force on an AFM tip is calculated as:
    F = kt*dz = kb*dV/d
where   kt is the cantilever spring constant, typically 0.01 - 0.1 N/m.
        dz is the tip displacement due to specimen interaction.
        kb is the bulk modulus of the specimen, typically 1e9 N/m2.
        dV is the volume of the specimen displaced by the tip. This
            volume is here approximated as the density overlap volume.
        d is the specimen thickness in angstrom.
The tip is positioned at each point (x,y,z) in the density map and the
overlap volume calculated (i.e., a type of convolution).  This tip
position corresponds to a zero displacement.  The correct tip position
is found by shifting the tip upwards (in the z-direction) until the 
displacement and elastic forces are approximately equal.  The tip 
displacement is refined by interpolation and the force calculated.  
The force map is returned in place of the original density map.
Forces are calculated in piconewton. 
The origin of the tip density is taken as nx/2, ny/2, 0.

Definition at line 311 of file img_afm.cpp.

Bimage* img_3D_to_height ( Bimage *  p,
double  threshold 
)

Converts a 3D image to a 2D height image.

Parameters
*p3D image.
thresholdthreshold to define the surface (assuming positive density).
Returns
Bimage* 2D height image.
The threshold defines the surface of the positive density in the 3D image.
Each line of voxels in the z-direction is scanned for the voxel
exceeding the threshold with the highest z-index.

Definition at line 123 of file img_afm.cpp.

int img_to_surface ( Bimage *  p,
Bimage *  psd,
int  nz,
double  density,
double  resolution 
)

Converts a 2D AFM image to a 3D density map.

Parameters
*p2D AFM image.
*psd2D standard deviation image.
nzz dimension of the new 3D map.
densitydensity inside the surface (Da/A3).
resolutionsigma bounds.
Returns
int 0.
The 2D image is expanded in the z direction according to:
                          voxel_density
dens[x,y,z] = --------------------------------------
              1+exp(factor*(z-zdis[x,y])/sigma[x,y])
where   voxel_density is the total density attributed to a voxel
        factor = 1.618
        z - zdis[x,y] is the z distance from the surface
        sigma is a standard deviation term to describe the surface variability.
The sigma term can be set automatically or given by an input standard deviation map.
The position of the surface is calculated as:
zdis[x,y] = loz + (hiz - loz)*(image[x,y] - min)/(max - min)
where   loz and hiz are the lowest and highest points of the surface in the 3D map
        min and max are the image minimum and maximum values

Definition at line 40 of file img_afm.cpp.