<?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="_model__mask_8cpp">
<title>/Users/bernard/b20/bsoft/src/model/model_mask.cpp File Reference</title>
<indexterm><primary>/Users/bernard/b20/bsoft/src/model/model_mask.cpp</primary></indexterm>
<para>

<para>Generating a mask from an atomic model. </para>
 
</para>
<programlisting>#include &quot;rwmodel.h&quot;
#include &quot;model_mask.h&quot;
#include &quot;model_shell.h&quot;
#include &quot;model_util.h&quot;
#include &quot;matrix_linear.h&quot;
#include &quot;Vector3.h&quot;
#include &quot;utilities.h&quot;
</programlisting><simplesect>
    <title>Functions    </title>
        <itemizedlist>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_model__mask_8cpp_1a81aa40856d71c1214324fec1908aae84">model_create_mask</link> (<link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, double edge)</para>

<para>Calculates a mask of the components and links of a model structure. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_model__mask_8cpp_1a95329723c1ea64cdc8b0234a50709373">model_create_hull_mask</link> (<link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, int curv_flag, int fast)</para>

<para>Calculates a mask based on the periphery of a model structure. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_model__mask_8cpp_1a58fac53333aaa3e51da0846b49b3555e">model_create_shell_mask</link> (<link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, double shell_width, int curv_flag, int fast)</para>

<para>Calculates a shell mask covering a model structure. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_model__mask_8cpp_1a474c356aee8d0c85182f92267bf78dba">model_create_level_mask</link> (<link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam)</para>

<para>Calculates a mask with one level per model. </para>
</listitem>
            <listitem><para><link linkend="_class_bimage">Bimage</link> * <link linkend="_model__mask_8cpp_1a4a48300d2f5af8cc30ded5214a2b2b28">img_extract_segments_using_model</link> (<link linkend="_class_bimage">Bimage</link> *p, <link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>, int multi_level)</para>

<para>Extracts segmentss from a multi-level mask around points defined by a model. </para>
</listitem>
            <listitem><para>int <link linkend="_model__mask_8cpp_1af27b595a057e101220bd38691d017f90">img_add_model_to_mask</link> (<link linkend="_class_bimage">Bimage</link> *p, <link linkend="_struct_bmodel">Bmodel</link> *<link linkend="_tcltk__bmodel_8cpp_1a828359eaa8de833b547ac96934f43841">model</link>)</para>

<para>Adds to the mask the component locations. </para>
</listitem>
            <listitem><para><link linkend="_struct_bmodel">Bmodel</link> * <link linkend="_model__mask_8cpp_1add86cacf326555745b8608dec1170095">model_from_multilevel_mask</link> (<link linkend="_class_bimage">Bimage</link> *p)</para>

<para>Generates components at the center of mass of each mask level. </para>
</listitem>
        </itemizedlist>
</simplesect>
<simplesect>
    <title>Variables    </title>
        <itemizedlist>
            <listitem><para>int <link linkend="_model__mask_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453">verbose</link></para>
</listitem>
        </itemizedlist>
</simplesect>
<section>
<title>Detailed Description</title>

<para>Generating a mask from an atomic model. </para>

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

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

<para>Created: 20060301 </para>

<para>Modified: 20111031 </para>
</formalpara>
</para>
</section>
<section>
<title>Function Documentation</title>
<anchor xml:id="_model__mask_8cpp_1af27b595a057e101220bd38691d017f90"/>    <section>
    <title>img_add_model_to_mask()</title>
<indexterm><primary>img_add_model_to_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>img_add_model_to_mask</secondary></indexterm>
<para><computeroutput>int img_add_model_to_mask (<link linkend="_class_bimage">Bimage</link> * p, <link linkend="_struct_bmodel">Bmodel</link> * model)</computeroutput></para><para>

<para>Adds to the mask the component locations. </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>*p</entry>
                                <entry>
<para>mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>*model</entry>
                                <entry>
<para>model. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>int 0, &lt;0 on error. <literallayout><computeroutput>At each component location, the voxel is added to the mask.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 405 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1a4a48300d2f5af8cc30ded5214a2b2b28"/>    <section>
    <title>img_extract_segments_using_model()</title>
<indexterm><primary>img_extract_segments_using_model</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>img_extract_segments_using_model</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* img_extract_segments_using_model (<link linkend="_class_bimage">Bimage</link> * p, <link linkend="_struct_bmodel">Bmodel</link> * model, int multi_level)</computeroutput></para><para>

<para>Extracts segmentss from a multi-level mask around points defined by a model. </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>*p</entry>
                                <entry>
<para>multi-level mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>*model</entry>
                                <entry>
<para>model marking regions in mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>multi_level</entry>
                                <entry>
<para>flag to retain multiple levels. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* new mask from marked segments. <literallayout><computeroutput>Each segment should only be marked by a maximum of one component.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 334 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1a95329723c1ea64cdc8b0234a50709373"/>    <section>
    <title>model_create_hull_mask()</title>
<indexterm><primary>model_create_hull_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>model_create_hull_mask</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* model_create_hull_mask (<link linkend="_struct_bmodel">Bmodel</link> * model, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, int curv_flag, int fast)</computeroutput></para><para>

<para>Calculates a mask based on the periphery of a model 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>*model</entry>
                                <entry>
<para>model structure. </para>
</entry>
                            </row>
                            <row>
                                <entry>size</entry>
                                <entry>
<para>size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>ori</entry>
                                <entry>
<para>origin of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>sam</entry>
                                <entry>
<para>pixel size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>curv_flag</entry>
                                <entry>
<para>flag to indicate curved surface. </para>
</entry>
                            </row>
                            <row>
                                <entry>fast</entry>
                                <entry>
<para>flag to use fast algorithm. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* new mask. <literallayout><computeroutput>Each point in the new image is tested for inclusion in the mask,
by calculating whether it falls inside the closest 3 vertices.
Only the first model in the linked list is used.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 103 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1a474c356aee8d0c85182f92267bf78dba"/>    <section>
    <title>model_create_level_mask()</title>
<indexterm><primary>model_create_level_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>model_create_level_mask</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* model_create_level_mask (<link linkend="_struct_bmodel">Bmodel</link> * model, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam)</computeroutput></para><para>

<para>Calculates a mask with one level per model. </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>*model</entry>
                                <entry>
<para>model structure. </para>
</entry>
                            </row>
                            <row>
                                <entry>size</entry>
                                <entry>
<para>size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>ori</entry>
                                <entry>
<para>origin of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>sam</entry>
                                <entry>
<para>pixel size of the new mask. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* new mask. <literallayout><computeroutput>A level is defined as those voxels closest to the vertices of one model.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 285 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1a81aa40856d71c1214324fec1908aae84"/>    <section>
    <title>model_create_mask()</title>
<indexterm><primary>model_create_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>model_create_mask</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* model_create_mask (<link linkend="_struct_bmodel">Bmodel</link> * model, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, double edge)</computeroutput></para><para>

<para>Calculates a mask of the components and links of a model 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>*model</entry>
                                <entry>
<para>model structure. </para>
</entry>
                            </row>
                            <row>
                                <entry>size</entry>
                                <entry>
<para>size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>ori</entry>
                                <entry>
<para>origin of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>sam</entry>
                                <entry>
<para>pixel size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>edge</entry>
                                <entry>
<para>edge width in angstrom. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* new mask. <literallayout><computeroutput>Each component is used to generate a sphere and each link a bar.
Only the first model in the linked list is used.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 34 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1a58fac53333aaa3e51da0846b49b3555e"/>    <section>
    <title>model_create_shell_mask()</title>
<indexterm><primary>model_create_shell_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>model_create_shell_mask</secondary></indexterm>
<para><computeroutput><link linkend="_class_bimage">Bimage</link>* model_create_shell_mask (<link linkend="_struct_bmodel">Bmodel</link> * model, <link linkend="_class_vector3">Vector3</link>&lt; long &gt; size, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; ori, <link linkend="_class_vector3">Vector3</link>&lt; double &gt; sam, double shell_width, int curv_flag, int fast)</computeroutput></para><para>

<para>Calculates a shell mask covering a model 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>*model</entry>
                                <entry>
<para>model structure. </para>
</entry>
                            </row>
                            <row>
                                <entry>size</entry>
                                <entry>
<para>size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>ori</entry>
                                <entry>
<para>origin of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>sam</entry>
                                <entry>
<para>pixel size of the new mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>shell_width</entry>
                                <entry>
<para>width of shell mask. </para>
</entry>
                            </row>
                            <row>
                                <entry>curv_flag</entry>
                                <entry>
<para>flag to indicate curved surface. </para>
</entry>
                            </row>
                            <row>
                                <entry>fast</entry>
                                <entry>
<para>flag to use fast algorithm. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bimage* new mask. <literallayout><computeroutput>Each point in the new image is tested for inclusion in the mask,
by calculating whether it falls inside the closest 3 vertices.
Only the first model in the linked list is used.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 191 of file model_mask.cpp.</para>
    </section><anchor xml:id="_model__mask_8cpp_1add86cacf326555745b8608dec1170095"/>    <section>
    <title>model_from_multilevel_mask()</title>
<indexterm><primary>model_from_multilevel_mask</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>model_from_multilevel_mask</secondary></indexterm>
<para><computeroutput><link linkend="_struct_bmodel">Bmodel</link>* model_from_multilevel_mask (<link linkend="_class_bimage">Bimage</link> * p)</computeroutput></para><para>

<para>Generates components at the center of mass of each mask level. </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>*p</entry>
                                <entry>
<para>multi-level mask. </para>
</entry>
                            </row>
                        </tbody>
                        </tgroup>
                    </table>
                    </para>
                </formalpara>
                <formalpara><title>Returns: </title>

<para>Bmodel* new model. <literallayout><computeroutput>The mask is expected to be of integer data type.
</computeroutput></literallayout> </para>
</formalpara>
</para>
<para>
Definition at line 452 of file model_mask.cpp.</para>
</section>
</section>
<section>
<title>Variable Documentation</title>
<anchor xml:id="_model__mask_8cpp_1a0b2caeb4b6f130be43e5a2f0267dd453"/>    <section>
    <title>verbose</title>
<indexterm><primary>verbose</primary><secondary>model_mask.cpp</secondary></indexterm>
<indexterm><primary>model_mask.cpp</primary><secondary>verbose</secondary></indexterm>
<para><computeroutput>int verbose</computeroutput></para></section>
</section>
</section>
