OSDN Git Service

Add: toturial for PIONE advanced2 about interactive v2.0.2p0073
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 3 Dec 2014 08:35:14 +0000 (17:35 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 3 Dec 2014 08:35:14 +0000 (17:35 +0900)
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

SampleCode/PIONE/Advanced2/Annotation.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced2/Interaction.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced2/Main.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced2/bin/mrcImageLowPassFilter.cgi [new file with mode: 0644]
SampleCode/PIONE/Advanced2/etc/index.html [new file with mode: 0644]
SampleCode/PIONE/Advanced2/etc/mrcImageLowPassFilter.html [new file with mode: 0644]
SampleData/1VOM-N.2d [new file with mode: 0644]

diff --git a/SampleCode/PIONE/Advanced2/Annotation.pione b/SampleCode/PIONE/Advanced2/Annotation.pione
new file mode 100644 (file)
index 0000000..2b51e11
--- /dev/null
@@ -0,0 +1,3 @@
+.@ PackageName :: "LowPassFilter"
+.@ Editor              :: "Kinoshita"
+.@ Tag                 :: "v0.1.0"
diff --git a/SampleCode/PIONE/Advanced2/Interaction.pione b/SampleCode/PIONE/Advanced2/Interaction.pione
new file mode 100644 (file)
index 0000000..965793b
--- /dev/null
@@ -0,0 +1,13 @@
+Rule Interaction
+       output '*.*'.all
+Action
+       # build public directory for pione-interactive
+       mkdir public
+       cp etc/* public
+       cp bin/* public
+
+       # start interactive operation
+       pione-interactive browser --public public
+
+       cp public/* .
+End
diff --git a/SampleCode/PIONE/Advanced2/Main.pione b/SampleCode/PIONE/Advanced2/Main.pione
new file mode 100644 (file)
index 0000000..a8ea842
--- /dev/null
@@ -0,0 +1,5 @@
+Rule Main
+       output '*.lpf'.all
+Flow
+       rule Interaction
+End
diff --git a/SampleCode/PIONE/Advanced2/bin/mrcImageLowPassFilter.cgi b/SampleCode/PIONE/Advanced2/bin/mrcImageLowPassFilter.cgi
new file mode 100644 (file)
index 0000000..1fe3bb8
--- /dev/null
@@ -0,0 +1,136 @@
+#!/usr/bin/env ruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+### Header
+HTMLstr = ""
+HTMLstr += "<!DOCTYPE html>"
+HTMLstr += "<html>"
+HTMLstr += "<head>"
+HTMLstr += "<title>mrcImageLowPassFilter</title>"
+HTMLstr += "</head>"
+
+HTMLstr += "<body>"
+
+### Close or Back
+HTMLstr += '<a href="?pione-action=finish">Close</a>'
+HTMLstr += "<br>"
+HTMLstr += '<a href="mrcImageLowPassFilter.html">Back</a>'
+HTMLstr += "<br>"
+HTMLstr += "<br>"
+
+
+# Main Process
+
+## Query to Parameters
+
+### Copy InputFile
+fpQueryInputFile = cgi.params['InputFile'][0]
+strInputFile = fpQueryInputFile.original_filename
+fpInputFile = open(strInputFile, "wb")
+fpInputFile.write(fpQueryInputFile.read)
+fpInputFile.close
+
+### Other Query
+strOutputFile = cgi['OutputFile']
+strHalfValuePoint = cgi['HalfValuePoint']
+strWecth = cgi['Width']
+strMode = cgi['Mode']
+
+### mrcImageLowPassFilter
+command = "mrcImageLowPassFilter"
+command += ' -i "' + strInputFile + '"'
+command += ' -o "' + strOutputFile + '"'
+command += ' -hvp "' + strHalfValuePoint + '"'
+command += ' -w "' + strWecth + '"'
+command += ' -m "' + strMode + '"'
+system(command)
+
+### mrc2gif
+#### For input
+strGifInputFile = strInputFile + ".gif"
+command = "mrc2gif"
+command += ' -i "' + strInputFile + '"'
+command += ' -o "' + strGifInputFile + '"'
+system(command)
+
+#### For output
+strGifOutputFile = strOutputFile + ".gif"
+command = "mrc2gif"
+command += ' -i "' + strOutputFile + '"'
+command += ' -o "' + strGifOutputFile + '"'
+system(command)
+
+### mrcImageInfo
+#### For input
+strInfoInputFile = strInputFile + ".info"
+command = "mrcImageInfo"
+command += ' -I'
+command += ' -i "' + strInputFile + '"'
+command += ' -o "' + strInfoInputFile + '"'
+system(command)
+
+#### For output
+strInfoOutputFile = strOutputFile + ".info"
+command = "mrcImageInfo"
+command += ' -I'
+command += ' -i "' + strOutputFile + '"'
+command += ' -o "' + strInfoOutputFile + '"'
+system(command)
+
+
+## View as HTML Statement
+
+### Table
+HTMLstr += "<table>"
+
+#### Title
+HTMLstr += "<tr>"
+HTMLstr += "<td>" + strInputFile + "</td>"
+HTMLstr += "<td>" + strOutputFile + "</td>"
+HTMLstr += "</tr>"
+
+#### GifImage
+##### For Input
+HTMLstr += "<tr>"
+HTMLstr += "<td>"
+HTMLstr += '<img src="' + strGifInputFile + '">'
+HTMLstr += "</td>"
+##### For Output
+HTMLstr += "<td>"
+HTMLstr += '<img src="' + strGifOutputFile + '">'
+HTMLstr += "</td>"
+HTMLstr += "</tr>"
+
+#### mrcImageInfo
+##### For Input
+HTMLstr += "<tr>"
+HTMLstr += "<td>"
+fpInfoInputFile = open(strInfoInputFile, "r")
+fpInfoInputFile.each do |line|
+       HTMLstr += line + "<br>"
+end
+fpInfoInputFile.close
+HTMLstr += "</td>"
+##### For Output
+HTMLstr += "<td>"
+fpInfoOutputFile = open(strInfoOutputFile, "r")
+fpInfoOutputFile.each do |line|
+       HTMLstr += line + "<br>"
+end
+fpInfoOutputFile.close
+HTMLstr += "</td>"
+HTMLstr += "</tr>"
+
+HTMLstr += "</table>"
+
+
+HTMLstr += "</body>"
+HTMLstr += "</html>"
+
+# Output as html
+cgi.out(type: "text/html") do
+       HTMLstr
+end
diff --git a/SampleCode/PIONE/Advanced2/etc/index.html b/SampleCode/PIONE/Advanced2/etc/index.html
new file mode 100644 (file)
index 0000000..36ff7d3
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>InteractiveCommand Index Page</title>
+       </head>
+       <body>
+               <a href="mrcImageLowPassFilter.html">mrcImageLowPassFilter</a>
+               <br>
+               <br>
+               <a href="?pione-action=finish">終了</a>
+       </body>
+</html>
\ No newline at end of file
diff --git a/SampleCode/PIONE/Advanced2/etc/mrcImageLowPassFilter.html b/SampleCode/PIONE/Advanced2/etc/mrcImageLowPassFilter.html
new file mode 100644 (file)
index 0000000..9bdc3b6
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>mrcImageLowPassFilter</title>
+       </head>
+       <body>
+               <form action="mrcImageLowPassFilter.cgi" method="post" enctype="multipart/form-data">
+                       <button type="submit">開始</button>
+                       <br>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <input type="file" name="InputFile"/>
+                                       </td>
+                                       <td>
+                                               入力ファイル名(-i)
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <input type="text" name="OutputFile" value="outdata.lpf"/>
+                                       </td>
+                                       <td>
+                                               出力ファイル名(-o)
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <input type="text" name="HalfValuePoint" value="1.0"/>
+                                       </td>
+                                       <td>
+                                               HalfValuePoint[A-1] (強度を半分に落とす空間周波数を示す)(-hvp)
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <input type="text" name="Width" value="1.0"/>
+                                       </td>
+                                       <td>
+                                               空間周波数のcos関数の幅を設定(-w)
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <select name="Mode">
+                                                       <option value="1">1: ステップフィルタ</option>
+                                                       <option value="2">2: cosフィルタ</option>
+                                                       <option value="3">3: expフィルタ</option>
+                                                       <option value="4">4: ガウシアンフィルタ</option>
+                                                       <option value="5">5: ローレンツ型フィルタ</option>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               モード(-m)
+                                       </td>
+                               </tr>
+                       </table>
+               </form>
+               <br>
+               <br>
+               <a href="?pione-action=finish">終了</a>
+       </body>
+</html>
\ No newline at end of file
diff --git a/SampleData/1VOM-N.2d b/SampleData/1VOM-N.2d
new file mode 100644 (file)
index 0000000..e17060e
Binary files /dev/null and b/SampleData/1VOM-N.2d differ