External Email - Use Caution
Hello,
I am trying to run sbTIV following on my SAMSEG output through Freesurfer, but am running into issues.
My SAMSEG code: #!/bin/bash
# script to run SAMSEG on all participants
# define directories DATA_DIR=“XYZ" OUTPUT_BASE_DIR=“XYZ" LOG_DIR=“XYZ"
# create directories if they don't exist mkdir -p "${OUTPUT_BASE_DIR}" mkdir -p "${LOG_DIR}"
# log file LOG_FILE="${OUTPUT_BASE_DIR}/samseg_log.txt" echo "SAMSEG processing started: $(date)" > "${LOG_FILE}"
# loop through all participant directories for SUB_DIR in "${DATA_DIR}"/sub-*/; do # extract participant ID from directory name SUB_ID=$(basename "${SUB_DIR}") # define directory paths T1_FILE="${SUB_DIR}ses-01/anat/${SUB_ID}_ses-01_T1w.nii.gz" OUTPUT_DIR="${OUTPUT_BASE_DIR}/${SUB_ID}" INDIVIDUAL_LOG="${LOG_DIR}/${SUB_ID}_samseg_log.txt" # check if T1w image file exists if [ -f "${T1_FILE}" ]; then echo "Processing ${SUB_ID}..." | tee -a "${LOG_FILE}" echo "Input: ${T1_FILE}" | tee -a "${LOG_FILE}" echo "Output: ${OUTPUT_DIR}" | tee -a "${LOG_FILE}" # run SAMSEG run_samseg --input "${T1_FILE}" --output "${OUTPUT_DIR}" --threads 8 2>&1 | tee "${INDIVIDUAL_LOG}" # check if analysis completed successfully if [ $? -eq 0 ]; then echo "SUCCESS: ${SUB_ID} completed at $(date)" | tee -a "${LOG_FILE}" else echo "ERROR: ${SUB_ID} failed at $(date)" | tee -a "${LOG_FILE}" fi echo "-----------------------------------" | tee -a "${LOG_FILE}" else echo "WARNING: T1 file not found for ${SUB_ID}" | tee -a "${LOG_FILE}" echo "Expected: ${T1_FILE}" | tee -a "${LOG_FILE}" echo "-----------------------------------" | tee -a "${LOG_FILE}" fi done
echo "SAMSEG analysis completed: $(date)" | tee -a "${LOG_FILE}" echo "Log file saved to: ${LOG_FILE}"
When trying to run sbTIV for one participant as an example:
sbtiv <path>/samseg.stats -o <path>/sbtiv.stats
Error:
Traceback (most recent call last):
File "/Applications/freesurfer/8.1.0/python/scripts/sbtiv", line 8, in <module>
sys.exit(main())
File "/Applications/freesurfer/8.1.0/python/packages/samseg/cli/sbtiv.py", line 23, in main
with open(args.input) as fid:
AttributeError: 'Namespace' object has no attribute 'input'
Am I correct in understanding that the value provided in the sbtiv.stats is the sbTIV value? Even when it is the same as the intra-cranial measure from the samseg.stats file?
I have very limited coding/neuroimaging analysis knowledge, so any help you can provide here is greatly appreciated!
Cheers, Chelsea