External Email - Use Caution        

Hi Freesurfer Developers,

I believe I found a work around for the mri_binarize error I was running
into regarding the thalamic nuclei segmentation during trac-all prep as
described in greater detail in my previous message (
https://secure-web.cisco.com/1Rjl_EG-oXqOtVFNnzcnE1pzvr3JwoCtkvYdoNEBqGYqKMKALnf9ARIBT5ebqWV4GKvs4zvkPHmLQEPi9_tnYLQ2Ion6RaF7B9CiA0aKWkLOCi2ioSGF_Oo0sZNYvWZ_sTHa8i1fGJeXKTESTI15yoxfXdwofnByaSuTDW3GcHcT2GwBAPb3smn6oCuoM38dQSvV-ZFUBEtOa3lqXizFxFOENqA84nI0i3B9RntzEHBmZ4jd6GHTpHcqoTdiha7I5hGB5ipXLzgXwMSo__xdLPRN9bsAaiF0fKU_82ORuJhaYp3KI9Uq1QbUZhI8yePja/https%3A%2F%2Fwww.mail-archive.com%2Ffreesurfer%40nmr.mgh.harvard.edu%2Fmsg73324.html).
I'm using FS v7.3.2 on OS Monterey, with the segmentThalamicNuclei.sh
script producing the segmentation file
mri/ThalamicNuclei.v13.T1.FSvoxelSpace.mgz.

From what I can tell, the error seems to arise from the following section
from the trac-preproc script, specifically the line "set cmd = ($cmd
`printf "--replaceonly-nn %s 11 " $ids`)":
  # Replace thalamus in main segmentation with nearest neighbor labels
    set ids = ()
    foreach label (Left-Thalamus Right-Thalamus)
      set ids = ($ids `grep -i " ${label}[ \t]" $fslut | awk '{print $1}'`)
    end

    set cmd = mri_binarize
    set cmd = ($cmd --i $fsdir/mri/$segname.mgz)
    set cmd = ($cmd `printf "--replaceonly-nn %s 11 " $ids`)
    set cmd = ($cmd --o $labdir/anatorig/${segname}+thalnuc.nii.gz)
    echo $cmd
    $cmd

I made the following edits to print the $ids for the left and right
thalamus, then input those values (10 49) as the window required by
--replaceonly-nn:
  # Replace thalamus in main segmentation with nearest neighbor labels
    set ids = ()
    foreach label (Left-Thalamus Right-Thalamus)
      set ids = ($ids `grep -i " ${label}[ \t]" $fslut | awk '{print $1}'`)
printf "\n \n label is $label \n \n"
printf "\n \n ids are $ids \n \n"
    end

    set cmd = mri_binarize
    set cmd = ($cmd --i $fsdir/mri/$segname.mgz)
    set cmd = ($cmd --replaceonly-nn 11 10-49)
    set cmd = ($cmd --o $labdir/anatorig/${segname}+thalnuc.nii.gz)
    echo $cmd
    $cmd

This seems to successfully circumvent the error I was previously receiving
("printf: illegal option -- -"), which resulted in a missing
--replaceonly-nn command and prevented the mri_binarize output file from
being created. The rest of the script then runs without error, and the
final trac-all output seems to have been successful.

I'm not sure why I was receiving this printf error, but I would greatly
appreciate any feedback or corrections to this potential solution. Thank
you in advance for any guidance you are able to provide, and please let me
know if any further information is needed.

Best,
Makenna

*Makenna McGill *(she/her)
Doctoral Student in Clinical Psychology
The University of Texas at Austin
_______________________________________________
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