Skip to content
Snippets Groups Projects
cluster2html 2.49 KiB
#!/bin/sh

#   convert cluster text output to html
#
#   Mark Jenkinson, FMRIB Image Analysis Group
#
#   Copyright (C) 1999-2004 University of Oxford
#
#   SHCOPYRIGHT

Usage() {
    echo "Usage: cluster2html <featdir> <inroot> [-std]"
    echo "<inroot> should not contain the _std extension"
    exit
}

[ "$1" = "" -o "$2" = "" ] && Usage

cd $1
shift

FSLSLASH=""
if [ X`uname | grep CYGWIN`X != XX ] ; then
    FSLSLASH="C:/cygwin"
fi

if [ "$2" = "" ] ; then
    echo "<HTML><TITLE>Cluster List</TITLE><BODY BACKGROUND=\"file:${FSLSLASH}$FSLDIR/doc/images/fsl-bg.jpg\">" > $1.html
    echo "<CENTER><hr>Co-ordinate information for $1 - <A HREF=\"$1_std.html\">Standard-space version</A> (if present) - <A HREF=\"report.html\">back</A> to main FEAT report<hr>" >> $1.html

    echo "<H1>Cluster List</H1>" >> $1.html
    echo "<table border=3 cellspacing=3>" >> $1.html
    cat $1.txt | sed "s/	/<td>/g" \
	       | sed "s/^\(.*\)$/<tr><td>\1<\/tr>/" \
               | sed "1s/<td>/<th>/g" >> $1.html
    echo "</TABLE>" >> $1.html

    lmaxname=`echo $1 | sed "s/cluster/lmax/g"`.txt
    if [ -f $lmaxname ] ; then
	echo "<br><br><H1>Local Maxima</H1>" >> $1.html
	echo "<table border=3 cellspacing=3>" >> $1.html
	cat $lmaxname | sed "s/	/<td>/g" \
		      | sed "s/^\(.*\)$/<tr><td>\1<\/tr>/" \
                      | sed "1s/<td>/<th>/g" >> $1.html
	echo "</TABLE>" >> $1.html
    fi

    echo "</BODY></HTML>" >> $1.html
else
    echo "<HTML><TITLE>Standard-Space Cluster List</TITLE><BODY BACKGROUND=\"file:${FSLSLASH}$FSLDIR/doc/images/fsl-bg.jpg\">" > $1_std.html
    echo "<CENTER><hr>Co-ordinate information for $1 - " >> $1_std.html
    if [ -f $1.html ] ; then
	echo "<A HREF=\"$1.html\">voxel-space version</A> - " >> $1_std.html
    fi
    echo "<A HREF=\"report.html\">back</A> to main FEAT report<hr>" >> $1_std.html

    echo "<H1>Cluster List</H1>" >> $1_std.html
    echo "<table border=3 cellspacing=3>" >> $1_std.html
    cat $1_std.txt | sed "s/	/<td>/g" \
	           | sed "s/^\(.*\)$/<tr><td>\1<\/tr>/" \
                   | sed "1s/<td>/<th>/g" >> $1_std.html
    echo "</TABLE>" >> $1_std.html

    lmaxname=`echo $1 | sed "s/cluster/lmax/g"`_std.txt
    if [ -f $lmaxname ] ; then
	echo "<br><br><H1>Local Maxima</H1>" >> $1_std.html
	echo "<table border=3 cellspacing=3>" >> $1_std.html
	cat $lmaxname | sed "s/	/<td>/g" \
		      | sed "s/^\(.*\)$/<tr><td>\1<\/tr>/" \
                      | sed "1s/<td>/<th>/g" >> $1_std.html
	echo "</TABLE>" >> $1_std.html
    fi

    echo "</BODY></HTML>" >> $1_std.html
fi