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

Library for 2D and 3D image I/O. More...

#include "rwimg.h"
#include "file_util.h"
#include "UnitCell.h"
#include "Complex.h"
#include "Vector3.h"
#include "utilities.h"
#include "rwRAW.h"
#include "rwASCII.h"
#include "rwBCR.h"
#include "rwBIORAD.h"
#include "rwBRIX.h"
#include "rwBrookhavenSTEM.h"
#include "rwCCP4.h"
#include "rwDI.h"
#include "rwDM.h"
#include "rwDSN6.h"
#include "rwDX.h"
#include "rwEER.h"
#include "rwEM.h"
#include "rwGOODFORD.h"
#include "rwGRD.h"
#include "rwHKL.h"
#include "rwIMAGIC.h"
#include "rwIP.h"
#include "rwJPEG.h"
#include "rwkernel.h"
#include "rwMFF.h"
#include "rwMIFF.h"
#include "rwMRC.h"
#include "rwND2.h"
#include "rwPIC.h"
#include "rwPIF.h"
#include "rwPNG.h"
#include "rwPNM.h"
#include "rwPostScript.h"
#include "rwSER.h"
#include "rwSitus.h"
#include "rwSPE.h"
#include "rwSPIDER.h"
#include "rwSUPRIM.h"
#include "rwTGA.h"
#include "rwTIFF.h"
#include "rwXPLOR.h"

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_one (Bimage *p, Complex< float > *nufdata, int n, long hermx, long friedel, long oldx, long nux, long xo1, long xo2, long yo1, long yo2, long zo1, long zo2, int z_even, int y_even)
 
int img_convert_fourier (Bimage *p, FourierType nutransform)
 Converts Fourier transform types. More...
 

Variables

int verbose
 
string command
 
const char * month []
 

Detailed Description

Library for 2D and 3D image I/O.

Author
Bernard Heymann
Date
Created: 19990321
Modified: 20210628

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.

◆ img_convert_fourier_one()

int img_convert_fourier_one ( Bimage p,
Complex< float > *  nufdata,
int  n,
long  hermx,
long  friedel,
long  oldx,
long  nux,
long  xo1,
long  xo2,
long  yo1,
long  yo2,
long  zo1,
long  zo2,
int  z_even,
int  y_even 
)

◆ 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 
)

Variable Documentation

◆ command

string command
extern

◆ month

const char* month[]
Initial value:
= {"Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"}

◆ verbose

int verbose
extern