OSDN Git Service

Modify: PIONE tutorial Advanced4 use "each" and "all". v2.0.2p0095
authorkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 28 Jan 2015 05:19:21 +0000 (14:19 +0900)
committerkinoshita-eos <kinoshita@yasunaga-lab.bio.kyutech.ac.jp>
Wed, 28 Jan 2015 05:19:21 +0000 (14:19 +0900)
modified:   SampleCode/PIONE/Advanced4/Create_3d4slst.pione
modified:   SampleCode/PIONE/Advanced4/Create_3dlst.pione
modified:   SampleCode/PIONE/Advanced4/Create_3dwholelst.pione
new file:   SampleCode/PIONE/Advanced4/Create_Sample3d.pione
modified:   SampleCode/PIONE/Advanced4/Create_SampleROI.pione
modified:   SampleCode/PIONE/Advanced4/Create_fit.pione
modified:   SampleCode/PIONE/Advanced4/Main.pione
modified:   SampleCode/PIONE/Advanced4/Parameter.pione
modified:   SampleCode/PIONE/Advanced4/Preprocess.pione

SampleCode/PIONE/Advanced4/Create_3d4slst.pione
SampleCode/PIONE/Advanced4/Create_3dlst.pione
SampleCode/PIONE/Advanced4/Create_3dwholelst.pione
SampleCode/PIONE/Advanced4/Create_Sample3d.pione [new file with mode: 0644]
SampleCode/PIONE/Advanced4/Create_SampleROI.pione
SampleCode/PIONE/Advanced4/Create_fit.pione
SampleCode/PIONE/Advanced4/Main.pione
SampleCode/PIONE/Advanced4/Parameter.pione
SampleCode/PIONE/Advanced4/Preprocess.pione

index fd2569f..f6fb9af 100644 (file)
@@ -1,12 +1,12 @@
 Rule Create_3d4slst
-       input '*.lst'
        input '*.roi'.all
        input '*.corinfo'.all
-       output '{$I[1][1]}.3d4slst'
+       output '{$filename}.3d4slst'
        output '*.4shift'.all
+       param $filename
 Flow
        rule fit_3d4sinfo
-       rule Sum_3d4sinfo_3d4slst
+       rule Sum_3d4sinfo_3d4slst {filename: $filename}
 End
 
 #.fit.3d4sinfo:
@@ -32,11 +32,11 @@ Action
 End
 
 Rule Sum_3d4sinfo_3d4slst
-       input '*.lst'
        input '*.3d4sinfo'.all
-       output '{$I[1][1]}.3d4slst'
+       output '{$filename}.3d4slst'
+       param $filename
 Action
-       for info in {$I[2].join()}
+       for info in {$I[1].join()}
        do
                cat $info >> {$O[1]}
        done
index 5316345..a741f60 100644 (file)
@@ -1,10 +1,10 @@
 Rule Create_3dlst
-       input '*.lst'
        input '*.corinfo'.all
-       output '{$I[1][1]}.3dlst'
+       output '{$filename}.3dlst'
+       param $filename
 Flow
        rule fit_3dinfo
-       rule Sum_3dinfo_3dlst
+       rule Sum_3dinfo_3dlst {filename: $filename}
 End
 
 # .fit.3dinfo:
@@ -18,11 +18,11 @@ Action
 End
 
 Rule Sum_3dinfo_3dlst
-       input '*.lst'
        input '*.3dinfo'.all
-       output '{$I[1][1]}.3dlst'
+       output '{$filename}.3dlst'
+       param $filename
 Action
-       for info in {$I[2].join()}
+       for info in {$I[1].join()}
        do
                cat $info >> {$O[1]}
        done
index a929fac..42e728e 100644 (file)
@@ -1,12 +1,12 @@
 Rule Create_3dwholelst
-       input '*.lst'
        input '*.roi'.all
        input '*.corinfo'.all
-       output '{$I[1][1]}.3dwholelst'
+       output '{$filename}.3dwholelst'
        output '*.shift'.all
+       param $filename
 Flow
        rule fit_3dwholeinfo
-       rule Sum_3dwholeinfo_3dwholelst
+       rule Sum_3dwholeinfo_3dwholelst {filename: $filename}
 End
 
 #.fit.3dwholeinfo:
@@ -25,11 +25,11 @@ Action
 End
 
 Rule Sum_3dwholeinfo_3dwholelst
-       input '*.lst'
        input '*.3dwholeinfo'.all
-       output '{$I[1][1]}.3dwholelst'
+       output '{$filename}.3dwholelst'
+       param $filename
 Action
-       for info in {$I[2].join()}
+       for info in {$I[1].join()}
        do
                cat $info >> {$O[1]}
        done
diff --git a/SampleCode/PIONE/Advanced4/Create_Sample3d.pione b/SampleCode/PIONE/Advanced4/Create_Sample3d.pione
new file mode 100644 (file)
index 0000000..b48f599
--- /dev/null
@@ -0,0 +1,37 @@
+Rule Create_Sample3d
+       input '*.mrc'
+       output '{$I[1][1]}.sample3d'
+Action
+       data=$(mrcInfo -i {$I[1]} | head -1)
+       x_size=$(echo "${data}" | awk '{printf ("%i", $4)}')
+       y_size=$(echo "${data}" | awk '{printf ("%i", $5)}')
+       z_size=$(echo "${data}" | awk '{printf ("%i", $6)}')
+
+       data=$(mrcInfo -i {$I[1]} | head -5 | tail -1)
+       x_length=$(echo "${data}" | awk '{printf ("%f", $4)}')
+       y_length=$(echo "${data}" | awk '{printf ("%f", $5)}')
+       z_length=$(echo "${data}" | awk '{printf ("%f", $6)}')
+       
+       ref_size=${x_size}
+       length=${x_length}
+       
+       if [ ${ref_size} -lt ${y_size} ] ; then \
+               ref_size=${y_size}
+               length=${y_length}
+       fi
+       
+       if [ ${ref_size} -lt ${z_size} ] ; then \
+               ref_size=${z_size}
+               length=${z_length}
+       fi
+       
+       image_size={$X_SIZE}
+       
+       if [ ${image_size} -lt {$Y_SIZE} ] ; then \
+               image_size={$Y_SIZE}
+       fi
+       
+       sampling_length=$(echo "scale=7; ${length} * ${ref_size} / ${image_size}" | bc)
+       
+       mrcImageSamplingUnitChange -i {$I[1]} -o {$I[1][1]}.sample3d -m 2 -S ${sampling_length} ${sampling_length} ${sampling_length}
+End
index b040d7b..a9e5cb0 100644 (file)
@@ -1,57 +1,37 @@
-Rule Create_SampleROI
-       input '*.mrc'
-       output '{$I[1][1]}.lst'
+Rule Create_SampleROI_each
+       input '*.sample3d'
+       output '{$I[1][1]}-{$rot1}-{$rot2}-{$rot3}.roi'
+       output '{$I[1][1]}-{$rot1}-{$rot2}-{$rot3}.tiff'
+       param $rot1
+       param $rot2
+       param $rot3
+Action
+       mrc3Dto2D       -i {$I[1]} -o {$I[1][1]}-{$rot1}-{$rot2}-{$rot3}.data2d -InterpolationMode 2 -EulerMode {$ROI_ROT_MODE} \
+                               -Rot1 {$rot1} {$rot1} 1 \
+                               -Rot2 {$rot2} {$rot2} 1 \
+                               -Rot3 {$rot3} {$rot3} 1
+       mrcImageNoiseAdd -i {$I[1][1]}-{$rot1}-{$rot2}-{$rot3}.data2d -o {$O[1]} -SN {$ROI_SN}
+       mrc2tiff -i {$O[1]} -o {$O[2]}
+End
+
+Rule Create_SampleROI_all
+       input '*.sample3d'
        output '{$I[1][1]}-*.roi'.all
        output '{$I[1][1]}-*.tiff'.all
 Action
-       data=$(mrcInfo -i {$I[1]} | head -1)
-       x_size=$(echo "${data}" | awk '{printf ("%i", $4)}')
-       y_size=$(echo "${data}" | awk '{printf ("%i", $5)}')
-       z_size=$(echo "${data}" | awk '{printf ("%i", $6)}')
-
-       data=$(mrcInfo -i {$I[1]} | head -5 | tail -1)
-       x_length=$(echo "${data}" | awk '{printf ("%f", $4)}')
-       y_length=$(echo "${data}" | awk '{printf ("%f", $5)}')
-       z_length=$(echo "${data}" | awk '{printf ("%f", $6)}')
-       
-       ref_size=${x_size}
-       length=${x_length}
-       
-       if [ ${ref_size} -lt ${y_size} ] ; then \
-               ref_size=${y_size}
-               length=${y_length}
-       fi
-       
-       if [ ${ref_size} -lt ${z_size} ] ; then \
-               ref_size=${z_size}
-               length=${z_length}
-       fi
-       
-       image_size={$X_SIZE}
-       
-       if [ ${image_size} -lt {$Y_SIZE} ] ; then \
-               image_size={$Y_SIZE}
-       fi
-       
-       sampling_length=$(echo "scale=7; ${length} * ${ref_size} / ${image_size}" | bc)
-       
-       mrcImageSamplingUnitChange -i {$I[1]} -o {$I[1][1]}.data3d -m 2 -S ${sampling_length} ${sampling_length} ${sampling_length}
-
        for (( rot1 = {$ROI_ROT1_START}; rot1 <= {$ROI_ROT1_END}; rot1 += {$ROI_ROT1_DELTA} ))
        do
                for (( rot2 = {$ROI_ROT2_START}; rot2 <= {$ROI_ROT2_END}; rot2 += {$ROI_ROT2_DELTA} ))
                do
                        for (( rot3 = {$ROI_ROT3_START}; rot3 <= {$ROI_ROT3_END}; rot3 += {$ROI_ROT3_DELTA} ))
                        do
-                               mrc3Dto2D       -i {$I[1][1]}.data3d -o {$I[1][1]}-${rot1}-${rot2}-${rot3}.data2d -InterpolationMode 2 -EulerMode {$ROI_ROT_MODE} \
-                               -Rot1 ${rot1} ${rot1} 1 \
-                               -Rot2 ${rot2} ${rot2} 1 \
-                               -Rot3 ${rot3} ${rot3} 1
+                               mrc3Dto2D       -i {$I[1]} -o {$I[1][1]}-${rot1}-${rot2}-${rot3}.data2d -InterpolationMode 2 -EulerMode {$ROI_ROT_MODE} \
+                                                       -Rot1 ${rot1} ${rot1} 1 \
+                                                       -Rot2 ${rot2} ${rot2} 1 \
+                                                       -Rot3 ${rot3} ${rot3} 1
                                mrcImageNoiseAdd -i {$I[1][1]}-${rot1}-${rot2}-${rot3}.data2d -o {$I[1][1]}-${rot1}-${rot2}-${rot3}.roi -SN {$ROI_SN}
                                mrc2tiff -i {$I[1][1]}-${rot1}-${rot2}-${rot3}.roi -o {$I[1][1]}-${rot1}-${rot2}-${rot3}.tiff
                        done
                done
        done
-       
-       ls *.roi > {$O[1]}
 End
index 7ffcbcb..1ac7fbb 100644 (file)
@@ -1,5 +1,5 @@
 #.pad.fit:
-Rule Create_fit
+Rule Create_fit_each
        input '*.pad'
        input '*.stack'
        output '{$I[1][1]}.fit'
@@ -7,4 +7,17 @@ Rule Create_fit
 Action
        mrcImageAutoRotationCorrelation -i {$I[1]} -r {$I[2]} -fit  {$O[1]} -O {$O[2]} \
                                                                        -n {$N_ROT} -m 18 -nRot1 {$N_ROT1} -nRot2 {$N_ROT2} -nRot3 {$N_ROT3} > /dev/null
+End
+
+Rule Create_fit_all
+       input '*.pad'.all
+       input '*.stack'
+       output '*.fit'.all
+       output '*.corinfo'.all
+Action
+       for data in {$I[1][1]}
+       do
+               mrcImageAutoRotationCorrelation -i ${data}.pad -r {$I[2]} -fit  ${data}.fit -O ${data}.corinfo \
+                                                                               -n {$N_ROT} -m 18 -nRot1 {$N_ROT1} -nRot2 {$N_ROT2} -nRot3 {$N_ROT3} > /dev/null
+       done
 End
\ No newline at end of file
index 663d179..c494257 100644 (file)
@@ -1,15 +1,14 @@
 Rule Main
-       if $Flag_ROI or $Flag_Ref
+       if ($Mode_ROI + $Mode_Ref) != 0
                input '*.mrc'
        end
 
-       if $Flag_ROI.not()
-               input '*.lst'
-               input '*.roi'.all
+       if $Mode_Ref == 0
+               input '*.stack'
        end
 
-       if $Flag_Ref.not()
-               input '*.stack'
+       if $Mode_ROI == 0
+               input '*.roi'.all
        end
 
        if $Flag_3D
@@ -32,39 +31,52 @@ Rule Main
                output '{$I[1][1]}.4s.ds6'
        end
 
-       if $Flag_ROI
+       if $Mode_ROI != 0
                output '*.tiff'.all
        end
 
-       output '*.gif'.all
-       
+       if $Flag_Projection
+               output '*.gif'.all
+       end
 Flow
-
-       if $Flag_ROI
-               rule Create_SampleROI
+       case $Mode_ROI
+       when 1
+               rule Create_Sample3d
+               rule Create_SampleROI_each {rot1: (0.upto($roi_rot1_loop))*$ROI_ROT1_DELTA, rot2: (0.upto($roi_rot2_loop))*$ROI_ROT2_DELTA, rot3: (0.upto($roi_rot3_loop))*$ROI_ROT3_DELTA}
+       when 2
+               rule Create_Sample3d
+               rule Create_SampleROI_all
        end
 
-       if $Flag_Ref
+       if $Mode_Ref != 0
                rule Create_stack
        end
 
        rule Preprocess
-       rule Create_fit
+       
+       case $Mode_Cor
+       when 1
+               rule Create_fit_each
+       when 2
+               rule Create_fit_all
+       end
 
        if $Flag_3D
-               rule Create_3dlst
+               rule Create_3dlst {filename: $I[1][1].str()}
                rule Create_3d
        end
 
        if $Flag_3DWhole
-               rule Create_3dwholelst 
+               rule Create_3dwholelst {filename: $I[1][1].str()}
                rule Create_3dwhole
        end
 
        if $Flag_3D4S
-               rule Create_3d4slst
+               rule Create_3d4slst {filename: $I[1][1].str()}
                rule Create_3d4s
        end
 
-       rule Projection_3d
+       if $Flag_Projection
+               rule Projection_3d
+       end
 End
index 079a9c2..9f12751 100644 (file)
@@ -28,17 +28,24 @@ param $ROI_ROT_MODE := "XOYS"
 param $ROI_ROT1_START := 0
 param $ROI_ROT1_END := 359
 param $ROI_ROT1_DELTA := 30
+$roi_rot1_loop := ($ROI_ROT1_END - $ROI_ROT1_START) / $ROI_ROT1_DELTA
 param $ROI_ROT2_START := 0
 param $ROI_ROT2_END := 359
 param $ROI_ROT2_DELTA := 30
+$roi_rot2_loop := ($ROI_ROT2_END - $ROI_ROT2_START) / $ROI_ROT2_DELTA
 param $ROI_ROT3_START := 0
 param $ROI_ROT3_END := 0
 param $ROI_ROT3_DELTA := 30
+$roi_rot3_loop := ($ROI_ROT3_END - $ROI_ROT3_START) / $ROI_ROT3_DELTA
 param $ROI_SN := 1
 
 # advanced param
-advanced param $Flag_ROI := true
-advanced param $Flag_Ref := true
+## Mode 0: do not, 1: each, 2: all
+advanced param $Mode_ROI := 1
+advanced param $Mode_Ref := 1
+advanced param $Mode_Cor := 1
+## Flag true: do, false: do not
 advanced param $Flag_3D := true
 advanced param $Flag_3DWhole := true
 advanced param $Flag_3D4S := true
+advanced param $Flag_Projection := true
index b18cf5b..d9939ab 100644 (file)
@@ -1,14 +1,11 @@
 # .lst.padlst:
 Rule Preprocess
-       input '*.lst'
-       input '*.roi'.all
-       output '*.pad'.all
-       output '{$I[1][1]}.padlst'
+       input '*.roi'
+       output '{$I[1][1]}.pad'
 Flow
        rule roi_smooth;
        rule smooth_shrink;
        rule shrink_pad;
-       rule pad_padlst;
 End
 
 #.roi.smooth:
@@ -36,11 +33,3 @@ Action
        height=`expr {$Y_SIZE} / {$SHRINK}`
        mrcImagePad -i {$I[1]} -o {$O[1]} -W ${width} -H ${height}
 End
-
-Rule pad_padlst
-       input '*.lst'
-       input '*.pad'.all
-       output '{$I[1][1]}.padlst'
-Action
-       echo "{$I[2].join("\\n")}" > {$O[1]}
-End