External Email - Use Caution        

We still have problems with the analyze described above.

Can you help us moving on?

Attached is our FSGD file (text format "study") and qdec table (dat format 
"qdec.table.dat").

Thank you!

Best,
Josefine and Co.

Fra: Josefine Tingdal Taube Danielsen
Sendt: 22. juli 2024 21:24
Til: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Emne: SV: [Freesurfer] Longitudinal analyses using Repeated measures anova

I am sorry.

We have actually been trying to do this instead:
We decided to run mris_glmfit using the guide for longitudinal two stage model.
We are not able to run the first script:

long_mris_slopes --qdec qdec.table.dat \
      --meas thickness \
      --hemi lh \
      --sd /mnt/c/CogimmunStudy/FS \
      --do-pc1 --do-label \
      --time weeks \
      --fwhm 15 \
      --qcache fsaverage \
      --stack-pc1 lh.testretest.thickness-pc1.stack.mgh \
      --isec-labels lh.testretest.fsaverage.cortex.label

The error:
"Traceback (most recent call last): File
"/usr/local/freesurfer/7.4.1/python/scripts/long_mris_slopes", line 1005, in
<module> if fwhm > 0: TypeError: '>' not supported between instances of 'str'
and 'int'"

We have made both a bash and a python script in our subject directory trying to
solve the problem, but without any results.

bash:
#!/bin/bash

# Source the FreeSurfer environment
source /usr/local/freesurfer/SetUpFreeSurfer.sh

# Run the Python script to check the fwhm value
fwhm=$(./check_fwhm.py)
if [ $? -ne 0 ]; then
    echo "Error: Invalid fwhm value received from Python script."
    exit 1
fi

# Convert fwhm to integer explicitly
fwhm=$((fwhm))

# Check if fwhm is a valid positive integer
if ! [[ $fwhm =~ ^[1-9][0-9]*$ ]]; then
    echo "Error: Invalid fwhm value $fwhm. Expected a positive integer greater
than 0."
    exit 1
fi

# Run long_mris_slopes with the specified parameters
long_mris_slopes --qdec ./qdec.table.dat \
      --meas thickness \
      --hemi lh \
      --sd /mnt/c/CogimmunStudy/FS \
      --do-avg --do-rate --do-pc1 --do-spc --do-stack --do-label \
      --time weeks \
      --fwhm $fwhm \
      --qcache fsaverage \
      --stack-pc1 lh.thickness-pc1.stack.mgh \
      --isec-labels lh.fsaverage.cortex.label

python:
#!/usr/bin/env python3

import sys

def check_fwhm_value():
    # Simulate or retrieve the FWHM value, for example:
    fwhm = 15  # Replace with your actual method of retrieving FWHM

    # Validate the FWHM value (optional)
    try:
        fwhm = int(fwhm)
        if fwhm <= 0:
            raise ValueError("FWHM must be a positive integer greater than 0.")
    except ValueError as ve:
        print(f"Error: {ve}", file=sys.stderr)
        sys.exit(1)

    return fwhm

if __name__ == "__main__":
    fwhm = check_fwhm_value()
    print(fwhm)


Can you guide us to move on with the analysis?

Best,
Josefine

Fra: 
freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>
 
<freesurfer-boun...@nmr.mgh.harvard.edu<mailto:freesurfer-boun...@nmr.mgh.harvard.edu>>
 På vegne af Douglas N. Greve
Sendt: 22. juli 2024 15:46
Til: freesurfer@nmr.mgh.harvard.edu<mailto:freesurfer@nmr.mgh.harvard.edu>
Emne: Re: [Freesurfer] Longitudinal analyses using Repeated measures anova

Sorry, there is nothing here (ie, no fsgd file, no images). Did you mean to 
attached?
On 7/10/2024 5:31 AM, Josefine Tingdal Taube Danielsen wrote:

        External Email - Use Caution

Hi Freesurfer support,



I'm using Freesurfer version 7.4.1 and Ubuntu 22_x86_64. 
freesurfer-linux-ubuntu22_x86_64-7.4.1-20230614-7eb8460.



I'm trying to run longitudinal analysis using Repeated Measures Anova 
(https://surfer.nmr.mgh.harvard.edu/fswiki/RepeatedMeasuresAnova).



My study has 2 groups (MM=patient group and HC=healthy controls) and 2 time 
points (1 and 2). I am looking at cortical thickness and cortical volume.



Here is some information:



We have been using these Contrast files:

# Create 1-vs-2 contrast file
echo "0 0 1" > 1-vs-2.mtx

# Create group-effect contrast file
echo "0 1 0" > group-effect.mtx

# Create interaction contrast file
echo "0 1 -1" > interaction.mtx

# Create mean contrast file
echo "1 0 0" > mean.mtxfree

And then followed this:

Preproc using FSGD

mris_preproc --target fsaverage --hemi lh --meas thickness --out 
lh.thickness.mgh --fsgd rmanova.fsgd


Smooth data

mri_surf2surf --s fsaverage --hemi lh --fwhm 5 --sval lh.thickness.mgh --tval 
lh.thickness.sm05.mgh


Run GLM fit

mri_glmfit --glmdir lh.rmanova --y lh.thickness.sm05.mgh --fsgd rmanova.fsgd 
doss \
  --C 1-vs-2.mtx --C group-effect.mtx --C interaction.mtx --C mean.mtx \
  --surface fsaverage lh

This was our results:
INFO: gd2mtx_method is doss Reading source surface 
/mnt/c/CogimmunStudy/FS/fsaverage/surf/lh.white Number of vertices 163842 
Number of faces 327680 Total area 65417.000000 AvgVtxArea 0.399269 AvgVtxDist 
0.721953 StdVtxDist 0.195472 7.4.1 cwd /mnt/c/CogimmunStudy/FS cmdline 
mri_glmfit --glmdir lh.rmanova --y lh.thickness.sm05.mgh --fsgd rmanova.fsgd 
doss --C 1-vs-2.mtx --C group-effect.mtx --C interaction.mtx --C mean.mtx 
--surface fsaverage lh sysname Linux hostname D56979 machine x86_64 user josdan 
FixVertexAreaFlag = 1 UseMaskWithSmoothing 1 OneSampleGroupMean 0 y 
/mnt/c/CogimmunStudy/FS/lh.thickness.sm05.mgh logyflag 0 usedti 0 FSGD 
rmanova.fsgd labelmask /mnt/c/CogimmunStudy/FS/fsaverage/label/lh.cortex.label 
maskinv 0 glmdir lh.rmanova IllCondOK 0 ReScaleX 1 DoFFx 0 SigUseDouble 1 
Creating output directory lh.rmanova Loading y from 
/mnt/c/CogimmunStudy/FS/lh.thickness.sm05.mgh ... done reading. INFO: 
gd2mtx_method is doss Saving design matrix to lh.rmanova/Xg.dat Computing 
normalized matrix Normalized matrix condition is 1 Matrix condition is 3.15 
Found 149955 points in label. Pruning voxels by thr: 1.175494e-38 Found 149955 
voxels in mask Saving mask to lh.rmanova/mask.mgh Reshaping mriglm->mask... 
search space = 74612.577841 DOF = 123 Starting fit and test Fit completed in 
0.0220333 minutes Computing spatial AR1 on surface Residual: ar1mn=0.986733, 
ar1std=0.003725, gstd=3.501824, fwhm=8.246166 Writing results 1-vs-2 maxvox 
sig=-2.06583 F=7.13254 at index 102162 0 0 seed=1720706961 Computing efficiency 
group-effect maxvox sig=114.013 F=8295.3 at index 155689 0 0 seed=1720706961 
Computing efficiency interaction maxvox sig=106.775 F=6297.15 at index 64378 0 
0 seed=1720706961 Computing efficiency mean maxvox sig=133.337 F=17231.6 at 
index 155689 0 0 seed=1720706961 Computing efficiency mri_glmfit done

Now our questions:


  1.  Have we been using the right contrasts?

  1.  Do the results look realistic?

  1.  Is it possible to have some more information about results (e.g. summary, 
areas being significant, visualization, sig.mgh, t-values, p-values not i 
-log10)?

Thank you!

Best,
Josefine Danielsen






_______________________________________________

Freesurfer mailing list

Freesurfer@nmr.mgh.harvard.edu<mailto:Freesurfer@nmr.mgh.harvard.edu>

https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer

Attachment: qdec.table.dat
Description: qdec.table.dat

GroupDescriptorFile 1                   
Title CogimmunStudy                     
Class HC                        
Class MM                        
Variables                       
Input   1002_1  HC      
Input   1002_2  HC      
Input   1003_1  HC      
Input   1003_2  HC      
Input   1004_1  HC      
Input   1004_2  HC      
Input   1005_1  HC      
Input   1005_2  HC      
Input   1010_1  HC      
Input   1010_2  HC      
Input   1012_1  HC      
Input   1012_2  HC      
Input   1021_1  HC      
Input   1021_2  HC      
Input   1023_1  HC      
Input   1023_2  HC      
Input   1024_1  HC      
Input   1024_2  HC      
Input   1025_1  HC      
Input   1025_2  HC      
Input   1027_1  HC      
Input   1027_2  HC      
Input   1029_1  HC      
Input   1029_2  HC      
Input   1030_1  HC      
Input   1030_2  HC      
Input   1031_1  HC      
Input   1031_2  HC      
Input   1032_1  HC      
Input   1032_2  HC      
Input   1033_1  HC      
Input   1033_2  HC      
Input   1034_1  HC      
Input   1034_2  HC      
Input   1035_1  HC      
Input   1035_2  HC      
Input   1036_1  HC      
Input   1036_2  HC      
Input   1037_1  HC      
Input   1037_2  HC      
Input   1039_1  HC      
Input   1039_2  HC      
Input   1041_1  HC      
Input   1041_2  HC      
Input   1042_1  HC      
Input   1042_2  HC      
Input   1050_1  MM      
Input   1050_2  MM      
Input   1052_1  MM      
Input   1052_2  MM      
Input   1053_1  MM      
Input   1053_2  MM      
Input   1054_1  MM      
Input   1054_2  MM      
Input   1056_1  MM      
Input   1056_2  MM      
Input   1057_1  MM      
Input   1057_2  MM      
Input   1058_1  MM      
Input   1058_2  MM      
Input   1059_1  MM      
Input   1059_2  MM      
Input   1060_1  MM      
Input   1060_2  MM      
Input   1061_1  HC      
Input   1061_2  HC      
Input   1062_1  MM      
Input   1062_2  MM      
Input   1065_1  MM      
Input   1065_2  MM      
Input   1070_1  MM      
Input   1070_2  MM      
Input   1071_1  HC      
Input   1071_2  HC      
Input   1073_1  HC      
Input   1073_2  HC      
Input   1076_1  HC      
Input   1076_2  HC      
Input   1081_1  HC      
Input   1081_2  HC      
Input   1082_1  HC      
Input   1082_2  HC      
Input   1083_1  MM      
Input   1083_2  MM      
Input   1084_1  HC      
Input   1084_2  HC      
Input   1085_1  MM      
Input   1085_2  MM      
Input   1086_1  MM      
Input   1086_2  MM      
Input   1088_1  HC      
Input   1088_2  HC      
Input   1090_1  HC      
Input   1090_2  HC      
Input   1092_1  MM      
Input   1092_2  MM      
Input   1093_1  HC      
Input   1093_2  HC      
Input   1094_1  HC      
Input   1094_2  HC      
Input   1096_1  HC      
Input   1096_2  HC      
Input   1098_1  HC      
Input   1098_2  HC      
Input   1099_1  MM      
Input   1099_2  MM      
Input   1100_1  HC      
Input   1100_2  HC      
Input   1101_1  HC      
Input   1101_2  HC      
Input   1102_1  MM      
Input   1102_2  MM      
Input   1103_1  MM      
Input   1103_2  MM      
Input   1104_1  MM      
Input   1104_2  MM      
Input   1105_1  HC      
Input   1105_2  HC      
Input   1106_1  HC      
Input   1106_2  HC      
Input   1109_1  HC      
Input   1109_2  HC      
Input   1110_1  HC      
Input   1110_2  HC      
Input   1111_1  HC      
Input   1111_2  HC      
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
The information in this e-mail is intended only for the person to whom it is 
addressed.  If you believe this e-mail was sent to you in error and the e-mail 
contains patient information, please contact the Mass General Brigham 
Compliance HelpLine at https://www.massgeneralbrigham.org/complianceline 
<https://www.massgeneralbrigham.org/complianceline> .
Please note that this e-mail is not secure (encrypted).  If you do not wish to 
continue communication over unencrypted e-mail, please notify the sender of 
this message immediately.  Continuing to send or respond to e-mail after 
receiving this message means you understand and accept this risk and wish to 
continue to communicate over unencrypted e-mail. 

Reply via email to