Bsoft 2.1.4
Bernard's software package
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>

Macros

#define SWAPTRIG   65535
 

Functions

Bimageread_img (char *filename, int readdata, int img_select)
 General driver function to read multiple image formats. More...
 
Bimageread_img (Bstring filename, int readdata, int img_select)
 
Bimageread_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

Macro Definition Documentation

◆ SWAPTRIG

#define SWAPTRIG   65535

Function Documentation

◆ img_convert_fourier()

int img_convert_fourier ( Bimage p,
FourierType  nutransform 
)

Converts Fourier transform types.

Parameters
*pthe image.
nutransformnew 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.

◆ read_img() [1/3]

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

◆ read_img() [2/3]

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

General driver function to read multiple image formats.

Parameters
filenamefile name (plus any tags for the RAW format).
readdataflag to activate reading of image data.
img_selectimage 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.

◆ read_img() [3/3]

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

◆ write_img() [1/3]

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

◆ write_img() [2/3]

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

General driver function to write multiple image formats.

Parameters
filenamefile name (plus any tags for the RAW format).
*pthe image structure.
compressioncompression 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.

◆ write_img() [3/3]

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