[Swift-commit] r6555 - in SwiftTutorials/OHBM_2013-06-16: . lib original

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Fri Jun 14 19:01:57 CDT 2013


Author: wilde
Date: 2013-06-14 19:01:57 -0500 (Fri, 14 Jun 2013)
New Revision: 6555

Added:
   SwiftTutorials/OHBM_2013-06-16/atlas00.swift
   SwiftTutorials/OHBM_2013-06-16/atlas01.swift
   SwiftTutorials/OHBM_2013-06-16/atlas02.swift
   SwiftTutorials/OHBM_2013-06-16/atlas03.swift
   SwiftTutorials/OHBM_2013-06-16/lib/
   SwiftTutorials/OHBM_2013-06-16/lib/AIR.swift
   SwiftTutorials/OHBM_2013-06-16/lib/FSL.swift
   SwiftTutorials/OHBM_2013-06-16/lib/ImageMagick.swift
   SwiftTutorials/OHBM_2013-06-16/lib/fMRI.swift
   SwiftTutorials/OHBM_2013-06-16/lib/types.swift
   SwiftTutorials/OHBM_2013-06-16/original/workflow.sh
   SwiftTutorials/OHBM_2013-06-16/original/workflow1.sh
Removed:
   SwiftTutorials/OHBM_2013-06-16/original/workflow.sh
Modified:
   SwiftTutorials/OHBM_2013-06-16/README
   SwiftTutorials/OHBM_2013-06-16/align.sh
   SwiftTutorials/OHBM_2013-06-16/apps
Log:
Checkpoint edits for all 4 demo phases building up to full script: atlas0{0,1,2,3}.swift

Modified: SwiftTutorials/OHBM_2013-06-16/README
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/README	2013-06-14 21:27:01 UTC (rev 6554)
+++ SwiftTutorials/OHBM_2013-06-16/README	2013-06-15 00:01:57 UTC (rev 6555)
@@ -48,6 +48,10 @@
   swift genatlas.swift             # processes data/ directory by default
   swift genatlas.swift -d=data_100 # process data_100/ directory
 
+  # While above are running, do this in another window to view its activity:
+
+    watch ps -u $USER -H
+
   # With most parallel work on a midway parition (edit sites.xml to set partition)
 
   swift -tc.file apps.midway genatlas.swift

Modified: SwiftTutorials/OHBM_2013-06-16/align.sh
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/align.sh	2013-06-14 21:27:01 UTC (rev 6554)
+++ SwiftTutorials/OHBM_2013-06-16/align.sh	2013-06-15 00:01:57 UTC (rev 6555)
@@ -1,53 +1,11 @@
 #!/bin/sh
 
-#AIR5=/home/wilde/software/AIR5.3.0
+ref=$1      # Input:  reference volume
+anat=$2     # Input:  subject volume
+resliced=$3 # Ouput:  rrealigned and resliced volume
 
-# Arguments: referenceImage (in) anatomicalImage (in) reslicedImage (out)
-
-ref=$1
-anat=$2
-resliced=$3
-
 time $AIR5/bin/alignlinear $ref $anat init.warp \
   -m 15 -t1 55 -t2 55 -x 1 -r 8 -c 0.1 -h 8 
 time $AIR5/bin/align_warp  $ref $anat refined.warp \
-  -m 1 12 -b1 .1 .1 .1  -b2 .1 .1 .1 -f init.warp -h 10000 -s 1024 2 2 -c .01 # -v -q -s 1024 2 2 -c .01
+  -m 1 12 -b1 .1 .1 .1  -b2 .1 .1 .1 -f init.warp -h 10000 -s 1024 2 2 -c .01
 time $AIR5/bin/reslice refined.warp $resliced -a $anat
-
-exit
-
-
-
-
-
-
-
-fsl=/project/wilde/software/fsl-5.0.4/fsl
-
-clean=y
-
-if [ $clean = y ]; then
-  rm *warp atlas* resliced*
-fi
-
-
-
-if true; then
-
-  warp 1
-  warp 2
-  warp 3
-  warp 4
-
-  time  $AIR5/bin/softmean atlas.hdr y null resliced1.img resliced2.img resliced3.img resliced4.img
-fi
-
-export FSLOUTPUTTYPE=NIFTI
-
-time $fsl/bin/slicer atlas.hdr -x .5 atlas-x.pgm
-time $fsl/bin/slicer atlas.hdr -y .5 atlas-y.pgm
-time $fsl/bin/slicer atlas.hdr -z .5 atlas-z.pgm
-
-time convert atlas-x.pgm atlas-x.gif
-time convert atlas-y.pgm atlas-y.gif
-time convert atlas-z.pgm atlas-z.gif

Modified: SwiftTutorials/OHBM_2013-06-16/apps
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/apps	2013-06-14 21:27:01 UTC (rev 6554)
+++ SwiftTutorials/OHBM_2013-06-16/apps	2013-06-15 00:01:57 UTC (rev 6555)
@@ -1,9 +1,9 @@
 midway sh          /bin/sh null null env::AIR5=/home/wilde/software/AIR5.3.0
 #localhost sh         /bin/sh
 
-localhost softmean    /home/wilde/software/AIR5.3.0/bin/softmean
 localhost alignlinear /home/wilde/software/AIR5.3.0/bin/alignlinear
 localhost align_warp  /home/wilde/software/AIR5.3.0/bin/align_warp
+localhost reslice     /home/wilde/software/AIR5.3.0/bin/reslice
 localhost softmean    /home/wilde/software/AIR5.3.0/bin/softmean
 localhost slicer      /project/wilde/software/fsl-5.0.4/fsl/bin/slicer null null env::FSLOUTPUTTYPE=NIFTI
 localhost convert     convert

Added: SwiftTutorials/OHBM_2013-06-16/atlas00.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/atlas00.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/atlas00.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,17 @@
+
+import "lib/types";
+
+app (file warp) alignlinear (file rh, file ri, file sh, file si)
+{
+  alignlinear @rh @sh @warp "-m" "12" "-q";
+}
+
+file refhdr <"data/reference.hdr">;  // Reference volume
+file refimg <"data/reference.img">;
+
+file subhdr <"data/anatomy4.hdr">;   // One subject volume
+file subimg <"data/anatomy4.img">;
+
+file output <"warp.out">;            // Output alignment
+
+output = alignlinear(refhdr,refimg,subhdr,subimg);

Added: SwiftTutorials/OHBM_2013-06-16/atlas01.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/atlas01.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/atlas01.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,24 @@
+
+import "lib/types";
+
+type Volume {
+  file header;
+  file image;
+};
+
+app (file warp) alignlinear (Volume ref, Volume subject, string params[])
+{
+  alignlinear @filename(ref.header) @filename(subject.header) @filename(warp) params;
+}
+
+string dataDir = @arg("d","data");  // Get a command-line argument, -d
+
+file alignment;
+
+Volume refVolume  <ext; exec="volmapper",name="data/reference">;
+Volume subjects[] <ext; exec="volmapper",prefix=@strcat(dataDir,"/anatomy")>;
+file   warps[]    <simple_mapper; location="warps",prefix="warp">;
+
+foreach subjectVolume, i in subjects {
+  warps[i] = alignlinear(refVolume, subjectVolume, ["-m","12","-q"]);
+}

Added: SwiftTutorials/OHBM_2013-06-16/atlas02.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/atlas02.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/atlas02.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,49 @@
+
+import "lib/types";
+import "lib/fMRI";
+import "lib/AIR";
+import "lib/FSL";
+import "lib/ImageMagick";
+
+# Full version of align() function
+
+(Volume alignedVol) align (Volume ref, Volume subject)
+{
+  file firstwarp = alignlinear(ref, subject,
+                     ["-m","15","-t1","55","-t2","55","-x","1","-r","8","-c","0.1","-h","8"]);
+  file refinedWarp = alignwarp(ref, subject, firstwarp,
+                      ["-m","1","12","-b1",".1",".1",".1","-b2",".1",".1",".1",
+                       "-h","10000","-s","1024","2","2","-c",".01"]);
+  alignedVol = reslice(refinedWarp,subject);
+}
+
+string dataDir = @arg("d","data");
+
+Volume referenceVolume <ext; exec="volmapper",name="data/reference">;
+Volume inputVolumes [] <ext; exec="volmapper",prefix=@strcat(dataDir,"/anatomy")>;
+Volume outputVolumes[];
+
+# Align all subjects
+
+foreach v, i in inputVolumes {
+  Volume aligned <ext; exec="volmapper",name=@strcat("work/aligned",i)>;
+  aligned = align(referenceVolume, v);
+  outputVolumes[i] = aligned;
+}
+
+# Create the "averaged" atlas
+
+Volume atlasVolume <ext; exec="volmapper",name="output/atlas">;
+atlasVolume = softmean(outputVolumes);
+
+# Extract x, y, z slices for inspection
+
+file xSlice<"output/atlas-x.png">;
+file ySlice<"output/atlas-y.png">;
+file zSlice<"output/atlas-z.png">;
+
+# Convert x, y, z planes to viewable files
+
+xSlice = convert(slicer(atlasVolume,"x"));
+ySlice = convert(slicer(atlasVolume,"y"));
+zSlice = convert(slicer(atlasVolume,"z"));

Added: SwiftTutorials/OHBM_2013-06-16/atlas03.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/atlas03.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/atlas03.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,38 @@
+
+import "lib/types";
+import "lib/fMRI";
+import "lib/AIR";
+import "lib/FSL";
+import "lib/ImageMagick";
+
+# Perform align() function in an external shell script
+
+file   alignScript<"align.sh">;
+
+app (Volume alignedVol) align_sh (file script, Volume reference, Volume input)
+{
+  sh @script @filename(reference.image) @filename(input.image) @filename(alignedVol.image);
+}
+
+string dataDir = @arg("d","data");
+
+Volume referenceVolume <ext; exec="volmapper",name="data/reference">;
+Volume inputVolumes [] <ext; exec="volmapper",prefix=@strcat(dataDir,"/anatomy")>;
+Volume outputVolumes[];
+
+foreach v, i in inputVolumes {
+  Volume aligned <ext; exec="volmapper",name=@strcat("work/aligned",i)>;
+  aligned = align_sh(alignScript,referenceVolume, v);
+  outputVolumes[i] = aligned;
+}
+
+Volume atlasVolume <ext; exec="volmapper",name="output/atlas">;
+atlasVolume = softmean(outputVolumes);
+
+file xSlice<"output/atlas-x.png">;
+file ySlice<"output/atlas-y.png">;
+file zSlice<"output/atlas-z.png">;
+
+xSlice = convert(slicer(atlasVolume,"x"));
+ySlice = convert(slicer(atlasVolume,"y"));
+zSlice = convert(slicer(atlasVolume,"z"));

Added: SwiftTutorials/OHBM_2013-06-16/lib/AIR.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/lib/AIR.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/lib/AIR.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,20 @@
+
+app (Volume atlas) softmean (Volume v[])
+{
+  softmean @filename(atlas.header) "y" "null" @filenames(v);
+}
+
+app (file warp) alignlinear (Volume ref, Volume subject, string params[])
+{
+  alignlinear @filename(ref.header) @filename(subject.header) @filename(warp) params;
+}
+
+app (file warp) alignwarp (Volume ref, Volume subject, file initWarp, string params[])
+{
+  align_warp @filename(ref.header) @filename(subject.header) @filename(warp) "-f" @filename(initWarp) params;
+}
+
+app (Volume v) reslice (file warp, Volume subject)
+{
+  reslice @filename(warp) @filename(v.header) "-a" @filename(subject.header);
+}

Added: SwiftTutorials/OHBM_2013-06-16/lib/FSL.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/lib/FSL.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/lib/FSL.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,5 @@
+
+app (file pgm) slicer (Volume v, string axis)
+{
+  slicer @filename(v.header) @strcat("-",axis) .5 @filename(pgm);
+}

Added: SwiftTutorials/OHBM_2013-06-16/lib/ImageMagick.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/lib/ImageMagick.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/lib/ImageMagick.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,6 @@
+
+app (file o) convert (file i)
+{
+  convert @i @o;
+}
+

Added: SwiftTutorials/OHBM_2013-06-16/lib/fMRI.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/lib/fMRI.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/lib/fMRI.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,5 @@
+
+type Volume {
+  file header;
+  file image;
+};

Added: SwiftTutorials/OHBM_2013-06-16/lib/types.swift
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/lib/types.swift	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/lib/types.swift	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,2 @@
+
+type file;

Deleted: SwiftTutorials/OHBM_2013-06-16/original/workflow.sh
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/original/workflow.sh	2013-06-14 21:27:01 UTC (rev 6554)
+++ SwiftTutorials/OHBM_2013-06-16/original/workflow.sh	2013-06-15 00:01:57 UTC (rev 6555)
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-AIR5=$HOME/software/AIR5.3.0
-fsl=/project/wilde/software/fsl-5.0.4/fsl
-
-if true; then
-
-#time  $AIR5/bin/align_warp anatomy1.img reference.img warp1.warp -m 1 12 -s 1024 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  -h 10000 -v -j # -q
-
-time  $AIR5/bin/align_warp reference.img anatomy1.img warp1.warp -m 1 12  -b1 .1 .1 .1  -b2 .1 .1 .1  -h 10000 -v -s 1024 2 2 -c .01  -f out # -q -s 1024 2 2 -c .01
-
-
-time  $AIR5/bin/align_warp anatomy2.img reference.img warp2.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
-time  $AIR5/bin/align_warp anatomy3.img reference.img warp3.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
-time  $AIR5/bin/align_warp anatomy4.img reference.img warp4.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
-time  $AIR5/bin/reslice warp1.warp resliced1
-time  $AIR5/bin/reslice warp2.warp resliced2
-time  $AIR5/bin/reslice warp3.warp resliced3
-time  $AIR5/bin/reslice warp4.warp resliced4
-time  $AIR5/bin/softmean atlas.hdr y null resliced1.img resliced2.img resliced3.img resliced4.img
-fi
-
-export FSLOUTPUTTYPE=NIFTI
-
-time $fsl/bin/slicer atlas.hdr -x .5 atlas-x.pgm
-time $fsl/bin/slicer atlas.hdr -y .5 atlas-y.pgm
-time $fsl/bin/slicer atlas.hdr -z .5 atlas-z.pgm
-time convert atlas-x.pgm atlas-x.gif
-time convert atlas-y.pgm atlas-y.gif
-time convert atlas-z.pgm atlas-z.gif

Added: SwiftTutorials/OHBM_2013-06-16/original/workflow.sh
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/original/workflow.sh	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/original/workflow.sh	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+#
+# Original workflow from PC1 and DBIC
+#
+
+AIR5.2.5/bin/align_warp anatomy1.img reference.img warp1.warp -m 12 -q
+AIR5.2.5/bin/align_warp anatomy2.img reference.img warp2.warp -m 12 -q
+AIR5.2.5/bin/align_warp anatomy3.img reference.img warp3.warp -m 12 -q
+AIR5.2.5/bin/align_warp anatomy4.img reference.img warp4.warp -m 12 -q
+
+AIR5.2.5/bin/reslice warp1.warp resliced1
+AIR5.2.5/bin/reslice warp2.warp resliced2
+AIR5.2.5/bin/reslice warp3.warp resliced3
+AIR5.2.5/bin/reslice warp4.warp resliced4
+
+AIR5.2.5/bin/softmean atlas.hdr y null resliced1.img resliced2.img resliced3.img resliced4.img
+
+fsl/bin/slicer atlas.hdr -x .5 atlas-x.pgm
+fsl/bin/slicer atlas.hdr -y .5 atlas-y.pgm
+fsl/bin/slicer atlas.hdr -z .5 atlas-z.pgm
+
+convert atlas-x.pgm atlas-x.gif
+convert atlas-y.pgm atlas-y.gif
+convert atlas-z.pgm atlas-z.gif

Copied: SwiftTutorials/OHBM_2013-06-16/original/workflow1.sh (from rev 6550, SwiftTutorials/OHBM_2013-06-16/original/workflow.sh)
===================================================================
--- SwiftTutorials/OHBM_2013-06-16/original/workflow1.sh	                        (rev 0)
+++ SwiftTutorials/OHBM_2013-06-16/original/workflow1.sh	2013-06-15 00:01:57 UTC (rev 6555)
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+AIR5=$HOME/software/AIR5.3.0
+fsl=/project/wilde/software/fsl-5.0.4/fsl
+
+if true; then
+
+#time  $AIR5/bin/align_warp anatomy1.img reference.img warp1.warp -m 1 12 -s 1024 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  -h 10000 -v -j # -q
+
+time  $AIR5/bin/align_warp reference.img anatomy1.img warp1.warp -m 1 12  -b1 .1 .1 .1  -b2 .1 .1 .1  -h 10000 -v -s 1024 2 2 -c .01  -f out # -q -s 1024 2 2 -c .01
+
+
+time  $AIR5/bin/align_warp anatomy2.img reference.img warp2.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
+time  $AIR5/bin/align_warp anatomy3.img reference.img warp3.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
+time  $AIR5/bin/align_warp anatomy4.img reference.img warp4.warp -m 1 12 -s 64 2 2 -c .01 -b1 .1 .1 .1 -b2 .1 .1 .1  # -q
+time  $AIR5/bin/reslice warp1.warp resliced1
+time  $AIR5/bin/reslice warp2.warp resliced2
+time  $AIR5/bin/reslice warp3.warp resliced3
+time  $AIR5/bin/reslice warp4.warp resliced4
+time  $AIR5/bin/softmean atlas.hdr y null resliced1.img resliced2.img resliced3.img resliced4.img
+fi
+
+export FSLOUTPUTTYPE=NIFTI
+
+time $fsl/bin/slicer atlas.hdr -x .5 atlas-x.pgm
+time $fsl/bin/slicer atlas.hdr -y .5 atlas-y.pgm
+time $fsl/bin/slicer atlas.hdr -z .5 atlas-z.pgm
+time convert atlas-x.pgm atlas-x.gif
+time convert atlas-y.pgm atlas-y.gif
+time convert atlas-z.pgm atlas-z.gif




More information about the Swift-commit mailing list