External Email - Use Caution        

Hello,

I speculate that this could be an issue with the long_mris_slopes script; 
specifically, it seems that any fwhm value provided via the command-line 
argument is internally represented as a string, but should be an integer 
instead.

I see two potential workarounds:

a) changing the code of the long_mris_slopes scripts so that at some point the 
(supposed) fwhm string is converted to integer.

b) not using the --fwhm command-line option. If I see correctly, this will make 
the program use a range of default fwhm values [0 , 5, 10, 15, 20, 25 ] and 
produce output for each of them.

Best regards,

Kersten

On Mon, 2024-07-29 at 12:37 +0000, Josefine Tingdal Taube Danielsen wrote:

CAUTION: This email originated from outside of DZNE. Do not click links or open 
attachments unless you recognize the sender and know the content is safe.
ACHTUNG: Dies ist eine externe E-Mail, bitte seien Sie vorsichtig beim 
Anklicken von Links oder Öffnen von Anhängen


        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

_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu<mailto: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.

_______________________________________________
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