| Bsoft 2.0.5 Bernard's software package

Macros | Functions
rwimg.h File Reference

Header file for 2D and 3D image I/O. More...

`#include "Bimage.h"`
`#include "Vector3.h"`
`#include "View.h"`
`#include "UnitCell.h"`
`#include <fstream>`

Go to the source code of this file.

## Macros
#define | SWAPTRIG 65535

## Functions
Bimage * | read_img (char *filename, int readdata, int img_select)
| General driver function to read multiple image formats. More...
Bimage * | read_img (Bstring filename, int readdata, int img_select)
Bimage * | read_img (string filename, int readdata, int img_select)
int | write_img (const char *filename, Bimage *p, int compression)
| General driver function to write multiple image formats. More...
int | write_img (Bstring filename, Bimage *p, int compression)
int | write_img (string filename, Bimage *p, int compression)
int | img_convert_fourier (Bimage *p, FourierType newtransform)
| Converts Fourier transform types. More...

## Detailed Description

Header file for 2D and 3D image I/O.

Header file for reading and writing ImageMagick MIFF files.

Author
  Bernard Heymann

Date
  Created: 19990321
  Modified: 20180419

Author
  Bernard Heymann

Date
  Created: 19990321
  Modified: 20111217

      Format: 2D image file format for the Image Magick package

Definition in file rwimg.h.

## Macro Definition Documentation

## ◆ SWAPTRIG

#define SWAPTRIG 65535

Definition at line 16 of file rwimg.h.

## Function Documentation

## ◆ img_convert_fourier()

int img_convert_fourier | ( | Bimage * | p,
|  | FourierType | nutransform
| ) |  |

Converts Fourier transform types.

Parameters

  *p | the image.
  nutransform | new transform type.

Returns
  int error code (<0 means failure). Fourier transform classification: 0=NoTransform: No transform: Just a complex data set 1=Standard: Standard transform with origin = (0,0,0) (Suprim) 2=Centered: Centered transform with origin = (nx/2,ny/2,nz/2) (Imagic) 3=Hermitian: Hermitian transform with origin = (0,0,0) and size (nx/2+1,ny,nz) (Spider, EM) 4=CentHerm: Centered hermitian transform with origin = (0,ny/2,nz/2) and size (nx/2+1,ny,nz) (MRC) Assumption: The correct dimensions for a standard transform is stored in the x, y, and z fields.

Definition at line 556 of file rwimg.cpp.

## ◆ read_img() [1/3]

Bimage* read_img | ( | char * | filename,
|  | int | readdata,
|  | int | img_select
| ) |  |

General driver function to read multiple image formats.

Parameters

  filename | file name (plus any tags for the RAW format).
  readdata | flag to activate reading of image data.
  img_select | image selection in multi-image file (-1 = all images).

Returns
  Bimage* the image structure, NULL if reading failed. This is the only image reading function that should be called from programs. A Bimage structure is initialized with default values. The file format is deduced from the file name extension. Every file format has its own funtion to read the file. The selection argument is used to read only one image from a multi-image file if it is greater than -1. This selection must be handled within each format to ensure the correct allocation of the sub-image structure. If the requested selection is equal or larger than the number of images, the selection is set to the last image.

Definition at line 76 of file rwimg.cpp.

## ◆ read_img() [2/3]

Bimage* read_img | ( | Bstring | filename,
|  | int | readdata,
|  | int | img_select
| ) |  |

Definition at line 82 of file rwimg.cpp.

## ◆ read_img() [3/3]

Bimage* read_img | ( | string | filename,
|  | int | readdata,
|  | int | img_select
| ) |  |

Definition at line 87 of file rwimg.cpp.

## ◆ write_img() [1/3]

int write_img | ( | const char * | filename,
|  | Bimage * | p,
|  | int | compression
| ) |  |

General driver function to write multiple image formats.

Parameters

  filename | file name (plus any tags for the RAW format).
  *p | the image structure.
  compression | compression type: 0=none, 5=LZW(Tiff)

Returns
  int error code (<0 means failure). This is the only image writing function that should be called from programs. The file format is deduced from the file name extension. Every file format has its own funtion to write the file.

Definition at line 280 of file rwimg.cpp.

## ◆ write_img() [2/3]

int write_img | ( | Bstring | filename,
|  | Bimage * | p,
|  | int | compression
| ) |  |

Definition at line 287 of file rwimg.cpp.

## ◆ write_img() [3/3]

int write_img | ( | string | filename,
|  | Bimage * | p,
|  | int | compression
| ) |  |

Definition at line 292 of file rwimg.cpp.