<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/index.php?action=history&amp;feed=atom&amp;title=Introduction_of_small_tools</id>
		<title>Introduction of small tools - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/index.php?action=history&amp;feed=atom&amp;title=Introduction_of_small_tools"/>
		<link rel="alternate" type="text/html" href="http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/index.php?title=Introduction_of_small_tools&amp;action=history"/>
		<updated>2026-04-30T16:06:10Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.6</generator>

	<entry>
		<id>http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/index.php?title=Introduction_of_small_tools&amp;diff=4049&amp;oldid=prev</id>
		<title>Kinoshita: Created page with &quot;First, show how to write basic main function.  &lt;pre&gt; Tool.c  #include &quot;../inc/Tool.h&quot; #include &quot;genUtil.h&quot; #include &quot;mrcImage.h&quot;  int main(int argc, char* argv[]) {     ToolIn...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.yasunaga-lab.bio.kyutech.ac.jp/Eos/index.php?title=Introduction_of_small_tools&amp;diff=4049&amp;oldid=prev"/>
				<updated>2014-09-26T00:22:06Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;First, show how to write basic main function.  &amp;lt;pre&amp;gt; Tool.c  #include &amp;quot;../inc/Tool.h&amp;quot; #include &amp;quot;genUtil.h&amp;quot; #include &amp;quot;mrcImage.h&amp;quot;  int main(int argc, char* argv[]) {     ToolIn...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;First, show how to write basic main function.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Tool.c&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;../inc/Tool.h&amp;quot;&lt;br /&gt;
#include &amp;quot;genUtil.h&amp;quot;&lt;br /&gt;
#include &amp;quot;mrcImage.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
int&lt;br /&gt;
main(int argc, char* argv[])&lt;br /&gt;
{&lt;br /&gt;
    ToolInfo info;    // struct that stores information from argument&lt;br /&gt;
    lToolInfo linfo;  // struct that stores information for API&lt;br /&gt;
    mrcImage in;      // [[mrcImage]] as input&lt;br /&gt;
    mrcImage out;     // [[mrcImage]] as output&lt;br /&gt;
&lt;br /&gt;
    // 3 function set that are provided as prototype.&lt;br /&gt;
    init0(&amp;amp;info); 　　　　　　　　　　　// Initial Setting&lt;br /&gt;
    argCheck(&amp;amp;info, argc, argv);　　　　// Pass the value from argument.&lt;br /&gt;
    init1(&amp;amp;info);　　　　　　　　　　　 // Work depending on argument information: e.g. file open or close&lt;br /&gt;
&lt;br /&gt;
    mrcFileRead(&amp;amp;in, info.In, &amp;quot;in main&amp;quot;, 0);   // File read&lt;br /&gt;
&lt;br /&gt;
　　lTool(&amp;amp;out, &amp;amp;in, &amp;amp;linfo, info.mode);       // Process &amp;quot;in&amp;quot;, and Create &amp;quot;out&amp;quot;.&lt;br /&gt;
　　　　　　　　　　　　　　　　　　　　　　　 // Generally, function whose first letter is &amp;quot;l&amp;quot; is image process library.&lt;br /&gt;
&lt;br /&gt;
    mrcFileWrite(&amp;amp;out, info.Out, &amp;quot;in main&amp;quot;, 0); // File write&lt;br /&gt;
   &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next, show how to write basic image process library. Here, show how to write the program that performs projection along z axis.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lTool.c&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;./lTool.h&amp;quot;&lt;br /&gt;
#include &amp;quot;genUtil.h&amp;quot;&lt;br /&gt;
#include &amp;quot;mrcImage.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
void&lt;br /&gt;
lTool(mrcImage* out, mrcImage* in, lToolInfo* linfo, int status)&lt;br /&gt;
{&lt;br /&gt;
    mrcImageParaTypeReal x, y, z;    // Variable that expresses pixel coordinates&lt;br /&gt;
    double src, dst;                     // Store the value of pixel&lt;br /&gt;
&lt;br /&gt;
    out-&amp;gt;Header = in-&amp;gt;Header;        // Make same format of output image as input image.&lt;br /&gt;
　　out-&amp;gt;HeaderN.z = 1;              // For Example, deal as 1 pixel data about along z axis.&lt;br /&gt;
    mrcInit(&amp;amp;out, NULL);             // Secure the memory region for output image.&lt;br /&gt;
&lt;br /&gt;
    for(z=0; z&amp;lt;in-&amp;gt;HeaderN.z; z++)｛&lt;br /&gt;
    for(y=0; y&amp;lt;in-&amp;gt;HeaderN.y; y++)｛&lt;br /&gt;
    for(x=0; x&amp;lt;in-&amp;gt;HeaderN.x; x++)｛&lt;br /&gt;
        // Get the value of pixel.&lt;br /&gt;
        mrcPixelDataGet(in,  x, y, z, &amp;amp;src, mrcPixelRePart, mrcPixelHowNearest);&lt;br /&gt;
        mrcPixelDataGet(out, x, y, 0, &amp;amp;dst, mrcPixelRePart, mrcPixelHowNearest);&lt;br /&gt;
&lt;br /&gt;
        // Add the value of pixel.&lt;br /&gt;
        dst += src;&lt;br /&gt;
&lt;br /&gt;
        // Set a new value of pixel.&lt;br /&gt;
        mrcPixelDataSet(out, x, y, 0,  dst, mrcPixelRePart);&lt;br /&gt;
　  } &lt;br /&gt;
    }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Kinoshita</name></author>	</entry>

	</feed>