asegstats2table is a python2 script, and you are likely running it with python3. Try running the script with “python2” prepended to the command:

 

python2 asegstats2table --subjects $list --meas volume --skip --statsfile wmparc.stats --all-segs --tablefile wmparc_stats.txt

 

best,

Andrew

 

 

From: <freesurfer-bounces@nmr.mgh.harvard.edu> on behalf of Schumman Resonance <schummanr@gmail.com>
Reply-To: FS Help <freesurfer@nmr.mgh.harvard.edu>
Date: Sunday, August 12, 2018 at 12:33 PM
To: FS Help <freesurfer@nmr.mgh.harvard.edu>
Subject: [Freesurfer] Stats2table_bash.sh script

 

        External Email - Use Caution        

 

Hi,

 

I'm trying to run the Stats2table_bash.sh script from Jamaan Alghamdi & Dr. Vanessa Sluming.

 

And I get This error:

 

  File "/Applications/freesurfer/bin/asegstats2table", line 195

    print 'ERROR: subjects are not specified (use --subjects SUBJECTS)'

                                                                      ^

SyntaxError: invalid syntax

  File "/Applications/freesurfer/bin/asegstats2table", line 195

    print 'ERROR: subjects are not specified (use --subjects SUBJECTS)'

                                                                      ^

SyntaxError: invalid syntax

  File "/Applications/freesurfer/bin/aparcstats2table", line 156

    print 'ERROR: atleast 1 subject must be provided'

.

.

.

 

 

 

This is my set up:

 

 

_________________________________________________________________

 

 

-------- freesurfer-Darwin-OSX-stable-pub-v6.0.0-2beb96c --------

Setting up environment for FreeSurfer/FS-FAST (and FSL)

FREESURFER_HOME   /Applications/freesurfer

FSFAST_HOME       /Applications/freesurfer/fsfast

FSF_OUTPUT_FORMAT nii.gz

SUBJECTS_DIR      /Users/schumman/data

MNI_DIR           /Applications/freesurfer/mni

FSL_DIR           /usr/local/fsl

 

_________________________________________________________________

 

 

This is the line from SetUpFreeSurfer.sh for my subjects directory

____________________________________________________________

 

# Set this to your subjects/ dir, usually freesurfer/subjects/

if [ -z $SUBJECTS_DIR ]; then

    export SUBJECTS_DIR=/Users/schumman/data

 

 

__________________________________________________

 

And I modified in their script to my FREESURFER_HOME as below

 

 

#!/bin/bash

path=`dirname $0`

sleep 1

cd $path

echo "This bash script will create table from ?.stats files"

echo "Written by Jamaan Alghamdi & Dr. Vanessa Sluming"

echo "University of Liverpool"

echo "jamaan.alghamdi@gmail.com"

echo "http://www.easyneuroimaging.com"

echo "20/12/2010

 

"

 

 

export FREESURFER_HOME=/Applications/freesurfer

sleep 1

source $FREESURFER_HOME/SetUpFreeSurfer.sh

sleep 1

 

export SUBJECTS_DIR=$PWD

list="`ls -d */`"

asegstats2table --subjects $list --meas volume --skip --statsfile wmparc.stats --all-segs --tablefile wmparc_stats.txt

.

.

.

 

 

I run the script from my_subject_directory.

 

I suspect this is something very obvious I'm not able to see and I apologize for such a basic question, any help would be much appreciated.

 

Thanks,

K