Bsoft 2.1.4
Bernard's software package
img_combine.cpp File Reference

Functions to combine two images in various ways. More...

#include "Bimage.h"
#include "img_combine.h"
#include "linked_list.h"
#include "utilities.h"

Functions

Bimageimg_add (Bstring *file_list, int flags)
 Adds multiple images together with optional variance or standard deviation. More...
 
Bimageimg_setup_combined (Bstring *file_list, long &nimg, int cat)
 Sets up a list of images for concatenation or summation. More...
 
Bimageimg_catenate (Bstring *file_list, Bstring &rawstring, DataType nudatatype, Vector3< long > nusize, int setZslices, int fill_type, double fill, double newavg, double newstd)
 Catenates a list of images into a multi-image structure. More...
 
Bimageimg_add_weighed (Bstring *file_list, vector< double > weight, double newavg, double newstd, int flags)
 Adds multiple images together with given weights. More...
 

Variables

int verbose
 

Detailed Description

Functions to combine two images in various ways.

Author
Bernard Heymann
Date
Created: 19990219
Modified: 20190208

Function Documentation

◆ img_add()

Bimage * img_add ( Bstring file_list,
int  flags 
)

Adds multiple images together with optional variance or standard deviation.

Parameters
*file_listlist of file names.
flagsflags to modify summation.
Returns
Bimage* resultant image (floating point).
Images are read from a number files and added.
All the images must be the same size, but could have different numbers of sub-images.
The flags that can set are:
    1   calculate the average in stead of the sum.
    2   calculate the variance as FOM
    4   calculate the standard deviation as FOM (supercedes the variance)
All images are converted to floating point.

◆ img_add_weighed()

Bimage * img_add_weighed ( Bstring file_list,
vector< double >  weight,
double  newavg,
double  newstd,
int  flags 
)

Adds multiple images together with given weights.

Parameters
*file_listlist of file names.
weightlist of weights (can be NULL).
newavgnew average for rescaling.
newstdnew standard deviation for rescaling.
flagsflags to modify summation.
Returns
Bimage* resultant image (floating point).
Images are read from a number files and added to each other, using
the given weights to determine each contribution.
The images are rescaled to a new average and standard deviation before 
weighted addition. If the given standard deviation is zero or less,
this step is omitted.
The weighed average is calculated and returned as a new image.
The flags that can set are:
    1   calculate the average in stead of the sum.
    2   calculate the variance as FOM
    4   calculate the standard deviation as FOM (supercedes the variance)
    8   center each image before summation
All images are converted to floating point.

◆ img_catenate()

Bimage * img_catenate ( Bstring file_list,
Bstring rawstring,
DataType  nudatatype,
Vector3< long >  nusize,
int  setZslices,
int  fill_type,
double  fill,
double  newavg,
double  newstd 
)

Catenates a list of images into a multi-image structure.

Parameters
*file_listlist of file names.
&rawstringformat for re-interpretation of file.
nudatatypenew data type (default from first image).
nusizenew size (default from images).
setZslicesflag to create 2D images from slices.
fill_typefill type for expanding images.
fillfill value for expanding images.
newavgnew average to set each individual image.
newstdnew standard deviation to set each individual image.
Returns
Bimage* catenated image.
The images can have different numbers of sub-images, sizes and data types.

◆ img_setup_combined()

Bimage * img_setup_combined ( Bstring file_list,
long &  nimg,
int  cat 
)

Sets up a list of images for concatenation or summation.

Parameters
*file_listlist of file names.
&nimgnumber of concatenated images.
catflag to indicate concatenation.
Returns
Bimage* new image into which to write data.
The images can have different numbers of sub-images, sizes and data types.

Variable Documentation

◆ verbose

int verbose
extern