<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<section xmlns="http://docbook.org/ns/docbook" version="5.0" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="_rwmg_i_m_o_d_8cpp">
<title>/Users/bernard/b20/bsoft/src/rwparam/rwmgIMOD.cpp File Reference</title>
<indexterm><primary>/Users/bernard/b20/bsoft/src/rwparam/rwmgIMOD.cpp</primary></indexterm>
<para>

<para>Converts between <link linkend="_struct_i_m_o_d">IMOD</link> files and a micrograph parameter file. </para>
 
</para>
<programlisting>#include &quot;rwmgIMOD.h&quot;
#include &quot;mg_img_proc.h&quot;
#include &quot;mg_tomography.h&quot;
#include &quot;rwmg.h&quot;
#include &quot;rwimg.h&quot;
#include &quot;linked_list.h&quot;
</programlisting><simplesect>
    <title>Functions    </title>
        <itemizedlist>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1ace19d82d5d8647bedd66e7b4a63090f7">read_imod_xf</link> (<link linkend="_class_bstring">Bstring</link> &amp;filename, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a96f7921366406abf224370eb04a36ca4">read_imod_tlt</link> (<link linkend="_class_bstring">Bstring</link> &amp;filename, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a17791f2922e2883cedc17c954d369489">read_imod_xyz</link> (<link linkend="_class_bstring">Bstring</link> &amp;filename, <link linkend="_struct_breconstruction">Breconstruction</link> *rec)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a59ce3649024659c89a421bb38447e5d8">read_imod_fid</link> (<link linkend="_class_bstring">Bstring</link> &amp;filename, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a4a8057029726537bfc7377fcfde66edb">read_project_imod</link> (<link linkend="_class_bstring">Bstring</link> *file_list, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>, int flag)</para>

<para>Creates a project structure using <link linkend="_struct_i_m_o_d">IMOD</link> parameters. </para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a899463eb15297fd671828e9069f42c8f">write_imod_xf</link> (<link linkend="_class_bstring">Bstring</link> &amp;imodfile, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a5ba2572db0fae8ca2f57bef93a9644ac">write_imod_tlt</link> (<link linkend="_class_bstring">Bstring</link> &amp;imodfile, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a7d720b775155572dc04af19828dfba4e">write_imod_xyz</link> (<link linkend="_class_bstring">Bstring</link> &amp;imodfile, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>
</listitem>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1ac708bb2bb6426a9c7e4c863678deebb9">write_project_imod</link> (<link linkend="_class_bstring">Bstring</link> &amp;imodfile, <link linkend="_struct_bproject">Bproject</link> *<link linkend="_tcltk__bmodel_8cpp_1aea438e09dfc03683a0f49a05e9a69cac">project</link>)</para>

<para>Creates <link linkend="_struct_i_m_o_d">IMOD</link> parameter files from a project structure. </para>
</listitem>
        </itemizedlist>
</simplesect>
<simplesect>
    <title>Variables    </title>
        <itemizedlist>
            <listitem><para>int <link linkend="_rwmg_i_m_o_d_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453">verbose</link></para>
</listitem>
        </itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>

<para>Converts between <link linkend="_struct_i_m_o_d">IMOD</link> files and a micrograph parameter file. </para>

<para><formalpara><title>Author: </title>

<para>Bernard Heymann </para>
</formalpara>
<formalpara><title>Date: </title>

<para>Created: 20070501 </para>

<para>Modified: 20170120 </para>
</formalpara>
</para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_rwmg_i_m_o_d_8cpp_1a59ce3649024659c89a421bb38447e5d8"/>    <section>
    <title>read_imod_fid()</title>
<indexterm><primary>read_imod_fid</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>read_imod_fid</secondary></indexterm>
<para><computeroutput>int read_imod_fid (<link linkend="_class_bstring">Bstring</link> &amp; filename, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 129 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a96f7921366406abf224370eb04a36ca4"/>    <section>
    <title>read_imod_tlt()</title>
<indexterm><primary>read_imod_tlt</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>read_imod_tlt</secondary></indexterm>
<para><computeroutput>int read_imod_tlt (<link linkend="_class_bstring">Bstring</link> &amp; filename, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 48 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1ace19d82d5d8647bedd66e7b4a63090f7"/>    <section>
    <title>read_imod_xf()</title>
<indexterm><primary>read_imod_xf</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>read_imod_xf</secondary></indexterm>
<para><computeroutput>int read_imod_xf (<link linkend="_class_bstring">Bstring</link> &amp; filename, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 20 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a17791f2922e2883cedc17c954d369489"/>    <section>
    <title>read_imod_xyz()</title>
<indexterm><primary>read_imod_xyz</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>read_imod_xyz</secondary></indexterm>
<para><computeroutput>int read_imod_xyz (<link linkend="_class_bstring">Bstring</link> &amp; filename, <link linkend="_struct_breconstruction">Breconstruction</link> * rec)</computeroutput></para><para>
Definition at line 74 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a4a8057029726537bfc7377fcfde66edb"/>    <section>
    <title>read_project_imod()</title>
<indexterm><primary>read_project_imod</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>read_project_imod</secondary></indexterm>
<para><computeroutput>int read_project_imod (<link linkend="_class_bstring">Bstring</link> * file_list, <link linkend="_struct_bproject">Bproject</link> * project, int flag)</computeroutput></para><para>

<para>Creates a project structure using <link linkend="_struct_i_m_o_d">IMOD</link> parameters. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>*file_list</entry>
                                <entry>
<para>list of <link linkend="_struct_i_m_o_d">IMOD</link> parameter file names. </para>
</entry>
                            </row>
                            <row>
                                <entry>*project</entry>
                                <entry>
<para>initialized project structure. </para>
</entry>
                            </row>
                            <row>
                                <entry>flag</entry>
                                <entry>
<para>flag to indicate conversion of the image file. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int error code (&lt;0 means failure). <literallayout><computeroutput>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
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 242 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a5ba2572db0fae8ca2f57bef93a9644ac"/>    <section>
    <title>write_imod_tlt()</title>
<indexterm><primary>write_imod_tlt</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>write_imod_tlt</secondary></indexterm>
<para><computeroutput>int write_imod_tlt (<link linkend="_class_bstring">Bstring</link> &amp; imodfile, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 373 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a899463eb15297fd671828e9069f42c8f"/>    <section>
    <title>write_imod_xf()</title>
<indexterm><primary>write_imod_xf</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>write_imod_xf</secondary></indexterm>
<para><computeroutput>int write_imod_xf (<link linkend="_class_bstring">Bstring</link> &amp; imodfile, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 334 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1a7d720b775155572dc04af19828dfba4e"/>    <section>
    <title>write_imod_xyz()</title>
<indexterm><primary>write_imod_xyz</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>write_imod_xyz</secondary></indexterm>
<para><computeroutput>int write_imod_xyz (<link linkend="_class_bstring">Bstring</link> &amp; imodfile, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>
Definition at line 395 of file rwmgIMOD.cpp.</para>
    </section><anchor xml:id="_rwmg_i_m_o_d_8cpp_1ac708bb2bb6426a9c7e4c863678deebb9"/>    <section>
    <title>write_project_imod()</title>
<indexterm><primary>write_project_imod</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>write_project_imod</secondary></indexterm>
<para><computeroutput>int write_project_imod (<link linkend="_class_bstring">Bstring</link> &amp; imodfile, <link linkend="_struct_bproject">Bproject</link> * project)</computeroutput></para><para>

<para>Creates <link linkend="_struct_i_m_o_d">IMOD</link> parameter files from a project structure. </para>
</para>

<para>
                <formalpara>
                    <title>
Parameters                    </title>
                    <para>
                    <table frame="all">
                        <tgroup cols="2" align="left" colsep="1" rowsep="1">
                        <colspec colwidth="1*"/>
                        <colspec colwidth="4*"/>
                        <tbody>
                            <row>
                                <entry>imodfile</entry>
                                <entry>
<para><link linkend="_struct_i_m_o_d">IMOD</link> parameter file name. </para>
</entry>
                            </row>
                            <row>
                                <entry>project</entry>
                                <entry>
<para>project structure. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int 0. <literallayout><computeroutput>Writes both .xf, .tlt and .xyz 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
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 451 of file rwmgIMOD.cpp.</para>
</section>
</section>
<section>
<title>Variable Documentation</title>
<anchor xml:id="_rwmg_i_m_o_d_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453"/>    <section>
    <title>verbose</title>
<indexterm><primary>verbose</primary><secondary>rwmgIMOD.cpp</secondary></indexterm>
<indexterm><primary>rwmgIMOD.cpp</primary><secondary>verbose</secondary></indexterm>
<para><computeroutput>int verbose</computeroutput></para></section>
</section>
</section>
