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-bounces@nmr.mgh.harvard.edu freesurfer-bounces@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://surfer.nmr.mgh.harvard.edu/fswiki/HypothalamicSubunits) 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://surfer.nmr.mgh.harvard.edu/fswiki/BrainstemSubstructures) echo "running brainstem segmentation..." segmentBS.sh ${subj}_ses-EEGfMRI1 /home/anw/jkgool/my-scratch/freesurfer_rick/output/test_nov23/freesurfer/
#3 thalamus (doc: https://surfer.nmr.mgh.harvard.edu/fswiki/ThalamicNuclei) 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://surfer.nmr.mgh.harvard.edu/fswiki/HippocampalSubfieldsAndNucleiOfAmy...) 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://surfer.nmr.mgh.harvard.edu/fswiki/ScLimbic) 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 : www.amsterdamumc.org/disclaimershttp://www.amsterdamumc.org/disclaimers