JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for FSL Archives


FSL Archives

FSL Archives


FSL@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Proportional Font

LISTSERV Archives

LISTSERV Archives

FSL Home

FSL Home

FSL  February 2009

FSL February 2009

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: flsview layout

From:

wolf zinke <[log in to unmask]>

Reply-To:

FSL - FMRIB's Software Library <[log in to unmask]>

Date:

Wed, 25 Feb 2009 11:33:22 +0100

Content-Type:

multipart/mixed

Parts/Attachments:

Parts/Attachments

text/plain (71 lines) , Rcalc (1 lines) , vol_slicer (331 lines) , slice_selection (358 lines)

Hi,

As Christian suggested you can nicely script the tools provided by FSL 
to fullfill quiet a lot of needs. But sometimes it might be nice to have 
such scripts, or at least some examples that can be used as a rough 
idea. I attached some scripts that I created to produce some images with 
selected slices. It makes sense only if you want to use not more than 2 
stats images (sorry, but otherwise MRICron 
(www.sph.sc.edu/comd/rorden/mricron) might be useful). I am a bit lazy 
and use a tool that pipes math expressions into R (www.r-project.org/), 
so this has to be installed or the Rcalc command be replaced with 
something comparable (like ccalc from the AFNI package). I have not 
tested the scripts thoroughfully, so I can't guarantee the functionality 
and I would also be happy to hear about problems or bugs.

You can than easily import the images into any image processing software 
(e.g. Corel Draw) and arrange them the way you like.

I hope this helps,
wolf



Christian F. Beckmann wrote:
> Hi
>
> In cases where you only need a simple stats overlay (1 or 2 stats 
> images ontop of a background image) then the FSL tools 'overlay', 
> 'slicer' and 'pngappend' can be used (and scripted, hurray!) without 
> the need to grab anything from the screen. 'slicer' can also achieve 
> the latter, i.e. produce a light-box view from all or a sub-set of all 
> the slices. These are the tools used to produce the figures you see in 
> the FEAT web reports.
> hth
> Christian
>
>
>
> On 24 Feb 2009, at 14:24, Michael Rohan wrote:
>
>> Hi,
>> Is it possible to have fslview place the three orthographic views in one
>> horizontal row on the screen? This will make it easier to fit grabs 
>> into a
>> document (without that blank 4th place).
>>
>> Along the same lines, in the lightbox view is it possible to display a
>> subset of the slices, whether with a specified interval or a slice list?
>>
>> Thanks,
>> Mike Rohan
>
> _______________________________________________
> Christian F. Beckmann, DPhil
> Senior Lecturer, Clinical Neuroscience Department
> Division of Neuroscience and Mental Health
> Imperial College London, Hammersmith Campus
> Rm 419, Burlington Danes Bldg, Du Cane Road, London W12 0NN, UK
> Tel.: +44 (0)20 7594 6685   ---   Fax: +44 (0)20 7594 6548
> Email: [log in to unmask]
> http://www.imperial.ac.uk/medicine/people/c.beckmann/
>
> Senior Research Fellow, FMRIB Centre
> University of Oxford
> JR Hospital - Oxford OX3 9DU
> Tel.: +44 (0)1865 222551 --- Fax: +44 (0)1865 222717
> Email: [log in to unmask]
> http://www.fmrib.ox.ac.uk/~beckmann




#!/bin/bash # Usage() { cat << EOF Usage: Rcalc <"expression"> evaluates the expression by piping it to R (R syntax applies) ########################################################### ## (c) wolf zinke (2008) - part of the MaFIA toolbox ## ## for comments and questions: [log in to unmask] ## ########################################################### EOF exit 1 } if [ $# -lt 1 ]; then Usage else funcal=$1 fi funcal="x = $funcal; write.table(x, file = '/tmp/Rout.tmp',row.names=F,col.names=F); q();" echo "$funcal" | R --vanilla --slave cat /tmp/Rout.tmp rm /tmp/Rout.tmp
#!/bin/bash # Usage() { cat << EOF     Usage: vol_slicer <bg_img> <slc_num>     OPTIONS:             -x -y -z specify set of slices to save as image (e.g. -z "2 4 6 8 10")                                 numbers > 1 specify slicenumbers, numbers < 1 specify proportions.             -stat <flnm> statistical map             -trans transparent colors             -pxl number of pixels seperating two images (default:10)             -thick increase width of slice line             -neg render also the negative stat map             -noside do not show right side label             -s <sclfctr> scalinf factor             -bgint <min max> intensity range for the background image             -statrng <min max> scaling theshold             -out <outname> filenmae for output data             -keep do not delete temporary files             ###########################################################             ## (c) wolf zinke (2008) - part of the MaFIA toolbox ##             ## for comments and questions: [log in to unmask] ##             ########################################################### EOF     exit 1 } #----------------------------------------------------------------------# if [ $# -lt 2 ]; then     Usage else     bg_img=`remove_ext $1`;     shift fi #----------------------------------------------------------------------# outnm="${bg_img}_sliceselection.png" bgint=`fslstats $bg_img -r` smint="3 10" scl=1 pxl=10 sdlbl="" trans=0 do_keep=0 do_neg=0 do_thick=0 tmpdir=`tmpnam tmpPSC` xstr="" ystr="" zstr="" slcwdth=1 statmap="" rm $tmpdir #----------------------------------------------------------------------# # get options while [ $# -gt 0 ] ; do     case $1 in        -out) outnm=$2                 shift 2                 ;;        -stat) statmap="$statmap `remove_ext $2`"                 shift 2                 ;;         -x) xstr="$1 '$2'"                 xslc="$2"                 shift 2                 ;;         -y) ystr="$1 '$2'"                 yslc="$2"                 shift 2                 ;;         -z) zstr="$1 '$2'"                 zslc="$2"                 shift 2                 ;;         -s) scl=$2                 shift 2                 ;;        -bgint) bgint="$2 $3"                 shift 3                 ;;      -statrng) smint="$2 $3"                 shift 3                 ;;       -thick) do_thick=1                 slcwdth=3                 shift                 ;;       -trans) trans=1                 shift                 ;;      -noside) sdlbl="-u"                 shift                 ;;        -neg) do_neg=1                 shift                 ;;        -pxl) pxl=$2                 shift 2                 ;;        -keep) do_keep=1                 shift                 ;;           -*) echo "Wrong option: <$1>"                 echo ""                 Usage                 ;;            *) break                 ;;     esac done mkdir $tmpdir; #----------------------------------------------------------------------# # prepare overlay image if [ "$statmap" ] then     statstr=""     cnt=0     for cstat in $statmap     do         cnt=$(($cnt+1))         statstr="$statstr $cstat $smint"     done #echo "$statstr"     if [ $do_neg -eq 1 ]     then         if [ $cnt -gt 1 ]         then             echo ""             echo "ERROR: negative map could only be used with one statistical map as input"             echo ""             exit         fi         fslmaths $statmap -mul -1 $tmpdir/negmap         statstr="$statstr $tmpdir/negmap $smint"     fi #echo " overlay $trans 1 $bg_img $bgint $statstr $tmpdir/curr_img" #exit     overlay $trans 1 $bg_img $bgint $statstr $tmpdir/curr_img else     imcp $bg_img $tmpdir/curr_img fi #----------------------------------------------------------------------# # get the slice representation fslmaths $bg_img -mul 0 -add 1 $tmpdir/all_slices -odt char Xsz=`fslval $bg_img dim1` Ysz=`fslval $bg_img dim2` Zsz=`fslval $bg_img dim3` png_str="" set_cnt=0 if [ "$xstr" ] then     xslices=""     fslmaths $tmpdir/all_slices -mul 0 $tmpdir/xslcsel -odt char     for cslc in $xslc     do         if [ $cslc -gt $Xsz ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in X dimension"             echo ""             rm -r $tmpdir             exit         fi         slicer $tmpdir/curr_img -s $scl -u -x -$cslc $tmpdir/X_${cslc}.png         xslices="$xslices $tmpdir/X_${cslc}.png"         if [ $do_thick -eq 1 ]         then             cslc=$(($cslc+1))         fi         fslmaths $tmpdir/all_slices -roi $cslc $slcwdth 0 $Ysz 0 $Zsz 0 1 $tmpdir/tmp_slcsel         fslmaths $tmpdir/xslcsel -add $tmpdir/tmp_slcsel $tmpdir/xslcsel     done     overlay 0 1 $bg_img $bgint $tmpdir/xslcsel 1 4 $tmpdir/Xslc_vol     slicer $tmpdir/Xslc_vol -s $scl $sdlbl -y 0.5 $tmpdir/XselY.png -z 0.6 $tmpdir/XselZ.png     pngappend $tmpdir/XselY.png + $pxl $tmpdir/XselZ.png $tmpdir/Xsel.png     appstr="pngappend $tmpdir/Xsel.png"     for cpng in $xslices     do         appstr="$appstr + $pxl $cpng"     done     appstr="$appstr $tmpdir/Xset.png"     eval $appstr     png_str="$png_str $tmpdir/Xset.png"     set_cnt=$(($set_cnt+1)) fi if [ "$ystr" ] then     yslices=""     fslmaths $tmpdir/all_slices -mul 0 $tmpdir/yslcsel -odt char     for cslc in $yslc     do         if [ $cslc -gt $Ysz ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in Y dimension"             echo ""             rm -r $tmpdir             exit         fi         slicer $tmpdir/curr_img -s $scl -u -y -$cslc $tmpdir/Y_${cslc}.png         yslices="$yslices $tmpdir/Y_${cslc}.png"         if [ $do_thick -eq 1 ]         then             cslc=$(($cslc+1))         fi         fslmaths $tmpdir/all_slices -roi 0 $Xsz $cslc $slcwdth 0 $Zsz 0 1 $tmpdir/tmp_slcsel         fslmaths $tmpdir/yslcsel -add $tmpdir/tmp_slcsel $tmpdir/yslcsel     done     overlay 0 1 $bg_img $bgint $tmpdir/yslcsel 1 4 $tmpdir/Yslc_vol     slicer $tmpdir/Yslc_vol -s $scl $sdlbl -x 0.4 $tmpdir/YselX.png -z 0.6 $tmpdir/YselZ.png     pngappend $tmpdir/YselX.png + $pxl $tmpdir/YselZ.png $tmpdir/Ysel.png     appstr="pngappend $tmpdir/Ysel.png"     for cpng in $yslices     do         appstr="$appstr + $pxl $cpng"     done     appstr="$appstr $tmpdir/Yset.png"     eval $appstr     png_str="$png_str $tmpdir/Yset.png"     set_cnt=$(($set_cnt+1)) fi if [ "$zstr" ] then     zslices=""     fslmaths $tmpdir/all_slices -mul 0 $tmpdir/zslcsel -odt char     for cslc in $zslc     do         if [ $cslc -gt $Zsz ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in Z dimension"             echo ""             rm -r $tmpdir             exit         fi         slicer $tmpdir/curr_img -s $scl -u -z -$cslc $tmpdir/Z_${cslc}.png         zslices="$zslices $tmpdir/Z_${cslc}.png"         if [ $do_thick -eq 1 ]         then             cslc=$(($cslc+1))         fi         fslmaths $tmpdir/all_slices -roi 0 $Xsz 0 $Ysz $cslc $slcwdth 0 1 $tmpdir/tmp_slcsel         fslmaths $tmpdir/zslcsel -add $tmpdir/tmp_slcsel $tmpdir/zslcsel     done     overlay 0 1 $bg_img $bgint $tmpdir/zslcsel 1 4 $tmpdir/Zslc_vol     slicer $tmpdir/Zslc_vol -s $scl $sdlbl -x 0.4 $tmpdir/ZselX.png -y 0.5 $tmpdir/ZselY.png     pngappend $tmpdir/ZselX.png + $pxl $tmpdir/ZselY.png $tmpdir/Zsel.png     appstr="pngappend $tmpdir/Zsel.png"     for cpng in $zslices     do         appstr="$appstr + $pxl $cpng"     done     appstr="$appstr $tmpdir/Zset.png"     eval $appstr     png_str="$png_str $tmpdir/Zset.png"     set_cnt=$(($set_cnt+1)) fi #----------------------------------------------------------------------# if [ $set_cnt -gt 1 ] then     cnt=0     for cstr in $png_str     do         cnt=$(($cnt+1))         if [ $cnt -eq 1 ]         then             appstr="pngappend $cstr"         else             appstr="$appstr - $pxl $cstr"         fi     done     appstr="$appstr $outnm"     eval $appstr else     cp $png_str $outnm fi #----------------------------------------------------------------------# if [ $do_keep -eq 0 ] then     rm -r $tmpdir fi
#!/bin/bash # Usage() { cat << EOF     Usage: slice_selection <flnm> [options]     OPTIONS:                 -ol overlay image (must have the same dimensions as <flnm>!)                 -out filename of the image file (png)                 -s scaling factor                 -u do not show right side marker                 -x -y -z specify set of slices to save as image (e.g. -z "2 4 6 8 10")                             numbers > 0 specify slicenumbers, numbers < 0 specify proportions.                 -comb create a huge image with slices for all dimensions combined                             otherwise for each dimension a seperate image will be created.                 -keep do not delete temporary files             ###########################################################             ## (c) wolf zinke (2008) - part of the MaFIA toolbox ##             ## > MAcaque Functional Image Analysis < ##             ## for comments and questions: [log in to unmask] ##             ########################################################### EOF exit 1 } #----------------------------------------------------------------------# if [ $# -lt 1 ]; then     Usage else     flnm=`remove_ext $1`;     shift fi imgfl=${flnm}_slices.png sc=1 olimg="" do_ol=0 do_x=0 do_y=0 do_z=0 slc_spec=0 do_comb=0 do_keep=0 uopt="" while [ $# -gt 0 ] ; do     case $1 in     -ol) olimg=$2            do_ol=1            shift 2            ;;     -out) imgfl=$2            shift 2            ;;     -x) X=$2            do_x=1            slc_spec=1            shift 2            ;;     -y) Y=$2            do_y=1            slc_spec=1            shift 2            ;;     -z) Z=$2            do_z=1            slc_spec=1            shift 2            ;;    -s) sc=$2            shift 2            ;;    -0) uopt=-u            shift            ;;    -comb) do_comb=1            shift            ;;   -keep) do_keep=1            shift            ;;      -*) echo "Wrong option: <$1>"            echo ""            Usage            ;;        *) break            ;;     esac done if [ $slc_spec -eq 0 ] then     echo ""     echo "ERROR: No slices specified!"     echo ""     exit fi #----------------------------------------------------------------------# tmpdir=`tmpnam tmpSLC` rm -f $tmpdir mkdir $tmpdir #----------------------------------------------------------------------# if [ $do_ol -eq 1 ] then     slc_call="slicer $flnm $olimg $uopt -s $sc" else     slc_call="slicer $flnm $uopt -s $sc" fi if [ $do_comb -eq 1 ] then     comb_call="pngappend"     comb_app=0 fi #----------------------------------------------------------------------# if [ $do_x -eq 1 ] then     comb_x="pngappend"     xdim=`fslval $flnm dim1`     cnt=0     for cslc in $X     do         cnt=$(($cnt+1))     done     lnbrk=`Rcalc "ceiling(sqrt($cnt))"`     cnt=0     col_cnt=0     for cslc in $X     do         if [ $cslc -gt $xdim ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in X dimension"             echo ""             rm -r $tmpdir             exit         fi         slc_call="$slc_call -x $cslc $tmpdir/slx_${cslc}.png"         cnt=$(($cnt+1))         col_cnt=$(($col_cnt+1))         if [ $cnt -eq 1 ]         then             comb_x="$comb_x $tmpdir/slx_${cslc}.png"         else             if [ $do_comb -eq 1 ]             then                 comb_x="$comb_x + 10 $tmpdir/slx_${cslc}.png"             else                 if [ $col_cnt -gt $lnbrk ]                 then                     comb_x="$comb_x - 10 $tmpdir/slx_${cslc}.png"                     col_cnt=1                 else                     comb_x="$comb_x + 10 $tmpdir/slx_${cslc}.png"                 fi             fi         fi     done     comb_x="$comb_x $tmpdir/slx.png"     if [ $do_comb -eq 1 ]     then         if [ $comb_app -eq 0 ]         then             comb_call="$comb_call $tmpdir/slx.png"         else             comb_call="$comb_call - 10 $tmpdir/slx.png"         fi         comb_app=1     fi fi #----------------------------------------------------------------------# if [ $do_y -eq 1 ] then     comb_y="pngappend"     ydim=`fslval $flnm dim2`     cnt=0     for cslc in $Y     do         cnt=$(($cnt+1))     done     lnbrk=`Rcalc "ceiling(sqrt($cnt))"`     cnt=0     col_cnt=0     for cslc in $Y     do         if [ $cslc -gt $ydim ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in Y dimension"             echo ""             rm -r $tmpdir             exit         fi         slc_call="$slc_call -y $cslc $tmpdir/sly_${cslc}.png"         cnt=$(($cnt+1))         col_cnt=$(($col_cnt+1))         if [ $cnt -eq 1 ]         then             comb_y="$comb_y $tmpdir/sly_${cslc}.png"         else             if [ $do_comb -eq 1 ]             then                 comb_y="$comb_y + 10 $tmpdir/sly_${cslc}.png"             else                 if [ $col_cnt -gt $lnbrk ]                 then                     comb_y="$comb_y - 10 $tmpdir/sly_${cslc}.png"                     col_cnt=1                 else                     comb_y="$comb_y + 10 $tmpdir/sly_${cslc}.png"                 fi             fi         fi     done     comb_y="$comb_y $tmpdir/sly.png"     if [ $do_comb -eq 1 ]     then         if [ $comb_app -eq 0 ]         then             comb_call="$comb_call $tmpdir/sly.png"         else             comb_call="$comb_call - 10 $tmpdir/sly.png"         fi         comb_app=1     fi fi #----------------------------------------------------------------------# if [ $do_z -eq 1 ] then     comb_z="pngappend"     zdim=`fslval $flnm dim3`     cnt=0     for cslc in $Z     do         cnt=$(($cnt+1))     done     lnbrk=`Rcalc "ceiling(sqrt($cnt))"`     cnt=0     col_cnt=0     for cslc in $Z     do         if [ $cslc -gt $zdim ]         then             echo ""             echo "ERROR: Selected slice <$cslc> exceed number of slices in Z dimension"             echo ""             rm -r $tmpdir             exit         fi         slc_call="$slc_call -z $cslc $tmpdir/slz_${cslc}.png"         cnt=$(($cnt+1))         col_cnt=$(($col_cnt+1))         if [ $cnt -eq 1 ]         then             comb_z="$comb_z $tmpdir/slz_${cslc}.png"         else             if [ $do_comb -eq 1 ]             then                 comb_z="$comb_z + 10 $tmpdir/slz_${cslc}.png"             else                 if [ $col_cnt -gt $lnbrk ]                 then                     comb_z="$comb_z - 10 $tmpdir/slz_${cslc}.png"                     col_cnt=1                 else                     comb_z="$comb_z + 10 $tmpdir/slz_${cslc}.png"                 fi             fi         fi     done     comb_z="$comb_z $tmpdir/slz.png"     if [ $do_comb -eq 1 ]     then         if [ $comb_app -eq 0 ]         then             comb_call="$comb_call $tmpdir/slz.png"         else             comb_call="$comb_call - 10 $tmpdir/slz.png"         fi         comb_app=1     fi fi #----------------------------------------------------------------------# eval $slc_call #----------------------------------------------------------------------# if [ $do_x -eq 1 ] then     eval $comb_x fi #----------------------------------------------------------------------# if [ $do_y -eq 1 ] then     eval $comb_y fi #----------------------------------------------------------------------# if [ $do_z -eq 1 ] then     eval $comb_z fi #----------------------------------------------------------------------# if [ $do_comb -eq 1 ] then     comb_call="$comb_call ${imgfl}.png"     eval $comb_call else     if [ $do_x -eq 1 ]     then         cp $tmpdir/slx.png ${imgfl}_x.png     fi     if [ $do_z -eq 1 ]     then         cp $tmpdir/sly.png ${imgfl}_y.png     fi     if [ $do_z -eq 1 ]     then         cp $tmpdir/slz.png ${imgfl}_z.png     fi fi #----------------------------------------------------------------------# if [ $do_keep -eq 0 ] then     rm -r $tmpdir fi

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

May 2024
April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
2006
2005
2004
2003
2002
2001


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager