[Swift-commit] r2642 - SwiftApps/SIDGrid/swift/swift_scripts/afni

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Mar 4 15:28:32 CST 2009


Author: andric
Date: 2009-03-04 15:28:31 -0600 (Wed, 04 Mar 2009)
New Revision: 2642

Added:
   SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIsnr.swift
Log:
For doing SNR ratios with AFNI

Added: SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIsnr.swift
===================================================================
--- SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIsnr.swift	                        (rev 0)
+++ SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIsnr.swift	2009-03-04 21:28:31 UTC (rev 2642)
@@ -0,0 +1,56 @@
+#---- for doing SNR on the PK2 afni data
+type file{}
+
+type AFNI_obj{
+file HEAD;
+file BRIK;
+};
+
+
+app (AFNI_obj volregResult, file resultVolregMotion) AFNI_volreg (string baseName, AFNI_obj inputTS, AFNI_obj referenceTS, string volregBaseString){
+    AFNI_3dvolreg "-twopass" "-twodup" "-dfile" @strcat("mot_",baseName) "-base" @strcat(volregBaseString,"+orig[225]") "-prefix" @strcat("volreg.",baseName) @inputTS.BRIK;
+}
+
+app (AFNI_obj meanResult) AFNI_mean (AFNI_obj meanInput, string baseName){
+    AFNI_3dTstat "-mean" "-prefix" @strcat("./mean.",baseName) @meanInput.BRIK;
+}
+
+app (AFNI_obj stdevResult) AFNI_stdev (AFNI_obj stdevInput, string baseName){
+    AFNI_3dTstat "-stdev" "-prefix" @strcat("./stdev.",baseName)  @stdevInput.BRIK;
+}
+
+app (AFNI_obj detrendResult) AFNI_detrend (AFNI_obj detrendInput, string baseName){
+    AFNI_3dDetrend "-polort" "3" "-prefix" @strcat("detrend.",baseName) @detrendInput.BRIK;
+}
+
+app (AFNI_obj ratioResult) AFNI_doratio (AFNI_obj stdevResult, AFNI_obj meanResult , string baseName){
+    AFNI_3dcalc "-verbose" "-a" @meanResult.BRIK "-b" @stdevResult.BRIK "-expr" "(a/b)" "-prefix" @strcat("snr.",baseName);
+}
+
+(AFNI_obj detrendResult, AFNI_obj stdevResult, AFNI_obj meanResult, AFNI_obj ratioResult) AFNI_snr (string baseName, AFNI_obj inputTS){
+    (meanResult) = AFNI_mean(inputTS, baseName);
+    (detrendResult) = AFNI_detrend(inputTS, baseName);
+    (stdevResult) = AFNI_stdev(detrendResult, baseName);
+    (ratioResult)  =  AFNI_doratio(stdevResult, meanResult, baseName);
+}
+
+
+string declarelist[] = ["PK2"];
+foreach subject in declarelist{
+    int runs[] = [1:8];
+    foreach run in runs{
+        AFNI_obj srun<simple_mapper; prefix=@strcat("ts.",run,"+orig.")>;
+        string baseName = @strcat(subject,".run",run);
+        AFNI_obj volregResult<simple_mapper;prefix=@strcat("volreg.",baseName,"+orig.")>;
+        AFNI_obj meanResult<simple_mapper;prefix=@strcat("mean.",baseName,"+orig.")>;
+        AFNI_obj stdevResult<simple_mapper;prefix=@strcat("stdev.",baseName,"+orig.")>;
+        AFNI_obj detrendResult<simple_mapper;prefix=@strcat("detrend.",baseName,"+orig.")>;
+        AFNI_obj ratioResult<simple_mapper;prefix=@strcat("snr.",baseName,"+orig.")>;
+        // begin set up volreg parameters
+        file resultVolregMotion<single_file_mapper; file=@strcat("mot_",baseName)>;
+        AFNI_obj volregRefTS<simple_mapper; prefix=@strcat("ts.4+orig.")>;
+        string volregBaseString = @strcat("ts.4");
+        (volregResult, resultVolregMotion) = AFNI_volreg(baseName, srun, volregRefTS, volregBaseString);
+        (detrendResult, stdevResult, meanResult, ratioResult) = AFNI_snr(baseName, volregResult);
+    }
+}


Property changes on: SwiftApps/SIDGrid/swift/swift_scripts/afni/AFNIsnr.swift
___________________________________________________________________
Name: svn:executable
   + *




More information about the Swift-commit mailing list