| Bsoft 2.0.5 Bernard's software package

Functions
img_combine.h File Reference

Header file for combining two images in various ways. More...

`#include "rwimg.h"`

Go to the source code of this file.

## Functions
Bimage * | img_add (Bstring *file_list, int flags)
| Adds multiple images together with optional variance or standard deviation. More...
Bimage * | img_setup_combined (Bstring *file_list, long &nimg, int cat=0)
| Sets up a list of images for concatenation or summation. More...
Bimage * | img_catenate (Bstring *file_list, Bstring &rawstring, DataType newdatatype, Vector3< long > nusize, int setZslices=0, int fill_type=0, double fill=0, double newavg=0, double newstd=0)
| Catenates a list of images into a multi-image structure. More...
Bimage * | img_add_weighed (Bstring *file_list, vector< double > weight, double newavg=0, double newstd=0, int flags=0)
| Adds multiple images together with given weights. More...

## Detailed Description

Header file for combining two images in various ways.

Author
  Bernard Heymann

Date
  Created: 20000430
  Modified: 20190208

Definition in file img_combine.h.

## Function Documentation

## ◆ img_add()

Bimage* img_add | ( | Bstring * | file_list,
|  | int | flags
| ) |  |

Adds multiple images together with optional variance or standard deviation.

Parameters

  *file_list | list of file names.
  flags | flags 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.

Definition at line 32 of file img_combine.cpp.

## ◆ 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_list | list of file names.
  weight | list of weights (can be NULL).
  newavg | new average for rescaling.
  newstd | new standard deviation for rescaling.
  flags | flags 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.

Definition at line 288 of file img_combine.cpp.

## ◆ 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_list | list of file names.
  &rawstring | format for re-interpretation of file.
  nudatatype | new data type (default from first image).
  nusize | new size (default from images).
  setZslices | flag to create 2D images from slices.
  fill_type | fill type for expanding images.
  fill | fill value for expanding images.
  newavg | new average to set each individual image.
  newstd | new standard deviation to set each individual image.

Returns
  Bimage* catenated image.

      The images can have different numbers of sub-images, sizes and data types.

Definition at line 163 of file img_combine.cpp.

## ◆ 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_list | list of file names.
  &nimg | number of concatenated images.
  cat | flag 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.

Definition at line 107 of file img_combine.cpp.