Re: [Freesurfer] tcl script - rotate and save graphics
Hi Daniel et al., thanks for the rotate and save_tiff script. I've installed the dev version (redhat 9 download onto Debian sarge) and the script works well. I would like to set the resolution of the .tif output files (eg, 600 dpi), can we do that? I have a problem when using a label in the tcl script (see example.tcl below). I can startup tksurfer from the csh prompt, create a label, save it, exit, start again, load the label, and it displays correctly. So I assume all the label tools are working. When I restart with -tcl example.tcl, tksurfer draws an entirely blue surface after loading the label (any label). Have you seen this before? Am I doing something wrong? Should I source the tksurfer.tcl script, at the beginning of this script, to get all the lighting etc. correct? I tried to startup tksurfer normally, with no explicit -tcl option, and then source example.tcl at the tcl prompt, but the entire surface turns blue after the script loads a label. Can you replicate this or advise me how to avoid it? Is it possible to create a shell script or a tcl script that can startup tksurfer and run a specific tcl script across a group of subjects? Thanks, Darren ## # START EXAMPLE.TCL SCRIPT set SUBJECTS_DIR /usr/local/freesurfer/subjects set subjID ucsf_cj set subjPath [ file join ${SUBJECTS_DIR} ${subjID} ] set subjSurfPath [ file join ${subjPath} surf ] set subjLabelPath [ file join ${subjPath} label ] set subjTiffPath [ file join ${subjPath} rgb ] foreach h {lh} { # --- # load the inflated surface, with curvature set insurf [file join ${subjSurfPath} ${h}.inflated] read_binary_surf set curv [file join ${subjSurfPath} ${h}.curv] read_binary_curv UpdateAndRedraw # --- # load and display relevant .label files set labels [ glob -directory ${subjLabelPath} ${h}_test.label ] foreach l $labels { puts loading label: $l labl_load $l # AT THIS POINT WE HAVE AN ENTIRELY BLUE SURFACE } # now rotate and save the views ... } # END TCL SCRIPT ## Best, Darren Daniel Goldenholz wrote: Hi Darren and other Freesurfers I wrote a tcl script to do just what was described. The one I made gives the flexibility to name the tiff files based on a prefix that you specify before running the script. This way you run the same exact script for as many pictures as you like, simply changing the prefix before running the script. Here is what you do. In tksurfer, after you have set up whatever overlays and/or labels and/or surfaces etc that you like, you enter at the command prompt set pre whatever-you-want (where the stuff inside theis any file prefix... for instance, set pre bold_contrast1 ) then you run the following tcl script via the menu for running a script... UpdateAndRedraw puts Taking Snapshots... make_lateral_view rotate_brain_y 90 redraw set tiff ${pre}_bck.tif save_tiff $tiff make_lateral_view redraw set tiff ${pre}_lat.tif save_tiff $tiff rotate_brain_y 180 redraw set tiff ${pre}_med.tif save_tiff $tiff make_lateral_view rotate_brain_x 90 redraw set tiff ${pre}_inf.tif save_tiff $tiff rotate_brain_x 180 redraw set tiff ${pre}_sup.tif save_tiff $tiff make_lateral_view rotate_brain_y 270 redraw set tiff ${pre}_front.tif save_tiff $tiff Darren Weber wrote: Hi Bruce etal, I would like a short tcl script to rotate each hemisphere through all the main views (lateral, medial, dorsal, ventral, anterior, posterior) and output a graphics file with the name of the subject and the view in the file name. I've found rotate_brain_[xyz] and save_rgb, but the latter does not permit a file name for the output graphics. I would like high-resolution graphics for publications, but the save_rgb outputs about 85-90 dpi images. Is there an option for vector graphics or high resolution tiff or png images? Best, Darren ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Darren L. Weber, Ph.D. Visiting Postdoctoral Scholar Dynamic Neuroimaging Laboratory, Department of Radiology, University of California, San Francisco, 185 Berry Street, Suite 350, Box 0946, San Francisco, CA 94107, USA. Tel: +1 415 353-9444 Fax: +1 415 353-9421 www: http://dnl.ucsf.edu/users/dweber To explicate the uses of the brain seems as difficult a task as to paint the soul, of which it is commonly said, that it understands all things but itself. --Thomas Willis (The Anatomy of the Brain and Nerves, 1664) ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] tcl script - rotate and save graphics
Sorry, there's no way to change the resolution of the TIFF images. However, we don't supersample when taking screen shots, so just make the window as big as you can, take the TIFF, and then you can use an image conversion program to change the DPI. I don't think you want to use read_binary_surf. If you're just trying to load a single vertex set in addition to the ones you've already loaded, use this function: read_surface_vertex_set field fileName Reads a set of vertices from the fle in fileName. field should be one of the following: 0 Main vertices 1 Inflated vertices 2 White vertices 3 Pial vertices 4 Orig vertices I was having your problem until I replaced read_binary_surf with read_surface_vertex_set, then labl_load works as expected. On Sun, Feb 26, 2006 at 07:19:22PM -0800, Darren Weber wrote: Hi Daniel et al., thanks for the rotate and save_tiff script. I've installed the dev version (redhat 9 download onto Debian sarge) and the script works well. I would like to set the resolution of the .tif output files (eg, 600 dpi), can we do that? I have a problem when using a label in the tcl script (see example.tcl below). I can startup tksurfer from the csh prompt, create a label, save it, exit, start again, load the label, and it displays correctly. So I assume all the label tools are working. When I restart with -tcl example.tcl, tksurfer draws an entirely blue surface after loading the label (any label). Have you seen this before? Am I doing something wrong? Should I source the tksurfer.tcl script, at the beginning of this script, to get all the lighting etc. correct? I tried to startup tksurfer normally, with no explicit -tcl option, and then source example.tcl at the tcl prompt, but the entire surface turns blue after the script loads a label. Can you replicate this or advise me how to avoid it? Is it possible to create a shell script or a tcl script that can startup tksurfer and run a specific tcl script across a group of subjects? Thanks, Darren ## # START EXAMPLE.TCL SCRIPT set SUBJECTS_DIR /usr/local/freesurfer/subjects set subjID ucsf_cj set subjPath [ file join ${SUBJECTS_DIR} ${subjID} ] set subjSurfPath [ file join ${subjPath} surf ] set subjLabelPath [ file join ${subjPath} label ] set subjTiffPath [ file join ${subjPath} rgb ] foreach h {lh} { # --- # load the inflated surface, with curvature set insurf [file join ${subjSurfPath} ${h}.inflated] read_binary_surf set curv [file join ${subjSurfPath} ${h}.curv] read_binary_curv UpdateAndRedraw # --- # load and display relevant .label files set labels [ glob -directory ${subjLabelPath} ${h}_test.label ] foreach l $labels { puts loading label: $l labl_load $l # AT THIS POINT WE HAVE AN ENTIRELY BLUE SURFACE } # now rotate and save the views ... } # END TCL SCRIPT ## Best, Darren Daniel Goldenholz wrote: Hi Darren and other Freesurfers I wrote a tcl script to do just what was described. The one I made gives the flexibility to name the tiff files based on a prefix that you specify before running the script. This way you run the same exact script for as many pictures as you like, simply changing the prefix before running the script. Here is what you do. In tksurfer, after you have set up whatever overlays and/or labels and/or surfaces etc that you like, you enter at the command prompt set pre whatever-you-want (where the stuff inside theis any file prefix... for instance, set pre bold_contrast1 ) then you run the following tcl script via the menu for running a script... UpdateAndRedraw puts Taking Snapshots... make_lateral_view rotate_brain_y 90 redraw set tiff ${pre}_bck.tif save_tiff $tiff make_lateral_view redraw set tiff ${pre}_lat.tif save_tiff $tiff rotate_brain_y 180 redraw set tiff ${pre}_med.tif save_tiff $tiff make_lateral_view rotate_brain_x 90 redraw set tiff ${pre}_inf.tif save_tiff $tiff rotate_brain_x 180 redraw set tiff ${pre}_sup.tif save_tiff $tiff make_lateral_view rotate_brain_y 270 redraw set tiff ${pre}_front.tif save_tiff $tiff Darren Weber wrote: Hi Bruce etal, I would like a short tcl script to rotate each hemisphere through all the main views (lateral, medial, dorsal, ventral, anterior, posterior) and output a graphics file with the name of the subject and the view in the file name. I've found rotate_brain_[xyz] and save_rgb, but the latter does not permit a file name for the output graphics. I would like high-resolution graphics for publications, but the save_rgb
Re: [Freesurfer] tcl script - rotate and save graphics
Hi Kevin, I tried this alterate command, however, the main window continues to display the orig surface, given tksurfer -subjid rh orig It doesn't automatically update the view for the new data in $field. Using the 'UpdateAndRedraw' command and the 'redraw' commands do not change the surface view. Take care, Darren Kevin Teich wrote: Sorry, there's no way to change the resolution of the TIFF images. However, we don't supersample when taking screen shots, so just make the window as big as you can, take the TIFF, and then you can use an image conversion program to change the DPI. I don't think you want to use read_binary_surf. If you're just trying to load a single vertex set in addition to the ones you've already loaded, use this function: read_surface_vertex_set field fileName Reads a set of vertices from the fle in fileName. field should be one of the following: 0 Main vertices 1 Inflated vertices 2 White vertices 3 Pial vertices 4 Orig vertices I was having your problem until I replaced read_binary_surf with read_surface_vertex_set, then labl_load works as expected. On Sun, Feb 26, 2006 at 07:19:22PM -0800, Darren Weber wrote: Hi Daniel et al., thanks for the rotate and save_tiff script. I've installed the dev version (redhat 9 download onto Debian sarge) and the script works well. I would like to set the resolution of the .tif output files (eg, 600 dpi), can we do that? I have a problem when using a label in the tcl script (see example.tcl below). I can startup tksurfer from the csh prompt, create a label, save it, exit, start again, load the label, and it displays correctly. So I assume all the label tools are working. When I restart with -tcl example.tcl, tksurfer draws an entirely blue surface after loading the label (any label). Have you seen this before? Am I doing something wrong? Should I source the tksurfer.tcl script, at the beginning of this script, to get all the lighting etc. correct? I tried to startup tksurfer normally, with no explicit -tcl option, and then source example.tcl at the tcl prompt, but the entire surface turns blue after the script loads a label. Can you replicate this or advise me how to avoid it? Is it possible to create a shell script or a tcl script that can startup tksurfer and run a specific tcl script across a group of subjects? Thanks, Darren ## # START EXAMPLE.TCL SCRIPT set SUBJECTS_DIR /usr/local/freesurfer/subjects set subjID ucsf_cj set subjPath [ file join ${SUBJECTS_DIR} ${subjID} ] set subjSurfPath [ file join ${subjPath} surf ] set subjLabelPath [ file join ${subjPath} label ] set subjTiffPath [ file join ${subjPath} rgb ] foreach h {lh} { # --- # load the inflated surface, with curvature set insurf [file join ${subjSurfPath} ${h}.inflated] read_binary_surf set curv [file join ${subjSurfPath} ${h}.curv] read_binary_curv UpdateAndRedraw # --- # load and display relevant .label files set labels [ glob -directory ${subjLabelPath} ${h}_test.label ] foreach l $labels { puts loading label: $l labl_load $l # AT THIS POINT WE HAVE AN ENTIRELY BLUE SURFACE } # now rotate and save the views ... } # END TCL SCRIPT ## Best, Darren Daniel Goldenholz wrote: Hi Darren and other Freesurfers I wrote a tcl script to do just what was described. The one I made gives the flexibility to name the tiff files based on a prefix that you specify before running the script. This way you run the same exact script for as many pictures as you like, simply changing the prefix before running the script. Here is what you do. In tksurfer, after you have set up whatever overlays and/or labels and/or surfaces etc that you like, you enter at the command prompt set pre whatever-you-want (where the stuff inside theis any file prefix... for instance, set pre bold_contrast1 ) then you run the following tcl script via the menu for running a script... UpdateAndRedraw puts Taking Snapshots... make_lateral_view rotate_brain_y 90 redraw set tiff ${pre}_bck.tif save_tiff $tiff make_lateral_view redraw set tiff ${pre}_lat.tif save_tiff $tiff rotate_brain_y 180 redraw set tiff ${pre}_med.tif save_tiff $tiff make_lateral_view rotate_brain_x 90 redraw set tiff ${pre}_inf.tif save_tiff $tiff rotate_brain_x 180 redraw set tiff ${pre}_sup.tif save_tiff $tiff make_lateral_view rotate_brain_y 270 redraw set tiff ${pre}_front.tif save_tiff $tiff Darren Weber wrote: Hi Bruce etal, I would like a short tcl script to rotate each hemisphere through all the main views (lateral, medial, dorsal, ventral, anterior, posterior) and output a graphics file with the name of the subject and the
Re: [Freesurfer] tcl script - rotate and save graphics
If you are using a recent dev version of tksurfer, then try the function: save_tiff filename If you enter this into the shell and it doesn't work, then you have an older version. Our new release will have this function. There is (finally) some documentation for scripting commands in tksurfer, although it is for the newer dev version. https://surfer.nmr.mgh.harvard.edu/fswiki/TkSurferGuide_2fTkSurferScripting I would like a short tcl script to rotate each hemisphere through all the main views (lateral, medial, dorsal, ventral, anterior, posterior) and output a graphics file with the name of the subject and the view in the file name. I've found rotate_brain_[xyz] and save_rgb, but the latter does not permit a file name for the output graphics. I would like high-resolution graphics for publications, but the save_rgb outputs about 85-90 dpi images. Is there an option for vector graphics or high resolution tiff or png images? -- Kevin Teich ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer
Re: [Freesurfer] tcl script - rotate and save graphics
Hi Darren and other Freesurfers I wrote a tcl script to do just what was described. The one I made gives the flexibility to name the tiff files based on a prefix that you specify before running the script. This way you run the same exact script for as many pictures as you like, simply changing the prefix before running the script. Here is what you do. In tksurfer, after you have set up whatever overlays and/or labels and/or surfaces etc that you like, you enter at the command prompt set pre whatever-you-want (where the stuff inside theis any file prefix... for instance, set pre bold_contrast1 ) then you run the following tcl script via the menu for running a script... UpdateAndRedraw puts Taking Snapshots... make_lateral_view rotate_brain_y 90 redraw set tiff ${pre}_bck.tif save_tiff $tiff make_lateral_view redraw set tiff ${pre}_lat.tif save_tiff $tiff rotate_brain_y 180 redraw set tiff ${pre}_med.tif save_tiff $tiff make_lateral_view rotate_brain_x 90 redraw set tiff ${pre}_inf.tif save_tiff $tiff rotate_brain_x 180 redraw set tiff ${pre}_sup.tif save_tiff $tiff make_lateral_view rotate_brain_y 270 redraw set tiff ${pre}_front.tif save_tiff $tiff Darren Weber wrote: Hi Bruce etal, I would like a short tcl script to rotate each hemisphere through all the main views (lateral, medial, dorsal, ventral, anterior, posterior) and output a graphics file with the name of the subject and the view in the file name. I've found rotate_brain_[xyz] and save_rgb, but the latter does not permit a file name for the output graphics. I would like high-resolution graphics for publications, but the save_rgb outputs about 85-90 dpi images. Is there an option for vector graphics or high resolution tiff or png images? Best, Darren ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer -- Daniel Goldenholz - Cell: 617-935-9421 http://people.bu.edu/danielg/ Mavet v'chaim b'yad halashon Life and death are in the hands of language - Proverbs 18:21 ___ Freesurfer mailing list Freesurfer@nmr.mgh.harvard.edu https://mail.nmr.mgh.harvard.edu/mailman/listinfo/freesurfer