From e461f904825bf37203df92263fe844bb09fc26a6 Mon Sep 17 00:00:00 2001 From: billKarsh Date: Mon, 8 Jul 2013 17:12:28 -0400 Subject: [PATCH] Pretty scripts --- 00_ENV/getsharedbins.sht | 1 - 1_Ptestx/findsame.sht | 1 - 1_Ptestx/{driver.sht => pgo.sht} | 0 2_GraRan1Lyr/driver.sht | 4 ---- 2_GraRan1Lyr/gr1go.sht | 17 +++++++++++++++++ 2_GrayRanger/GrayRanger.cpp | 8 +++----- 2_GrayRanger/driver.sht | 4 ---- 2_GrayRanger/grgo.sht | 17 +++++++++++++++++ 2_HEQLayers/HEQLayers.cpp | 8 +++----- 2_HEQLayers/heqlayersgo.sht | 17 +++++++++++++++++ 2_HEQVFY/heqvfygo.sht | 21 +++++++++++++++++++++ 2_HEQXML/heqxmlgo.sht | 17 +++++++++++++++++ 2_Hist1/Hist1.cpp | 2 +- 2_Hist1/{driver.sht => hst1go.sht} | 9 +++++++++ 2_HistAll/HistAll.cpp | 10 ++++------ 2_HistAll/driver.sht | 4 ---- 2_HistAll/hstgo.sht | 16 ++++++++++++++++ 2_RGBM1Lyr/driver.sht | 6 ------ 2_RGBM1Lyr/rgb1go.sht | 18 ++++++++++++++++++ 2_RGBMerge/RGBMerge.cpp | 8 +++----- 2_RGBMerge/driver.sht | 6 ------ 2_RGBMerge/rgbgo.sht | 18 ++++++++++++++++++ macros/CLEAN.sht | 2 +- macros/JuanLayout.sht | 2 +- macros/ReplaceAll.sht | 1 + macros/catlayout.sht | 2 +- macros/catlyr.sht | 2 +- macros/edit_filepath.sht | 2 -- macros/edit_title.sht | 2 -- macros/lou_driver.sht | 2 ++ macros/newses.sht | 2 +- macros/rootpaths.sht | 1 + macros/subdel.sht | 2 +- macros/tar.sht | 1 - macros/test.sht | 2 +- macros/thmdown.sht | 1 - macros/thmsame.sht | 1 - zlineends.sht | 1 - 38 files changed, 175 insertions(+), 63 deletions(-) rename 1_Ptestx/{driver.sht => pgo.sht} (100%) delete mode 100644 2_GraRan1Lyr/driver.sht create mode 100644 2_GraRan1Lyr/gr1go.sht delete mode 100644 2_GrayRanger/driver.sht create mode 100644 2_GrayRanger/grgo.sht create mode 100644 2_HEQLayers/heqlayersgo.sht create mode 100644 2_HEQVFY/heqvfygo.sht create mode 100644 2_HEQXML/heqxmlgo.sht rename 2_Hist1/{driver.sht => hst1go.sht} (57%) delete mode 100644 2_HistAll/driver.sht create mode 100644 2_HistAll/hstgo.sht delete mode 100644 2_RGBM1Lyr/driver.sht create mode 100644 2_RGBM1Lyr/rgb1go.sht delete mode 100644 2_RGBMerge/driver.sht create mode 100644 2_RGBMerge/rgbgo.sht diff --git a/00_ENV/getsharedbins.sht b/00_ENV/getsharedbins.sht index 5795ec4..7fff330 100644 --- a/00_ENV/getsharedbins.sht +++ b/00_ENV/getsharedbins.sht @@ -9,4 +9,3 @@ cp /groups/apig/share/ClusterSupport/bins/SuperLUSymSolve /groups/apig/tomo/lou_stuff/binaries cp /groups/apig/share/ClusterSupport/bins/SuperLUSymSolveMPI /groups/apig/tomo/lou_stuff/binaries - diff --git a/1_Ptestx/findsame.sht b/1_Ptestx/findsame.sht index b4cd0fc..a033039 100644 --- a/1_Ptestx/findsame.sht +++ b/1_Ptestx/findsame.sht @@ -3,4 +3,3 @@ grep -e "ptest 30/30021022@30/30022023" S*/make.same - diff --git a/1_Ptestx/driver.sht b/1_Ptestx/pgo.sht similarity index 100% rename from 1_Ptestx/driver.sht rename to 1_Ptestx/pgo.sht diff --git a/2_GraRan1Lyr/driver.sht b/2_GraRan1Lyr/driver.sht deleted file mode 100644 index e1fd320..0000000 --- a/2_GraRan1Lyr/driver.sht +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -GraRan1Lyr layer0_48_grn_sim_montage.xml -z=2 -chn=0 -pct=50.0 - diff --git a/2_GraRan1Lyr/gr1go.sht b/2_GraRan1Lyr/gr1go.sht new file mode 100644 index 0000000..6360125 --- /dev/null +++ b/2_GraRan1Lyr/gr1go.sht @@ -0,0 +1,17 @@ +#!/bin/sh + +# Purpose: +# Write entry in outfile GRScales.txt having scale min,max for this layer. +# +# > GraRan1Lyr -z=i <-chn=chn> <-pct-pct> [options]. +# +# Required: +# -chn=0 ;for example, scale channel 0 +# -pct=85.0 ;for example, use 85% of forground range. +# +# Options: +# -lrbt=0,0,-1,-1 ;calculate average intensity in this ROI + + +GraRan1Lyr layer0_48_grn_sim_montage.xml -z=2 -chn=0 -pct=50.0 + diff --git a/2_GrayRanger/GrayRanger.cpp b/2_GrayRanger/GrayRanger.cpp index f5095d4..bad3f6a 100644 --- a/2_GrayRanger/GrayRanger.cpp +++ b/2_GrayRanger/GrayRanger.cpp @@ -187,7 +187,8 @@ static void WriteScript( vector &zlist ) int nz = zlist.size(); - fprintf( f, "#!/bin/sh\n\n" ); + fprintf( f, "#!/bin/sh\n" ); + fprintf( f, "\n" ); for( int iz = 0; iz < nz; ++iz ) { @@ -200,10 +201,7 @@ static void WriteScript( vector &zlist ) fprintf( f, "\n" ); fclose( f ); - -// make executable - - chmod( "make.scales.sht", S_IRWXU | S_IRWXG | S_IRWXO ); + FileScriptPerms( "make.scales.sht" ); } /* --------------------------------------------------------------- */ diff --git a/2_GrayRanger/driver.sht b/2_GrayRanger/driver.sht deleted file mode 100644 index 7423425..0000000 --- a/2_GrayRanger/driver.sht +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -GrayRanger layer0_48_grn_sim_montage.xml -zmin=2 -zmax=2 -chn=0 -pct=50.0 - diff --git a/2_GrayRanger/grgo.sht b/2_GrayRanger/grgo.sht new file mode 100644 index 0000000..8dd3ce0 --- /dev/null +++ b/2_GrayRanger/grgo.sht @@ -0,0 +1,17 @@ +#!/bin/sh + +# Purpose: +# Create script 'make.scales.sht' to submit GraRan1Lyr jobs. +# +# > GrayRanger -zmin=i -zmax=j <-chn=chn> <-pct-pct> [options]. +# +# Required: +# -chn=0 ;for example, scale channel 0 +# -pct=85.0 ;for example, use 85% of forground range. +# +# Options: +# -lrbt=0,0,-1,-1 ;calculate average intensity in this ROI + + +GrayRanger layer0_48_grn_sim_montage.xml -zmin=2 -zmax=2 -chn=0 -pct=50.0 + diff --git a/2_HEQLayers/HEQLayers.cpp b/2_HEQLayers/HEQLayers.cpp index 65c467d..c0f2fcb 100644 --- a/2_HEQLayers/HEQLayers.cpp +++ b/2_HEQLayers/HEQLayers.cpp @@ -186,7 +186,8 @@ static void WriteScript( vector &zlist ) int nz = zlist.size(); - fprintf( f, "#!/bin/sh\n\n" ); + fprintf( f, "#!/bin/sh\n" ); + fprintf( f, "\n" ); for( int iz = 0; iz < nz; ++iz ) { @@ -199,10 +200,7 @@ static void WriteScript( vector &zlist ) fprintf( f, "\n" ); fclose( f ); - -// make executable - - chmod( "make.heq.sht", S_IRWXU | S_IRWXG | S_IRWXO ); + FileScriptPerms( "make.heq.sht" ); } /* --------------------------------------------------------------- */ diff --git a/2_HEQLayers/heqlayersgo.sht b/2_HEQLayers/heqlayersgo.sht new file mode 100644 index 0000000..9d2158b --- /dev/null +++ b/2_HEQLayers/heqlayersgo.sht @@ -0,0 +1,17 @@ +#!/bin/sh + +# Purpose: +# Create script 'make.heq.sht' to submit HEQ1Lyr jobs. +# +# > HEQLayers -zmin=i -zmax=j <-pct=pct> [options]. +# +# Required: +# tag ;text string like HEQ that labels output folder and tifs. +# -pct=85.0 ;for example, use 85% of forground range. +# +# Options: +# -lrbt=0,0,-1,-1 ;calculate average intensity in this ROI + + +HEQLayers layer0_48_grn_sim_montage.xml HEQ -zmin=0 -zmax=48 -pct=99.5 + diff --git a/2_HEQVFY/heqvfygo.sht b/2_HEQVFY/heqvfygo.sht new file mode 100644 index 0000000..feb54a1 --- /dev/null +++ b/2_HEQVFY/heqvfygo.sht @@ -0,0 +1,21 @@ +#!/bin/sh + +# Purpose: +# List missing HEQ files. +# +# The input XML file can have either native or tag-modified file-paths. +# In either case, we call DskExists for each image. We do not check +# correctness of the XML file itself. +# +# > HEQVFY [options] +# +# Required: +# tag ;text string like HEQ that labels output folder and tifs. +# +# Options: +# -p=_N_ ;pattern describes context around tile ID 'N' in img name +# -zmin=i -zmax=j ;restricts layer range + + +HEQVFY Z7-119.txt HEQ -zmin=7 -zmax=119 + diff --git a/2_HEQXML/heqxmlgo.sht b/2_HEQXML/heqxmlgo.sht new file mode 100644 index 0000000..20309a1 --- /dev/null +++ b/2_HEQXML/heqxmlgo.sht @@ -0,0 +1,17 @@ +#!/bin/sh + +# Purpose: +# Using same tag and Z-range as for HEQLayers, update corresponding XML +# to point to the new images. +# +# > HEQXML [options] +# +# Required: +# tag ;text string like HEQ that labels output folder and tifs. +# +# Options: +# -zmin=i -zmax=j ;restricts layer range + + +HEQXML Z7-119.txt HEQ -zmin=7 -zmax=119 + diff --git a/2_Hist1/Hist1.cpp b/2_Hist1/Hist1.cpp index 1e77311..1373832 100644 --- a/2_Hist1/Hist1.cpp +++ b/2_Hist1/Hist1.cpp @@ -70,7 +70,7 @@ void CArgs_hist1::SetCmdLine( int argc, char* argv[] ) // parse command line args if( argc < 3 ) { - printf( "Usage: Hist1 [options].\n" ); + printf( "Usage: Hist1 .\n" ); exit( 42 ); } diff --git a/2_Hist1/driver.sht b/2_Hist1/hst1go.sht similarity index 57% rename from 2_Hist1/driver.sht rename to 2_Hist1/hst1go.sht index acab393..4d4202a 100644 --- a/2_Hist1/driver.sht +++ b/2_Hist1/hst1go.sht @@ -1,5 +1,14 @@ #!/bin/sh +# Purpose: +# Write binary histogram file for one 16-bit image. +# +# > Hist1 . +# +# Options: +# none + + mkdir HST cd HST diff --git a/2_HistAll/HistAll.cpp b/2_HistAll/HistAll.cpp index 042ca00..134badb 100644 --- a/2_HistAll/HistAll.cpp +++ b/2_HistAll/HistAll.cpp @@ -92,7 +92,7 @@ void CArgs_hsta::SetCmdLine( int argc, char* argv[] ) // parse command line args if( argc < 3 ) { - printf( "Usage: HistAll -chan=,, [options].\n" ); + printf( "Usage: HistAll -chan=,,.\n" ); exit( 42 ); } @@ -212,7 +212,8 @@ static void WriteScript( const vector &vp ) int np = vp.size(), nc = gArgs.chn.size(); - fprintf( f, "#!/bin/sh\n\n" ); + fprintf( f, "#!/bin/sh\n" ); + fprintf( f, "\n" ); for( int ip = 0; ip < np; ++ip ) { @@ -233,10 +234,7 @@ static void WriteScript( const vector &vp ) fprintf( f, "\n" ); fclose( f ); - -// make executable - - chmod( "HST/make.hst.sht", S_IRWXU | S_IRWXG | S_IRWXO ); + FileScriptPerms( "HST/make.hst.sht" ); } /* --------------------------------------------------------------- */ diff --git a/2_HistAll/driver.sht b/2_HistAll/driver.sht deleted file mode 100644 index 0ce3d28..0000000 --- a/2_HistAll/driver.sht +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -HistAll layer0_48_grn_sim_montage.xml -zmin=2 -zmax=2 -chan=1,2 - diff --git a/2_HistAll/hstgo.sht b/2_HistAll/hstgo.sht new file mode 100644 index 0000000..49acfe2 --- /dev/null +++ b/2_HistAll/hstgo.sht @@ -0,0 +1,16 @@ +#!/bin/sh + +# Purpose: +# Create 'HST' directory and script 'HST/make.hst.sht' to submit Hist1 jobs. +# +# > HistAll -zmin=i -zmax=j <-chan=,,>. +# +# Required: +# -chan=1,3 ;e.g., write histogram files for channels 1 and 3. +# +# Options: +# none + + +HistAll layer0_48_grn_sim_montage.xml -zmin=2 -zmax=2 -chan=1,2 + diff --git a/2_RGBM1Lyr/driver.sht b/2_RGBM1Lyr/driver.sht deleted file mode 100644 index db82549..0000000 --- a/2_RGBM1Lyr/driver.sht +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -RGBM1Lyr layer0_48_grn_sim_montage.xml RGB -z=0 -R=1,99.5 -G=0,99.5 -B=2,99.5 - - - diff --git a/2_RGBM1Lyr/rgb1go.sht b/2_RGBM1Lyr/rgb1go.sht new file mode 100644 index 0000000..01b9f98 --- /dev/null +++ b/2_RGBM1Lyr/rgb1go.sht @@ -0,0 +1,18 @@ +#!/bin/sh + +# Purpose: +# For one layer, create new folder TIF_tag and create scaled images there. +# +# > RGBM1Lyr -z=i <-[R,G,B]=i,pct> [options]. +# +# Required: +# tag ;text string like RGB that labels output folder and tifs. +# -R=0,85.0 ;for example, color channel-0 red using 85% of forground range. +# +# Options: +# -spanRGB=LLL ;three-char string like LTT specifies scaling by {L=whole layer, T=ea. tile} +# -lrbt=0,0,-1,-1 ;calculate average intensity in this ROI + + +RGBM1Lyr layer0_48_grn_sim_montage.xml RGB -z=0 -R=1,99.5 -G=0,99.5 -B=2,99.5 + diff --git a/2_RGBMerge/RGBMerge.cpp b/2_RGBMerge/RGBMerge.cpp index 54b5420..821d89c 100644 --- a/2_RGBMerge/RGBMerge.cpp +++ b/2_RGBMerge/RGBMerge.cpp @@ -244,7 +244,8 @@ static void WriteScript( vector &zlist ) int nz = zlist.size(); - fprintf( f, "#!/bin/sh\n\n" ); + fprintf( f, "#!/bin/sh\n" ); + fprintf( f, "\n" ); for( int iz = 0; iz < nz; ++iz ) { @@ -257,10 +258,7 @@ static void WriteScript( vector &zlist ) fprintf( f, "\n" ); fclose( f ); - -// make executable - - chmod( "make.merge.sht", S_IRWXU | S_IRWXG | S_IRWXO ); + FileScriptPerms( "make.merge.sht" ); } /* --------------------------------------------------------------- */ diff --git a/2_RGBMerge/driver.sht b/2_RGBMerge/driver.sht deleted file mode 100644 index e267130..0000000 --- a/2_RGBMerge/driver.sht +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -RGBMerge layer0_48_grn_sim_montage.xml RGB -zmin=0 -zmax=48 -R=1,99.5 -G=0,99.5 -B=2,99.5 - - - diff --git a/2_RGBMerge/rgbgo.sht b/2_RGBMerge/rgbgo.sht new file mode 100644 index 0000000..b99fe57 --- /dev/null +++ b/2_RGBMerge/rgbgo.sht @@ -0,0 +1,18 @@ +#!/bin/sh + +# Purpose: +# Create script 'make.merge.sht' to submit RGB1Lyr jobs. +# +# > RGBMerge -zmin=i -zmax=j <-[R,G,B]=i,pct> [options]. +# +# Required: +# tag ;text string like RGB that labels output folder and tifs. +# -R=0,85.0 ;for example, color channel-0 red using 85% of forground range. +# +# Options: +# -spanRGB=LLL ;three-char string like LTT specifies scaling by {L=whole layer, T=ea. tile} +# -lrbt=0,0,-1,-1 ;calculate average intensity in this ROI + + +RGBMerge layer0_48_grn_sim_montage.xml RGB -zmin=0 -zmax=48 -R=1,99.5 -G=0,99.5 -B=2,99.5 + diff --git a/macros/CLEAN.sht b/macros/CLEAN.sht index 8b9217b..ea99383 100644 --- a/macros/CLEAN.sht +++ b/macros/CLEAN.sht @@ -3,6 +3,7 @@ # Clean work files from older Lou-style temp structure # + rm lou-* rm *.log rm *.tif @@ -14,4 +15,3 @@ rm qual.* rm ./*/*map* rm ./*/*tf* - diff --git a/macros/JuanLayout.sht b/macros/JuanLayout.sht index c3f7ce0..00725f2 100644 --- a/macros/JuanLayout.sht +++ b/macros/JuanLayout.sht @@ -2,6 +2,7 @@ # Build rick file for juan + rm layout.txt for i in $(seq 0 99) @@ -13,4 +14,3 @@ done rm temp.txt - diff --git a/macros/ReplaceAll.sht b/macros/ReplaceAll.sht index d3a9e56..30751a8 100644 --- a/macros/ReplaceAll.sht +++ b/macros/ReplaceAll.sht @@ -1,5 +1,6 @@ #!/bin/sh + searchterm="Plate1_0/fixed_images" replaceterm="Plate1_0/TIF" inwhich="*.xml" diff --git a/macros/catlayout.sht b/macros/catlayout.sht index 50b20ba..082314a 100644 --- a/macros/catlayout.sht +++ b/macros/catlayout.sht @@ -3,6 +3,7 @@ # Concatenate Rick files for individual dirs into one big file # + dir=/groups/bock/bocklab/eric/forbill/cutout1 for i in $(seq 0 60) @@ -14,4 +15,3 @@ do fi done - diff --git a/macros/catlyr.sht b/macros/catlyr.sht index 8cef262..3f300e1 100644 --- a/macros/catlyr.sht +++ b/macros/catlyr.sht @@ -3,6 +3,7 @@ # Concatenate Rick files for individual dirs into one big file # + dir=/groups/bock/bocklab/people/eric/scratch/32stack-clahe/ for z in $(seq 7 119) @@ -11,4 +12,3 @@ do cat $dir$N".txt" >> Z7-119.txt done - diff --git a/macros/edit_filepath.sht b/macros/edit_filepath.sht index f36b068..05765d0 100644 --- a/macros/edit_filepath.sht +++ b/macros/edit_filepath.sht @@ -1,6 +1,5 @@ #!/bin/sh - # This script edits the file_path tags in TrakEM2 xml files. # It does simple substitutions at the start of the paths. # @@ -64,4 +63,3 @@ fi # Do substitutions on all lines sed 's|file_path="'$old'|file_path="'$new'|' < $1 > $v2 - diff --git a/macros/edit_title.sht b/macros/edit_title.sht index 63ca02d..f55cca8 100644 --- a/macros/edit_title.sht +++ b/macros/edit_title.sht @@ -1,6 +1,5 @@ #!/bin/sh - # This script edits the title tags in TrakEM2 xml files, # to change from one channel specifier to another. The # image names are expected to look like B7_15_channel, @@ -43,4 +42,3 @@ fi # Do substitutions on all lines sed 's|title="\(.*_[0-9]\{1,\}_\)'$old'|title="\1'$new'|' < $1 > $v2 - diff --git a/macros/lou_driver.sht b/macros/lou_driver.sht index 63af6b3..7e80127 100644 --- a/macros/lou_driver.sht +++ b/macros/lou_driver.sht @@ -1,5 +1,6 @@ #!/bin/sh + export MRC_TRIM=12 cd lou_example @@ -20,3 +21,4 @@ cp /groups/apig/tomo/lou_stuff/report.sht . cp /groups/apig/tomo/lou_stuff/runlsq.sht stack/ ./subfm.sht 0 2 + diff --git a/macros/newses.sht b/macros/newses.sht index 920c0a0..d785948 100644 --- a/macros/newses.sht +++ b/macros/newses.sht @@ -1,5 +1,5 @@ #!/bin/sh -qlogin -l new=true,interactive=true -pe batch $1 +qlogin -l new=true,interactive=true -pe batch $1 diff --git a/macros/rootpaths.sht b/macros/rootpaths.sht index 48a02bc..927d84a 100644 --- a/macros/rootpaths.sht +++ b/macros/rootpaths.sht @@ -1,5 +1,6 @@ #!/bin/sh + prfx=/groups/apig/tomo/Eric/eb_slide3_20X/Plate1_0/TIF sed 's|\(\.*\)|'$prfx'/\1|' < $1 > $2 diff --git a/macros/subdel.sht b/macros/subdel.sht index cf14000..099aac3 100644 --- a/macros/subdel.sht +++ b/macros/subdel.sht @@ -2,6 +2,6 @@ # > ./subdel.sht dirname -qsub -N del-$1 -cwd -V -b y -pe batch 1 rm -rf "$1" +qsub -N del-$1 -cwd -V -b y -pe batch 1 rm -rf "$1" diff --git a/macros/tar.sht b/macros/tar.sht index 174076a..acbaa4a 100644 --- a/macros/tar.sht +++ b/macros/tar.sht @@ -57,4 +57,3 @@ fi #qsub -N del-$srcdir -cwd -V -b y -pe batch 8 "tar -zxf $srcdir/Plate1_0.tar.gz -C $dsttop" - diff --git a/macros/test.sht b/macros/test.sht index dc9cc13..e75cc73 100644 --- a/macros/test.sht +++ b/macros/test.sht @@ -49,6 +49,7 @@ # echo no # fi + if [ "$1" != "" ] then echo is arg @@ -56,4 +57,3 @@ else echo no arg fi - diff --git a/macros/thmdown.sht b/macros/thmdown.sht index 94fe9a1..1d96aae 100644 --- a/macros/thmdown.sht +++ b/macros/thmdown.sht @@ -16,4 +16,3 @@ do cd .. done - diff --git a/macros/thmsame.sht b/macros/thmsame.sht index 43eb60a..49f0086 100644 --- a/macros/thmsame.sht +++ b/macros/thmsame.sht @@ -16,4 +16,3 @@ do cd .. done - diff --git a/zlineends.sht b/zlineends.sht index 50be6ff..b0fdfaf 100644 --- a/zlineends.sht +++ b/zlineends.sht @@ -22,4 +22,3 @@ else grep -rl $'\r' * fi -