• R/O
  • HTTP
  • SSH
  • HTTPS

tutorial: Commit

This repository is for tutorials of Eos.


Commit MetaInfo

Revisiond6999ef874758b552544b652760d52383f3d51e0 (tree)
Time2014-12-03 17:35:14
Authorkinoshita-eos <kinoshita@yasu...>
Commiterkinoshita-eos

Log Message

Add: toturial for PIONE advanced2 about interactive
new file: SampleCode/PIONE/Advanced2/Annotation.pione
new file: SampleCode/PIONE/Advanced2/Interaction.pione
new file: SampleCode/PIONE/Advanced2/Main.pione
new file: SampleCode/PIONE/Advanced2/bin/mrcImageLowPassFilter.cgi
new file: SampleCode/PIONE/Advanced2/etc/index.html
new file: SampleCode/PIONE/Advanced2/etc/mrcImageLowPassFilter.html
new file: SampleData/1VOM-N.2d

Change Summary

Incremental Difference

--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/Annotation.pione
@@ -0,0 +1,3 @@
1+.@ PackageName :: "LowPassFilter"
2+.@ Editor :: "Kinoshita"
3+.@ Tag :: "v0.1.0"
--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/Interaction.pione
@@ -0,0 +1,13 @@
1+Rule Interaction
2+ output '*.*'.all
3+Action
4+ # build public directory for pione-interactive
5+ mkdir public
6+ cp etc/* public
7+ cp bin/* public
8+
9+ # start interactive operation
10+ pione-interactive browser --public public
11+
12+ cp public/* .
13+End
--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/Main.pione
@@ -0,0 +1,5 @@
1+Rule Main
2+ output '*.lpf'.all
3+Flow
4+ rule Interaction
5+End
--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/bin/mrcImageLowPassFilter.cgi
@@ -0,0 +1,136 @@
1+#!/usr/bin/env ruby
2+
3+require 'cgi'
4+
5+cgi = CGI.new
6+
7+### Header
8+HTMLstr = ""
9+HTMLstr += "<!DOCTYPE html>"
10+HTMLstr += "<html>"
11+HTMLstr += "<head>"
12+HTMLstr += "<title>mrcImageLowPassFilter</title>"
13+HTMLstr += "</head>"
14+
15+HTMLstr += "<body>"
16+
17+### Close or Back
18+HTMLstr += '<a href="?pione-action=finish">Close</a>'
19+HTMLstr += "<br>"
20+HTMLstr += '<a href="mrcImageLowPassFilter.html">Back</a>'
21+HTMLstr += "<br>"
22+HTMLstr += "<br>"
23+
24+
25+# Main Process
26+
27+## Query to Parameters
28+
29+### Copy InputFile
30+fpQueryInputFile = cgi.params['InputFile'][0]
31+strInputFile = fpQueryInputFile.original_filename
32+fpInputFile = open(strInputFile, "wb")
33+fpInputFile.write(fpQueryInputFile.read)
34+fpInputFile.close
35+
36+### Other Query
37+strOutputFile = cgi['OutputFile']
38+strHalfValuePoint = cgi['HalfValuePoint']
39+strWecth = cgi['Width']
40+strMode = cgi['Mode']
41+
42+### mrcImageLowPassFilter
43+command = "mrcImageLowPassFilter"
44+command += ' -i "' + strInputFile + '"'
45+command += ' -o "' + strOutputFile + '"'
46+command += ' -hvp "' + strHalfValuePoint + '"'
47+command += ' -w "' + strWecth + '"'
48+command += ' -m "' + strMode + '"'
49+system(command)
50+
51+### mrc2gif
52+#### For input
53+strGifInputFile = strInputFile + ".gif"
54+command = "mrc2gif"
55+command += ' -i "' + strInputFile + '"'
56+command += ' -o "' + strGifInputFile + '"'
57+system(command)
58+
59+#### For output
60+strGifOutputFile = strOutputFile + ".gif"
61+command = "mrc2gif"
62+command += ' -i "' + strOutputFile + '"'
63+command += ' -o "' + strGifOutputFile + '"'
64+system(command)
65+
66+### mrcImageInfo
67+#### For input
68+strInfoInputFile = strInputFile + ".info"
69+command = "mrcImageInfo"
70+command += ' -I'
71+command += ' -i "' + strInputFile + '"'
72+command += ' -o "' + strInfoInputFile + '"'
73+system(command)
74+
75+#### For output
76+strInfoOutputFile = strOutputFile + ".info"
77+command = "mrcImageInfo"
78+command += ' -I'
79+command += ' -i "' + strOutputFile + '"'
80+command += ' -o "' + strInfoOutputFile + '"'
81+system(command)
82+
83+
84+## View as HTML Statement
85+
86+### Table
87+HTMLstr += "<table>"
88+
89+#### Title
90+HTMLstr += "<tr>"
91+HTMLstr += "<td>" + strInputFile + "</td>"
92+HTMLstr += "<td>" + strOutputFile + "</td>"
93+HTMLstr += "</tr>"
94+
95+#### GifImage
96+##### For Input
97+HTMLstr += "<tr>"
98+HTMLstr += "<td>"
99+HTMLstr += '<img src="' + strGifInputFile + '">'
100+HTMLstr += "</td>"
101+##### For Output
102+HTMLstr += "<td>"
103+HTMLstr += '<img src="' + strGifOutputFile + '">'
104+HTMLstr += "</td>"
105+HTMLstr += "</tr>"
106+
107+#### mrcImageInfo
108+##### For Input
109+HTMLstr += "<tr>"
110+HTMLstr += "<td>"
111+fpInfoInputFile = open(strInfoInputFile, "r")
112+fpInfoInputFile.each do |line|
113+ HTMLstr += line + "<br>"
114+end
115+fpInfoInputFile.close
116+HTMLstr += "</td>"
117+##### For Output
118+HTMLstr += "<td>"
119+fpInfoOutputFile = open(strInfoOutputFile, "r")
120+fpInfoOutputFile.each do |line|
121+ HTMLstr += line + "<br>"
122+end
123+fpInfoOutputFile.close
124+HTMLstr += "</td>"
125+HTMLstr += "</tr>"
126+
127+HTMLstr += "</table>"
128+
129+
130+HTMLstr += "</body>"
131+HTMLstr += "</html>"
132+
133+# Output as html
134+cgi.out(type: "text/html") do
135+ HTMLstr
136+end
--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/etc/index.html
@@ -0,0 +1,13 @@
1+<!DOCTYPE html>
2+<html>
3+ <head>
4+ <meta charset="utf-8">
5+ <title>InteractiveCommand Index Page</title>
6+ </head>
7+ <body>
8+ <a href="mrcImageLowPassFilter.html">mrcImageLowPassFilter</a>
9+ <br>
10+ <br>
11+ <a href="?pione-action=finish">終了</a>
12+ </body>
13+</html>
\ No newline at end of file
--- /dev/null
+++ b/SampleCode/PIONE/Advanced2/etc/mrcImageLowPassFilter.html
@@ -0,0 +1,64 @@
1+<!DOCTYPE html>
2+<html>
3+ <head>
4+ <meta charset="utf-8">
5+ <title>mrcImageLowPassFilter</title>
6+ </head>
7+ <body>
8+ <form action="mrcImageLowPassFilter.cgi" method="post" enctype="multipart/form-data">
9+ <button type="submit">開始</button>
10+ <br>
11+ <table>
12+ <tr>
13+ <td>
14+ <input type="file" name="InputFile"/>
15+ </td>
16+ <td>
17+ 入力ファイル名(-i)
18+ </td>
19+ </tr>
20+ <tr>
21+ <td>
22+ <input type="text" name="OutputFile" value="outdata.lpf"/>
23+ </td>
24+ <td>
25+ 出力ファイル名(-o)
26+ </td>
27+ </tr>
28+ <tr>
29+ <td>
30+ <input type="text" name="HalfValuePoint" value="1.0"/>
31+ </td>
32+ <td>
33+ HalfValuePoint[A-1] (強度を半分に落とす空間周波数を示す)(-hvp)
34+ </td>
35+ </tr>
36+ <tr>
37+ <td>
38+ <input type="text" name="Width" value="1.0"/>
39+ </td>
40+ <td>
41+ 空間周波数のcos関数の幅を設定(-w)
42+ </td>
43+ </tr>
44+ <tr>
45+ <td>
46+ <select name="Mode">
47+ <option value="1">1: ステップフィルタ</option>
48+ <option value="2">2: cosフィルタ</option>
49+ <option value="3">3: expフィルタ</option>
50+ <option value="4">4: ガウシアンフィルタ</option>
51+ <option value="5">5: ローレンツ型フィルタ</option>
52+ </select>
53+ </td>
54+ <td>
55+ モード(-m)
56+ </td>
57+ </tr>
58+ </table>
59+ </form>
60+ <br>
61+ <br>
62+ <a href="?pione-action=finish">終了</a>
63+ </body>
64+</html>
\ No newline at end of file
Binary files /dev/null and b/SampleData/1VOM-N.2d differ
Show on old repository browser