OSDN Git Service

Add: PIONE tutorial to create ref2d file. v2.0.2p0081
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 7 Jan 2015 10:02:52 +0000 (19:02 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 7 Jan 2015 10:02:52 +0000 (19:02 +0900)
new file:   SampleCode/PIONE/Advanced3/Annotation.pione
new file:   SampleCode/PIONE/Advanced3/Interaction.pione
new file:   SampleCode/PIONE/Advanced3/Main.pione
new file:   SampleCode/PIONE/Advanced3/Ref3DtoRef2D.pione
new file:   SampleCode/PIONE/Advanced3/Result.pione
new file:   SampleCode/PIONE/Advanced3/bin/Finish.cgi
new file:   SampleCode/PIONE/Advanced3/bin/Ref3DtoRef2D.cgi
new file:   SampleCode/PIONE/Advanced3/bin/Retry.cgi
new file:   SampleCode/PIONE/Advanced3/etc/Ref3DtoRef2D.html
new file:   SampleCode/PIONE/Advanced3/etc/index.html
new file:   SampleCode/PIONE/Advanced3/etc/index2.html

SampleCode/PIONE/Advanced3/Annotation.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced3/Interaction.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced3/Main.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced3/Ref3DtoRef2D.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced3/Result.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced3/bin/Finish.cgi [new file with mode: 0644]
SampleCode/PIONE/Advanced3/bin/Ref3DtoRef2D.cgi [new file with mode: 0644]
SampleCode/PIONE/Advanced3/bin/Retry.cgi [new file with mode: 0644]
SampleCode/PIONE/Advanced3/etc/Ref3DtoRef2D.html [new file with mode: 0644]
SampleCode/PIONE/Advanced3/etc/index.html [new file with mode: 0644]
SampleCode/PIONE/Advanced3/etc/index2.html [new file with mode: 0644]

diff --git a/SampleCode/PIONE/Advanced3/Annotation.pione b/SampleCode/PIONE/Advanced3/Annotation.pione
new file mode 100644 (file)
index 0000000..40cfe49
--- /dev/null
@@ -0,0 +1,3 @@
+.@ PackageName :: "Ref3DtoRef2D"
+.@ Editor              :: "Kinoshita"
+.@ Tag                 :: "v0.1.0"
diff --git a/SampleCode/PIONE/Advanced3/Interaction.pione b/SampleCode/PIONE/Advanced3/Interaction.pione
new file mode 100644 (file)
index 0000000..7b1c14d
--- /dev/null
@@ -0,0 +1,19 @@
+Rule Interaction
+       input 'Start{$val}!Flag'
+       output '*.*'.all
+       param $val
+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/* .
+       for file in $(ls *Mode *Rot1 *Rot2 *Rot3 *.ref3d) ;
+       do
+               mv "$file" "$file-{$val}";
+       done
+End
diff --git a/SampleCode/PIONE/Advanced3/Main.pione b/SampleCode/PIONE/Advanced3/Main.pione
new file mode 100644 (file)
index 0000000..a857edc
--- /dev/null
@@ -0,0 +1,33 @@
+Rule Main
+       output '*.ref3d'
+       output '*.ref2d'
+       output '*.mon'
+       output '*.gif'
+Flow
+       rule Start
+       rule SubMain
+       rule Result
+       rule Finish
+End
+
+Rule Start
+       output 'Start0!Flag'
+Action
+       touch {$O[1]}
+End
+
+Rule SubMain
+       input 'Start*!Flag'
+       output '*.*'.all
+Flow
+       rule Interaction {val : '{$I[1][1]}'.str().i()}
+       rule Ref3DtoRef2D {val : '{$I[1][1]}'.str().i()}
+End
+
+Rule Finish
+       input 'Finish*!Flag'
+       input '*.*-{$I[1][1]}'
+       output '{$I[2][1]}.{$I[2][2]}'
+Action
+       cp {$I[2]} {$O[1]}
+End
\ No newline at end of file
diff --git a/SampleCode/PIONE/Advanced3/Ref3DtoRef2D.pione b/SampleCode/PIONE/Advanced3/Ref3DtoRef2D.pione
new file mode 100644 (file)
index 0000000..3a1a2dc
--- /dev/null
@@ -0,0 +1,117 @@
+Rule Ref3DtoRef2D
+       input '*.!*-{$val}'.all
+       input '*.ref3d-{$val}'
+       output '*.ref2d-{$val}'.all
+       output 'Ref3DtoRef2D.info-{$val}'
+       param $val
+Flow
+       rule FlowLoop3Dto2D1 {val : $val}
+       rule Info3Dto2D {val : $val}
+End
+
+Rule Info3Dto2D
+       input '*.ref2d-{$val}'.all
+       output 'Ref3DtoRef2D.info-{$val}'
+       param $val
+Action
+       for file in $(ls *.ref2d-{$val})
+       do
+               echo "./$file" >> {$O[1]}
+       done
+End
+
+Rule FlowLoop3Dto2D1
+       input '*!*!*.!Rot1-{$val}'
+       input '*!*!*.!Rot2-{$val}'
+       input '*!*!*.!Rot3-{$val}'
+       input '*.!Mode-{$val}'
+       input '*.ref3d-{$val}'
+       output '*.ref2d-{$val}'.all
+       $min1 := '{$I[1][1]}'.str().f()
+       $max1 := '{$I[1][2]}'.str().f()
+       $delta1 := '{$I[1][3]}'.str().f()
+       $loop1 := ($max1 - $min1) / $delta1
+       param $val1 := 0.0
+       param $val
+Flow
+       rule FlowLoop3Dto2D2 {val1 : $val1, val :$val}
+
+       if $val1 + 1.0 <= $loop1
+               rule FlowLoop3Dto2D1 {val1 : $val1 + 1.0, val :$val}
+       end
+End
+
+Rule FlowLoop3Dto2D2
+       input '*!*!*.!Rot1-{$val}'
+       input '*!*!*.!Rot2-{$val}'
+       input '*!*!*.!Rot3-{$val}'
+       input '*.!Mode-{$val}'
+       input '*.ref3d-{$val}'
+       output '*.ref2d-{$val}'.all
+       $min2 := '{$I[2][1]}'.str().f()
+       $max2 := '{$I[2][2]}'.str().f()
+       $delta2 := '{$I[2][3]}'.str().f()
+       $loop2 := ($max2 - $min2) / $delta2
+       param $val1
+       param $val2 := 0.0
+       param $val
+Flow
+       rule FlowLoop3Dto2D3 {val1 : $val1, val2 : $val2, val :$val}
+
+       if $val2 + 1.0 <= $loop2
+               rule FlowLoop3Dto2D2 {val1 : $val1, val2 : $val2 + 1.0, val :$val}
+       end
+End
+
+Rule FlowLoop3Dto2D3
+       input '*!*!*.!Rot1-{$val}'
+       input '*!*!*.!Rot2-{$val}'
+       input '*!*!*.!Rot3-{$val}'
+       input '*.!Mode-{$val}'
+       input '*.ref3d-{$val}'
+       output '*.ref2d-{$val}'.all
+       $min3 := '{$I[3][1]}'.str().f()
+       $max3 := '{$I[3][2]}'.str().f()
+       $delta3 := '{$I[3][3]}'.str().f()
+       $loop3 := ($max3 - $min3) / $delta3
+       param $val1
+       param $val2
+       param $val3 := 0.0
+       param $val
+Flow
+       rule One3Dto2D {val1 : $val1, val2 : $val2, val3 : $val3, val :$val}
+
+       if $val3 + 1.0 <= $loop3
+               rule FlowLoop3Dto2D3 {val1 : $val1, val2 : $val2, val3 : $val3 + 1.0, val :$val}
+       end
+End
+
+Rule One3Dto2D
+       input '*!*!*.!Rot1-{$val}'
+       input '*!*!*.!Rot2-{$val}'
+       input '*!*!*.!Rot3-{$val}'
+       input '*.!Mode-{$val}'
+       input '*.ref3d-{$val}'
+       output '*.ref2d-{$val}'.all
+       param $val1
+       param $val2
+       param $val3
+       param $val
+Action
+       min1={$I[1][1]}
+       min2={$I[2][1]}
+       min3={$I[3][1]}
+       delta1={$I[1][3]}
+       delta2={$I[2][3]}
+       delta3={$I[3][3]}
+       mode={$I[4][1]}
+       rot1=$(echo "scale=5; {$val1} * $delta1 + $min1" | bc)
+       rot2=$(echo "scale=5; {$val2} * $delta2 + $min2" | bc)
+       rot3=$(echo "scale=5; {$val3} * $delta3 + $min3" | bc)
+       output="{$I[5][1]}-$mode-$rot1-$rot2-$rot3.ref2d-{$val}"
+       mrc3Dto2D       -i {$I[5]} -o $output \
+                               -Rot1 $rot1 $rot1 1 \
+                               -Rot2 $rot2 $rot2 1 \
+                               -Rot3 $rot3 $rot3 1 \
+                               -EulerMode $mode;
+End
diff --git a/SampleCode/PIONE/Advanced3/Result.pione b/SampleCode/PIONE/Advanced3/Result.pione
new file mode 100644 (file)
index 0000000..9a8557b
--- /dev/null
@@ -0,0 +1,43 @@
+Rule Result
+       input 'Ref3DtoRef2D.info-*'
+       input '*.ref2d-{$I[1][1]}'.all
+       output '*!Flag'
+       output 'Ref3DtoRef2D.mon-{$I[1][1]}'
+       output 'Ref3DtoRef2D.gif-{$I[1][1]}'
+Flow
+       rule Ref2DtoGIF {val : '{$I[1][1]}'.str().i()}
+       rule ResultCheck {val : '{$I[1][1]}'.str().i()}
+End
+
+Rule Ref2DtoGIF
+       input 'Ref3DtoRef2D.info-{$val}'
+       input '*.ref2d-{$val}'.all
+       output 'Ref3DtoRef2D.mon-{$val}'
+       output 'Ref3DtoRef2D.gif-{$val}'
+       param $val
+Action
+       mrcImageMontageCreate -i {$I[1]} -o {$O[1]}
+       mrc2gif -i {$O[1]} -o {$O[2]}
+End
+
+Rule ResultCheck
+       input 'Ref3DtoRef2D.gif-{$val}'
+       output '*!Flag'
+       param $val
+Action
+       # build public directory for pione-interactive
+       mkdir public
+       cp etc/index2.html public/index.html
+       cp bin/* public
+       cp {$I[1]} public/Ref3DtoRef2D.gif
+
+       # start interactive operation
+       pione-interactive browser --public public
+
+       cp public/* .
+       if [ -e "Finish!Flag" ]; then
+               mv "Finish!Flag" "Finish{$val}!Flag";
+       elif [ -e "Start!Flag" ]; then
+               mv "Start!Flag" "Start{$val + 1}!Flag";
+       fi
+End
diff --git a/SampleCode/PIONE/Advanced3/bin/Finish.cgi b/SampleCode/PIONE/Advanced3/bin/Finish.cgi
new file mode 100644 (file)
index 0000000..af0c2ae
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+### Header
+strHTML = ""
+strHTML += "<!DOCTYPE html>"
+strHTML += "<html>"
+strHTML += "<head>"
+strHTML += "<title>Finish</title>"
+### Auto Close
+strHTML += '<meta http-equiv="REFRESH" content="0;URL=?pione-action=finish">'
+
+# Main Process
+command = "touch Finish!Flag"
+system(command)
+
+strHTML += "</head>"
+strHTML += "</html>"
+
+# Output as html
+cgi.out(type: "text/html") do
+       strHTML
+end
diff --git a/SampleCode/PIONE/Advanced3/bin/Ref3DtoRef2D.cgi b/SampleCode/PIONE/Advanced3/bin/Ref3DtoRef2D.cgi
new file mode 100644 (file)
index 0000000..0b7dd2a
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/env ruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+### Header
+strHTML = ""
+strHTML += "<!DOCTYPE html>"
+strHTML += "<html>"
+strHTML += "<head>"
+strHTML += "<title>Ref3DtoRef2D</title>"
+### Auto Close
+strHTML += '<meta http-equiv="REFRESH" content="0;URL=?pione-action=finish">'
+
+# 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
+strMode = cgi['Mode1'] + cgi['Mode2'] + cgi['Mode3'] + cgi['Mode4']
+strRotMin1 = cgi['RotMin1']
+strRotMax1 = cgi['RotMax1']
+strRotDelta1 = cgi['RotDelta1']
+strRotMin2 = cgi['RotMin2']
+strRotMax2 = cgi['RotMax2']
+strRotDelta2 = cgi['RotDelta2']
+strRotMin3 = cgi['RotMin3']
+strRotMax3 = cgi['RotMax3']
+strRotDelta3 = cgi['RotDelta3']
+
+### Set Parameter to FileNames
+strParamFile = strMode + ".!Mode"
+command = "touch " + strParamFile
+system(command)
+
+strParamFile = strRotMin1 + "!" + strRotMax1 + "!" + strRotDelta1 + ".!Rot1"
+command = "touch " + strParamFile
+system(command)
+
+strParamFile = strRotMin2 + "!" + strRotMax2 + "!" + strRotDelta2 + ".!Rot2"
+command = "touch " + strParamFile
+system(command)
+
+strParamFile = strRotMin3 + "!" + strRotMax3 + "!" + strRotDelta3 + ".!Rot3"
+command = "touch " + strParamFile
+system(command)
+
+command = "cp " + strInputFile + " Refer.ref3d"
+system(command)
+
+strHTML += "</head>"
+strHTML += "</html>"
+
+# Output as html
+cgi.out(type: "text/html") do
+       strHTML
+end
diff --git a/SampleCode/PIONE/Advanced3/bin/Retry.cgi b/SampleCode/PIONE/Advanced3/bin/Retry.cgi
new file mode 100644 (file)
index 0000000..05fcd64
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/env ruby
+
+require 'cgi'
+
+cgi = CGI.new
+
+### Header
+strHTML = ""
+strHTML += "<!DOCTYPE html>"
+strHTML += "<html>"
+strHTML += "<head>"
+strHTML += "<title>Retry</title>"
+### Auto Close
+strHTML += '<meta http-equiv="REFRESH" content="0;URL=?pione-action=finish">'
+
+# Main Process
+command = "touch Start!Flag"
+system(command)
+
+strHTML += "</head>"
+strHTML += "</html>"
+
+# Output as html
+cgi.out(type: "text/html") do
+       strHTML
+end
diff --git a/SampleCode/PIONE/Advanced3/etc/Ref3DtoRef2D.html b/SampleCode/PIONE/Advanced3/etc/Ref3DtoRef2D.html
new file mode 100644 (file)
index 0000000..8d1d818
--- /dev/null
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>Ref3DtoRef2D</title>
+       </head>
+       <body>
+               <form action="Ref3DtoRef2D.cgi" method="post" enctype="multipart/form-data">
+                       <button type="submit">開始</button>
+                       <br>
+                       <table>
+                               <tr>
+                                       <td>
+                                               <input type="file" name="InputFile"/>
+                                       </td>
+                                       <td>
+                                               入力ファイル名(.ref3d)
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               <select name="Mode1">
+                                                       <option value="X">X</option>
+                                                       <option value="Y">Y</option>
+                                                       <option value="Z">Z</option>
+                                               </select>
+                                               <select name="Mode2">
+                                                       <option value="O">O</option>
+                                                       <option value="E">E</option>
+                                               </select>
+                                               <select name="Mode3">
+                                                       <option value="Y">Y</option>
+                                                       <option value="N">N</option>
+                                               </select>
+                                               <select name="Mode4">
+                                                       <option value="S">S</option>
+                                                       <option value="R">R</option>
+                                               </select>
+                                       </td>
+                                       <td>
+                                               回転モード
+                                       </td>
+                               </tr>
+                       </table>
+                       <table>
+                               <tr>
+                                       <td>
+                                               
+                                       </td>
+                                       <td>
+                                               最小値
+                                       </td>
+                                       <td>
+                                               最大値
+                                       </td>
+                                       <td>
+                                               加算値
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               角度1
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMin1" value="0"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMax1" value="359"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotDelta1" value="30"/>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               角度2
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMin2" value="0"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMax2" value="359"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotDelta2" value="30"/>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               角度3
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMin3" value="0"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotMax3" value="0"/>
+                                       </td>
+                                       <td>
+                                               <input type="text" name="RotDelta3" value="30"/>
+                                       </td>
+                               </tr>
+                       </table>
+               </form>
+               <br>
+               <br>
+               <a href="index.html">戻る</a><br>
+               <a href="?pione-action=finish">終了</a><br>
+       </body>
+</html>
\ No newline at end of file
diff --git a/SampleCode/PIONE/Advanced3/etc/index.html b/SampleCode/PIONE/Advanced3/etc/index.html
new file mode 100644 (file)
index 0000000..b625f87
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>InteractiveCommand Index Page</title>
+       </head>
+       <body>
+               <a href="Ref3DtoRef2D.html">Ref3DtoRef2D</a><br>
+               <br>
+               <a href="?pione-action=finish">終了</a>
+       </body>
+</html>
\ No newline at end of file
diff --git a/SampleCode/PIONE/Advanced3/etc/index2.html b/SampleCode/PIONE/Advanced3/etc/index2.html
new file mode 100644 (file)
index 0000000..54b369b
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+       <head>
+               <meta charset="utf-8">
+               <title>InteractiveCommand Index Page</title>
+       </head>
+       <body>
+               <img src="Ref3DtoRef2D.gif"><br>
+               <br>
+               <a href="Finish.cgi">決定</a><br>
+               <a href="Retry.cgi">やり直し</a>
+       </body>
+</html>
\ No newline at end of file