#!/bin/sh
# copyright and script setup
# feat - main FEAT command-line script
#
# Stephen Smith, FMRIB Image Analysis Group
#
# Copyright (C) 2002-2008 University of Oxford
#
# Part of FSL - FMRIB's Software Library
# http://www.fmrib.ox.ac.uk/fsl
# fsl@fmrib.ox.ac.uk
#
# Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance
# Imaging of the Brain), Department of Clinical Neurology, Oxford
# University, Oxford, UK
#
#
# LICENCE
#
# FMRIB Software Library, Release 5.0 (c) 2012, The University of
# Oxford (the "Software")
#
# The Software remains the property of the University of Oxford ("the
# University").
#
# The Software is distributed "AS IS" under this Licence solely for
# non-commercial use in the hope that it will be useful, but in order
# that the University as a charitable foundation protects its assets for
# the benefit of its educational and research purposes, the University
# makes clear that no condition is made or to be implied, nor is any
# warranty given or to be implied, as to the accuracy of the Software,
# or that it will be suitable for any particular purpose or for use
# under any specific conditions. Furthermore, the University disclaims
# all responsibility for the use which is made of the Software. It
# further disclaims any liability for the outcomes arising from using
# the Software.
#
# The Licensee agrees to indemnify the University and hold the
# University harmless from and against any and all claims, damages and
# liabilities asserted by third parties (including claims for
# negligence) which arise directly or indirectly from the use of the
# Software or the sale of any products based on the Software.
#
# No part of the Software may be reproduced, modified, transmitted or
# transferred in any form or by any means, electronic or mechanical,
# without the express permission of the University. The permission of
# the University is not required if the said reproduction, modification,
# transmission or transference is done without financial return, the
# conditions of this Licence are imposed upon the receiver of the
# product, and all original and amended source code is included in any
# transmitted product. You may be held legally responsible for any
# copyright infringement that is caused or encouraged by your failure to
# abide by these terms and conditions.
#
# You are not permitted under this Licence to use this Software
# commercially. Use for which any financial return is received shall be
# defined as commercial use, and includes (1) integration of all or part
# of the source code or the Software into a product for sale or license
# by or on behalf of Licensee to third parties or (2) use of the
# Software or any derivative of it for research with the final aim of
# developing software products for sale or license to a third party or
# (3) use of the Software or any derivative of it for research with the
# final aim of developing non-software products for sale or license to a
# third party, or (4) use of the Software to provide any service to an
# external organisation for which payment is received. If you are
# interested in using the Software commercially, please contact Isis
# Innovation Limited ("Isis"), the technology transfer company of the
# University, to negotiate a licence. Contact details are:
# innovation@isis.ox.ac.uk quoting reference DE/9564.
# the next line restarts using wish \
exec $FSLTCLSH "$0" "$@"
source $env(FSLDIR)/tcl/fslstart.tcl
proc fullFirstLevelAnalysis { session } {
global FSLDIR FSLSLASH fmri feat_files fsfroot logout confoundev_files
#setup FEAT output directory
if { $fmri(level) == 1 && $fmri(inputtype) == 1 } { #working in an existing feat directory
set FD $feat_files($session)
cd $FD
fsl:exec "/bin/rm ?endered_thresh_* cluster_* lmax_* prob_mask_* thresh_* tsplot/* stats/*; rmdir stats tsplot" -n -i
} else {
#setup new featdir name
if { $fmri(outputdir) != "" } {
if { $fmri(multiple) == 1 } {
set FD [ feat5:strip $fmri(outputdir) ].feat
} else {
set FD [ file rootname $feat_files($session) ]_[ file rootname [ file tail $fmri(outputdir) ] ].feat
}
} else {
set FD [ feat5:strip [ remove_ext $feat_files($session) ] ].feat
}
set FD [ new_filename $FD ]
fsl:exec "/bin/mkdir -p $FD" -n
}
cd $FD
set FD [ pwd ]
fsl:exec "mkdir -p logs" -n
set logout ${FD}/logs/feat1
fsl:exec "/bin/cp ${fsfroot}.fsf design.fsf"
set confevs ""
if { [ file exists confoundevs.txt ] } {
set confevs "confoundevs.txt"
}
set haltForModel 1
if { ! [ info exists fmri(featModelOpts) ] } {
set fmri(featModelOpts) ""
set haltForModel 0
}
set featModelID 0
if { $fmri(analysis) != 0 } {
set featModelID [ fsl:exec "${FSLDIR}/bin/feat_model design $confevs" $fmri(featModelOpts) -N feat0_model -l logs ]
}
set fsfroot ${FD}/design
#setup web pages
if { ! [ file exists .files ] } {
fsl:exec "mkdir .files;cp ${FSLDIR}/doc/fsl.css .files;ln -s ${FSLDIR}/doc/images .files/images"
}
fsl:echo report.html "
"
if { $fmri(featwatcher_yn) } {
FmribWebHelp file: ${FD}/report_log.html
} else {
fsl:echo "" "To view the FEAT progress and final report, point your web browser at ${FD}/report_log.html"
}
#
# setup some variables??
if { $fmri(inputtype) == 1 } {
# "FEAT directories" option
set STANDARD [ feat5:find_std $feat_files(1) standard ]
fsl:echo report_stats.html "
Higher-level FEAT results
(one for each lower-level contrast)
"
set ff_one $feat_files(1)
for { set nci 1 } { $nci <= $fmri(ncopeinputs) } { incr nci 1 } {
if { $fmri(copeinput.$nci) } {
set contrastname($nci) "[ feat5:getconname $ff_one $nci ]"
set feat_files($nci) ${FD}/cope$nci
set conname ""
if { $contrastname($nci) != "" } {
set conname "($contrastname($nci))"
}
fsl:echo report_stats.html "Lower-level contrast $nci $conname "
} else {
set feat_files($nci) -1
}
}
set fmri(multiple) $fmri(ncopeinputs)
} elseif { $fmri(inputtype) == 2 } {
# "3D cope input" option
set STANDARD [ feat5:find_std [ file dirname [ file dirname $feat_files(1) ] ] standard ]
set contrastname(1) ""
set fmri(multiple) 1
set feat_files(1) ${FD}/cope1
fsl:echo report_stats.html "