The arguments of -slice option are in column/row/slice order, which is the pixel storage order of the volume. It could be different from sagittal/coronal/axial. You can run mri_info on your volume and check the orientation information. Use that information to decide how c/r/s map to s/c/a.
Ruopeng On Sep 30, 2024, at 7:16 AM, Camilo Castelblanco Riveros <camilo.a.castelblanco.riveros...@dartmouth.edu<mailto:camilo.a.castelblanco.riveros...@dartmouth.edu>> wrote: External Email - Use Caution Hi, I am trying to print screenshots of MR images efficiently with the freesurfer reconstruction with Freeview in an HPC. For an unknown reason, this code works for iterating over sagittal, not coronal or axial coordinates. It does not iterate over the coordinates in the coronal and axial cases even though the cmd file looks okay. Any help would be appreciated. -------- # Define the MRI and surface files for the current subject T1_IMAGE="${SUBJECT_DIR}/mri/T1.mgz" WM_IMAGE="${SUBJECT_DIR}/mri/wm.mgz" BRAINMASK_IMAGE="${SUBJECT_DIR}/mri/brainmask.mgz" ASEG_IMAGE="${SUBJECT_DIR}/mri/aseg.mgz" LH_WHITE="${SUBJECT_DIR}/surf/lh.white" LH_PIAL="${SUBJECT_DIR}/surf/lh.pial" RH_WHITE="${SUBJECT_DIR}/surf/rh.white" RH_PIAL="${SUBJECT_DIR}/surf/rh.pial" # Define number of slices and step size for each view (sagittal, coronal, axial) STEPS=15 # Increase this value for more plots/slices SAGITTAL_START=20 SAGITTAL_END=200 CORONAL_START=20 CORONAL_END=200 AXIAL_START=20 AXIAL_END=200 # Create a fresh cmd.txt file for the current subject echo "-v $T1_IMAGE \ $WM_IMAGE \ $BRAINMASK_IMAGE \ $ASEG_IMAGE:colormap=lut:opacity=0.2" > "$CMD_FILE" echo "-f $LH_WHITE:edgecolor=blue \ $LH_PIAL:edgecolor=red \ $RH_WHITE:edgecolor=blue \ $RH_PIAL:edgecolor=red" >> "$CMD_FILE" # Loop through slices in each dimension and add commands to cmd.txt #==================> Sagittal view slices (changes in X-coordinate) for ((i = 0; i <= STEPS; i++)); do slice=$(bc <<< "$SAGITTAL_START + ($SAGITTAL_END - $SAGITTAL_START) * $i / $STEPS") echo "-viewport sagittal -slice $slice 127 127 -viewsize 800 800 -ss ${OUTPUT_DIR}/sagittal_slice_${slice}.png -noquit" >> "$CMD_FILE" done # Reset the view and Freeview instance to avoid cache issues between views echo "-quit" >> "$CMD_FILE" echo "Processing sagittal slices..." # Debug message freeview -cmd "$CMD_FILE" > freeview_log.txt 2>&1 sleep 2 # Wait for Freeview to close completely # If Freeview doesn't quit properly, use pkill as a fallback pkill freeview #%%%%%%%%%%%%%%%%%%%% # Create a fresh cmd.txt for coronal slices CMD_FILE="${OUTPUT_DIR}/cmd_coronal.txt" #================> Coronal view slices (changes in Y-coordinate) for ((i = 0; i <= STEPS; i++)); do slice=$(bc <<< "$CORONAL_START + ($CORONAL_END - $CORONAL_START) * $i / $STEPS") echo "-viewport coronal -slice 127 $slice 127 -viewsize 800 800 -ss ${OUTPUT_DIR}/coronal_slice_${slice}.png -noquit" >> "$CMD_FILE" done ------- Best regards, Camilo ================================ Camilo Castelblanco Riveros (He/His) Integrative Neuroscience at Dartmouth (IND) Ph.D. Candidate Robertson Lab<https://secure-web.cisco.com/1QRdD2mxYtydinuoic7wn0eITgFhkqKqoGQdP-IFOAFtu5kJRVWdfxhUPzSKytF3IOGLoElu104VzGBR_aHvFv7MCJ_OvNj7LhlXuJHndgF31PTidOPlk1GDEzzkou1o8lrPx4mgl0SelGQG8LENwNDbYB92Eu2Mv0kw0QjRvdyQLEEJge323I_R1PcweWVzCEAQFusA-AQFMhAeiDHVeVcevyzY4TE4tqcp44XPxA9IW9YDQ6Eaz-2QWPvAzbWHPx23NEMHtFeQpWG1hSuZQtyI1wA1hsrWoggzJP2DsLKT9Ae6CmQVaIHh9xjd5G6MK4BS5661GJ1P_quL6KUP7S5-HwOTIXvXBktHSo7mU29U/https%3A%2F%2Fwww.robertsonlab.com%2F> & Bujarski Lab<https://secure-web.cisco.com/1cOiHwMsWx3XS3cX7DjImdJuyBu3ix4ePXcP4xtelQK30A39GtRBElyJZq6RrjWglE78U3BSaWBVWvcXdjqXz5Qd_hHzyzzX88vbgd_YaXNNZHRuGveZ5OEPD-mWxJoxvlPp6XluW4tiyE-wXNuMCwS9s3cQHF8GRTaJ24DycmF4Fwn3ErTRVsIaSUIIDFEidy26hjhSDf7q3DMsRXcsGcPcSNhyS99GfN-KcR4GEkGxq9fQju7P5_QXZMe56RgDMF1jRhNCzTKOODNGOTPE2PKWtq0JSmkFbXCrqrSHTJt9yPBaRyB4eem079qqWXC0iPFTINZB2jwGoN56J5UOL9xY7C3Rkv_DpnVL_v0tElqU/https%3A%2F%2Fwww.dartmouth-hitchcock.org%2Fresearch%2Fsearch-clinical-trials%2Ftrial%2FSTUDY02001606> Student Interest Group in Neurology (SIGN<https://secure-web.cisco.com/1dq5CGYwmVLVUgtU1lI9vL6j7Qx4yi0AzfTjFxlK___c2GVt42aRoUKewilowH3Gpzyg4ZKPQF37cidOA2Yj7hH632Yhv2ctP-wC4uoXel1nH9Svm3TrncPUUB39zKpCL6DbF3B5anJV8voRHRTQb4wns5fRfw3--lT6-CIa3lCTYjRR6mPH2cyOte7R_TxVa0Z_IUB1Hi-vHTol9Gb-uF9qUju_LKC7LDBHNDbZ7z-fC9fv8ZIIDCY3i3Sx5SD-sjNpDlYtJOaz-RfJn1WXEhyaJpOTlvUnAU54rM2vSzft5m8-piQsg97cPGowe3LlpLJastvwkf_3JcZmpNvjtxyhhg2bPFsyqHAuRrviGGA0/https%3A%2F%2Fgeiselmed.dartmouth.edu%2Fstudent-gov%2Fstudent-groups%2F>) Co-Leader Diversity Student Advisory Board Member e: ccastelblanco...@dartmouth.edu<mailto:camilo.a.castelblanco.riveros...@dartmouth.edu> Zoom<https://secure-web.cisco.com/14g7m031Cr0kkdNxX-rGazLPRk_s-3aNkJgXOZ6l_5Sf_8u4xRcjNAiEhMUaktKloTMdLU92eP4dMzOGvCCGnpbaW4qWgqDvQzVdMwFdGMUmOY2qsjf_a_E8lhjbQWcNANG6aAOYPuJiENdPl4K4y1lHseW889f-gD5A1v-D3WKQnEUiURzvW60EdKR4G5ORTlRjqdxtvGXjhbLzUjAeybh89ucsDowdj28Log_vk9mbQ7V2STftg7mT1fB0n7rej605bRx131IUbJfPxW2PgR_d-3Z8Dbf4XeNq2diU6ktSSqaUxwCSYzvCt3RFfJGO4p07hiYLivoTwxdDiUe5law4BtcbIo4eN6GkI793J3AM/https%3A%2F%2Fdartmouth.zoom.us%2Fmy%2Fccastelblanco> [Integrative Neuroscience at Dartmouth (IND) (@DartmouthNeuro) / Twitter][https://secure-web.cisco.com/1xhwoZ3De7JvJwiWw2iKKOiWE_LAh7oAY_McAOsmigwn1Sn3CHrVmz9zgKiz9qDvXOd0F6OqBBvGbTo4_V2hX9KgYr5XcvVFMgCpfxPM-bH3tk9nb4kdaGguPt4TvDaN-eTESjA2r777_SVK3KuQL2qn-BnfA-Zzb6XGpiTiTt8lJaZg4jsFD53er7ShpmuucwWZhY4dLfwBrz8-OKz4bFZhTeC60Lj6ZDBxuNThb-ebA3BGwtV6NI-VpFkUE5Ko9m4y5aLyLLUbiXUz_NddDpQYiCg06cswRxXM4WXp_w-XV6sySuBRJJ3xKgvfrRlShQxy4egdxoKFKvx2T9EmdtoDBCSjf1PvYu3eJVIe66T8/https%3A%2F%2Fjobsearch.dartmouth-hitchcock.org%2Fwp-content%2Fuploads%2FDH-Bug-e1666020448423.png] _______________________________________________ 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 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.