External Email - Use Caution        

Dear Yujing,

Thank you for the quick reply. When I enter umask in my terminal I already get 
0002 as output so I think this is not the issue. Is there anything else I could 
do?


Kind regards,

Jari Gool  |  MD-PhD candidate

Department of Anatomy & Neurosciences, Amsterdam UMC Location VUmc


________________________________
Van: freesurfer-boun...@nmr.mgh.harvard.edu 
<freesurfer-boun...@nmr.mgh.harvard.edu> namens Huang, Yujing 
<yhuan...@mgh.harvard.edu>
Verzonden: vrijdag 24 november 2023 13:59
Aan: Freesurfer support list <freesurfer@nmr.mgh.harvard.edu>
Onderwerp: Re: [Freesurfer] Automatic prompt reply for freesurfer 
subsegmentations


It looks like “imageDump.mgz” is copied to the directory during segmentation.



Can you check your ‘umask’?

>umask



I think “mode 0444 (r--r--r--)” is caused by the umask setting to 0222. Try to 
change your umask to 0002 in .bashrc or .profile – add a line ‘umask 0002’.



Best,



Yujing



From: freesurfer-boun...@nmr.mgh.harvard.edu 
<freesurfer-boun...@nmr.mgh.harvard.edu> On Behalf Of Gool, J.K. (Jari)
Sent: Thursday, November 23, 2023 6:33 AM
To: freesurfer@nmr.mgh.harvard.edu
Subject: [Freesurfer] Automatic prompt reply for freesurfer subsegmentations



        External Email - Use Caution

Dear,



I would like to run the different available Freesurfer subsegmentations 
(brainstem, amygdala/hippocampus, thalamus, hypothalamus and ScLimbic) on a 
large sample of 150 subjects (code below). I want to run multiple subjects in 
parallel using the sbatch command on the linux server I am working on. Because 
of previous recon-all processing in 7.3.2 I would like to also perform the 
subsegmentations in this version and ScLimbic in 7.4.0. The problem is that the 
“segmentBS.sh”, “segmentThalamicNuclei.sh” and “segmentHA_T1.sh” halfway 
prompts for user input: “mv: replace 'imageDump.mgz', overriding mode 0444 
(r--r--r--)?”. The imageDump.mgz file is made within this same subsegmentation 
script and I have no problem with replacing this file. When I run the code 
interactively I just reply with “y” and the subsegmentation finishes without 
any errors. When I want to submit my script as a job and in batch, I am unable 
to provide this user input and the subsegmentation gets stuck at the prompt. I 
have tried to change my code of the subsegmentations with yes and echo (such as 
“yes | segmentBS.sh ${subj}_ses-EEGfMRI1 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/” or 
“echo “y” | segmentBS.sh ${subj}_ses-EEGfMRI1 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/”) but 
the script still gets stuck on the prompt. Do you know how I can fix this? We 
would also like to perform these subsegmentations in a large consortium and 
hope to be able to automate this problem so sites will not have to manually 
provide the user input every time.



Thank you in advance for your help, it is much appreciated.



Kind regards,

Jari Gool  |  MD-PhD candidate
Department of Anatomy & Neurosciences, Amsterdam UMC Location VUmc





#!/bin/bash



#SBATCH --job-name=subsegmentations_ams

#SBATCH --mem=16G

#SBATCH --partition=luna-cpu-long

#SBATCH --qos=anw-cpu

#SBATCH --cpus-per-task=1

#SBATCH --time=03-00:00:00

#SBATCH --nice=2000

#SBATCH --array=1-37%3

#SBATCH --output=slurm-%A.%a.out



module load FreeSurfer/7.3.2-centos8_x86_64



#make list of subjects

SUBJECTS_DIR=/scratch/anw/jkgool/freesurfer_rick/input/

cd ${SUBJECTS_DIR}

ls -d sub-* > subjects.txt

subj=$(sed "${SLURM_ARRAY_TASK_ID}q;d" subjects.txt)



#1 hypothalamus (doc: 
https://secure-web.cisco.com/1zzIXIXnWRnq-g2GJqUYLNUzu2SHP68ScMqA9PP1C5yj-KWHM-Zu25MaWbwe2pwIh1f-LIc3nZSdfU8of90lzMGdbaREY57MQOEFQ90jJHhEYXNQM4CYr5Kz2Cy-numPynGj1I-JD8Yz7QvM_2_L1hyHoqeH90ErRTn3acoA-Bwhrj40jBpUUoywsljj6vNSh0c7D81AdTbQxLu23yr3mf9piRNrFC6mB5f69_5PpFmO9Ux0z0lDB49RBgvcwqNzvqCIKT6_VPAEtjfCaxtgjeYC9s6MMn9DIEizyG-e0sy9zjoZanT9H8vRgW4rZTCv2It-ovA6phXlSrPz8l2xmNw/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2FHypothalamicSubunits)

echo "running hypothalamus segmentation..."

mri_segment_hypothalamic_subunits --s ${subj}_ses-EEGfMRI1 --sd 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/ 
--write_posteriors



#2 brainstem (doc: 
https://secure-web.cisco.com/1g5cOkTomD7Hpix0PgD1Lhl9ArOqLsH9E9os69e_J2cfYRl7ViXMqtJVmJkUCOh3451chs4dlYaCmveWeByX4tRsQYIxnaVfVyvFJISkNc-FULkUl7O1QH5SS0RWbq0eR6tqTOsQqN3hchveU3n-kkzTpGsSa4WAvQ5qhRwgK7TLQSz8YTDLR2Tais1NGwgLZWsAcE8mmq1_xf1JlJwdxmalm-nO-5rMGNPfM1mW0gy7AYN5t46p4Lfx9SkqT0Xi8ysdGNa2AROTSlkAcrtXf0EmM33GiLSUABkMm_KKgPWWx4zdp_qxmsKzidUEata48bEH5F0iNhtCbwhL0Q2gqUg/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2FBrainstemSubstructures)

echo "running brainstem segmentation..."

segmentBS.sh ${subj}_ses-EEGfMRI1 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/



#3 thalamus (doc: 
https://secure-web.cisco.com/1cUdN_ti2E_dzVkW7HDmxM2Wiau14Kv4bkqOiHnUKVx4G1PDiAPZT0M6hzpOu3iGQkvIwtSUqNJbVd7wGtn2JcvJZcSe968Rupl29TMojNShMnWWHeYpY1-4XMh_OGqjfKvq_Uc7r-zBYbtOT75Mf3l0NHoWw8dszc67TVs_uPdFEoKfjZ7ka8DD-i46DruTBREdI32keYq8C1kfvxMuMqEILqY18qJe03UsARu2AqZ2tsHH30KTVI1Eui7YlzK3wFGgCy3FFgNj7DnI8a8XmXCYqVg2DnsGe2T-ygqHMVGKBekrcjVA1XgY56Awwq6bBTS024G1YXRfVKXUrgfh9ng/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2FThalamicNuclei)

echo "running thalamic nuclei segmentation..."

segmentThalamicNuclei.sh ${subj}_ses-EEGfMRI1 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/



#4 hippocampal subfields and amygdala (doc: 
https://secure-web.cisco.com/1BpbGiTWLV_LBKMEhY-sObmXZ5eLhacZvE1VCSXyPH-8Zcqmq3E3uw1XoK5-g3gxm_EthTUnExmTjhd9UCoVFcD6RgOfXG0C9-J1y4HB226qL3FcRYv-xaSPiEFNnzJuiqcZ_CCG6mn7GFl5OkbsPFJadmkku82UQa-qmAgcqTxL3o4sckqdFDTCFbEbVMghoPkvKbImzcjVvC-ThmvwOTKW8ytD82Egg9eTnUH5mth55tvz1rgQEp7B1D3EQQiipnoDPzyOC-poZ2XzQl9ZXjqukdVCjNYX8sh0FJ1FBKHA9q3R4SQl7K_uBEuGaLxIiMLd3Lh_zJ_RFP0BaXRVdJQ/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2FHippocampalSubfieldsAndNucleiOfAmygdala)

echo "running hippocampal subfields and amygdala segmentation..."

segmentHA_T1.sh ${subj}_ses-EEGfMRI1 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/



module load FreeSurfer/7.4.0-centos8_x86_64



#5 subcortical limbic structures (doc: 
https://secure-web.cisco.com/1W3wBjp8FNGbGIvtzSOqAWuYqXOYZq0SiGqjzIv97TQLbG7oJ780jcEADH_ntjnPonxD58FurFvTgdC67yPwqASL5RQf14buQUb9uETTmXPaJ8sd-V86LNr86823SFBply718B4vaCmlGs6nKUSrVMR2qgs3qVo66Q8th1oEVayC049uFS7PL2oIq2UWpifubMFREMYEXp_UvbLSOWSZb_cN782uQle7M2sBkmTIF9vDgjooLbnGF-Ob0hH_oVrVqq5RJbMF79dXeLIKRBlpz27nXYKVB0d_yIv_me1Y8vW9cBNfGO0c9aB6LyOSMjYcUxoAjmZZBaGtqwcgMWEK_vg/https%3A%2F%2Fsurfer.nmr.mgh.harvard.edu%2Ffswiki%2FScLimbic)

echo "running limbic structures segmentation..."

mri_sclimbic_seg --i 
/home/anw/jkgool/my-scratch/freesurfer_rick/input/${subj}/ses-EEGfMRI1/anat/ 
--o 
/home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/${subj}_ses-EEGfMRI1/output_sclim
 --write_volumes --write_qa_stats



______________________________________________________
AmsterdamUMC disclaimer : 
http://secure-web.cisco.com/1kUDMmBkl7pcDNyIVFmWlpuJe4s3U81XAMQyp1zYx34NpzUcjS1za1kw1kMEY8mAEBWkyZitvggM79HVhLi-0GUU55M9a7ja9NgLn4ehQhvlIhlawKOlxLUg6D3DgrqMXeCfEJnSXNrBCC-WNLoV6mEs7X9K7vWlmRR3w4zkOisZ2o9uLn1vivpH33ANSH5FqhgBvycJYtDQon-Mf-xVwOhVFS3Lmstf8xA_nVgfb19fHnxVcLynR3G4iKvlEXXU_TxUEu2KKg-0Z4cytmUM_W2GMPaI1V9t5VBnQ95PdT92g8zHaKCXJvZKos00aYC_RwrpwCbAU6rV9-61LHYao9Q/http%3A%2F%2Fwww.amsterdamumc.org%2Fdisclaimers<http://secure-web.cisco.com/1kUDMmBkl7pcDNyIVFmWlpuJe4s3U81XAMQyp1zYx34NpzUcjS1za1kw1kMEY8mAEBWkyZitvggM79HVhLi-0GUU55M9a7ja9NgLn4ehQhvlIhlawKOlxLUg6D3DgrqMXeCfEJnSXNrBCC-WNLoV6mEs7X9K7vWlmRR3w4zkOisZ2o9uLn1vivpH33ANSH5FqhgBvycJYtDQon-Mf-xVwOhVFS3Lmstf8xA_nVgfb19fHnxVcLynR3G4iKvlEXXU_TxUEu2KKg-0Z4cytmUM_W2GMPaI1V9t5VBnQ95PdT92g8zHaKCXJvZKos00aYC_RwrpwCbAU6rV9-61LHYao9Q/http%3A%2F%2Fwww.amsterdamumc.org%2Fdisclaimers>
_______________________________________________
Freesurfer mailing list
Freesurfer@nmr.mgh.harvard.edu
https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
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