Bsoft  2.0.0
Bernard's software package
mg2imod.cpp File Reference

Converts between IMOD files and a micrograph parameter file. More...

#include "mg_processing.h"
#include "mg_img_proc.h"
#include "mg_tomography.h"
#include "rwmg.h"
#include "rwimg.h"
#include "linked_list.h"
#include "utilities.h"
#include "options.h"
#include "timer.h"

Go to the source code of this file.

Classes

struct  IMOD
 
struct  OBJT
 
struct  CONT
 

Macros

#define IMODSIZE   232
 
#define OBJTSIZE   176
 
#define CONTSIZE   16
 

Functions

Bproject * project_from_IMOD (Bstring *file_list, int flag)
 Creates a project structure using IMOD parameters. More...
 
int write_IMOD_parameters (Bstring &imodfile, Bproject *project)
 Creates IMOD parameter files from a project structure. More...
 
int main (int argc, char **argv)
 
int read_imod_xf (Bstring &filename, Bproject *project)
 
int read_imod_tlt (Bstring &filename, Bproject *project)
 
int read_imod_xyz (Bstring &filename, Breconstruction *rec)
 
int read_imod_fid (Bstring &filename, Bproject *project)
 

Variables

int verbose
 
const char * use []
 

Detailed Description

Converts between IMOD files and a micrograph parameter file.

Author
Bernard Heymann
Date
Created: 20070501
Modified: 20150130
Compile with:
    g++ mg2imod.cpp -o mg2imod -I$BSOFT/include -L$BSOFT/lib -lbsoft -DHAVE_FFTW3
Compile on Mac OS X 10.7+:
    clang++ mg2imod.cpp -o mg2imod -I$BSOFT/include -L$BSOFT/lib -lbsoft -DHAVE_FFTW3

Definition in file mg2imod.cpp.

Macro Definition Documentation

◆ CONTSIZE

#define CONTSIZE   16

Definition at line 29 of file mg2imod.cpp.

◆ IMODSIZE

#define IMODSIZE   232

Definition at line 27 of file mg2imod.cpp.

◆ OBJTSIZE

#define OBJTSIZE   176

Definition at line 28 of file mg2imod.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 185 of file mg2imod.cpp.

◆ project_from_IMOD()

Bproject* project_from_IMOD ( Bstring *  file_list,
int  flag 
)

Creates a project structure using IMOD parameters.

Parameters
file_listlist of IMOD parameter file names.
flagflag to indicate conversion of the image file.
Returns
project new project parameter structure.
Requirements:
    Tilt series micrograph image (if 3D then converted to multi-2D)
    2D transform file (.xf)
    Tilt angle file (.tlt)
Calculations:
    Tilt angle: from tilt angle file
    Tilt axis: ta = (atan2(-A11, A12) + atan2(-A22, -A21))/2
    Mg origin: o = on - Ad
where
    A:  2x2 transformation matrix
    ta: tilt axis angle
    on: nominal micrograph origin (center of mg)
    o:  aligned micrograph origin
    d:  shift for micrograph

Definition at line 468 of file mg2imod.cpp.

◆ read_imod_fid()

int read_imod_fid ( Bstring &  filename,
Bproject *  project 
)

Definition at line 357 of file mg2imod.cpp.

◆ read_imod_tlt()

int read_imod_tlt ( Bstring &  filename,
Bproject *  project 
)

Definition at line 281 of file mg2imod.cpp.

◆ read_imod_xf()

int read_imod_xf ( Bstring &  filename,
Bproject *  project 
)

Definition at line 254 of file mg2imod.cpp.

◆ read_imod_xyz()

int read_imod_xyz ( Bstring &  filename,
Breconstruction *  rec 
)

Definition at line 306 of file mg2imod.cpp.

◆ write_IMOD_parameters()

int write_IMOD_parameters ( Bstring &  imodfile,
Bproject *  project 
)

Creates IMOD parameter files from a project structure.

Parameters
imodfileIMOD parameter file name.
projectproject structure.
Returns
0.
Writes both .xf and .tlt files.
Calculations:
    Tilt angle: from micrograph tilt angle
    Matrix: A = {cos(ta), -sin(ta), sin(ta), cos(ta)}
    Shift:  d = o - on
where
    A:  2x2 transformation matrix
    ta: tilt axis angle
    on: nominal micrograph origin (center of mg)
    o:  aligned micrograph origin
    d:  shift for micrograph

Definition at line 577 of file mg2imod.cpp.

Variable Documentation

◆ use

const char* use[]
Initial value:
= {
" ",
"Usage: mg2imod [options] input.mrc input.xf input.tlt input.fid input.xyz",
"-------------------------------------------------------------------------",
"Converts between IMOD files and a micrograph parameter file.",
" ",
"Actions:",
"-topif Flag to convert the image file to multi-image PIF (default not).",
" ",
"Parameters:",
"-verbose 7 Verbosity of output.",
"-sampling 1.5 Sampling (A/pixel).",
" ",
"Output:",
"-output file.star Output micrograph parameter file.",
"-imod file.xf Output IMOD parameter files.",
" ",
NULL
}

Definition at line 164 of file mg2imod.cpp.

◆ verbose

int verbose