################################################################### LATEST EMAIL UPDATE: 18 Feb 2012 ################################################################### I did another csurf/freesurfer update and put the full Linux tarfile (FreeSurfer0.8 including old SubjectTools as well as MGHTools) and a Mac 10.6 compile (MGHTools only, otherwise equivalent) here: myrtos -> FreeSurfer0.8-120218.tgz myrtos -> csurf0.8-mac-120218.tgz I think the mac version should work on 10.7. If your laptop is 10.7, it would great if you could test whether the 10.6 compile works on it (I forgot which version you have, with so many compiles on different versions... the compile script mk0 now works on all of these: 10.4ppc, 10.4Intel, 10.5Intel, 10.6Intel, 10.7Intel, RH9, Fedora7, Fedora15, CentOS4, CentOS5). The main fixes since the last time I emailed you are: 1) fixed tkmedit/tkregister all-white problem on Mac 10.7 (Mac bug) 2) tksurfer/tkmedit: add libtiff, def save tiff (finally! rgb still avail) 3) tiff2mpg script, menu make mpg from tiffs works 4) autodetects/reads new MGH flat patch format (float) 5) tkmedit: read/fill 3D ROI, save 3D smoothed subsamp stats as BRIK 6) fixed the frigging fonts once again... 7) time-reversing rawaverage (much better map stats than phase avg!) 8) user definable color look up table, also works for complex/phase colors There were a lot of little fixes. For example, I (finally!) noticed that nmovie was not able to show any bitmaps from Rand Block Design! (I think you might have mentioned this to me in the jurassic). I had been replacing the brackets in AFNI label names (e.g., ..[2].. => ..#2#..). Stupidly, nmovie choked on those names (xv was OK!). I changed the replacement to ..@2@.., which works OK with everything. I am still working on including interface support for Don's surfcluster code, which is now all compiled across all platforms, but not yet used by csurf. Also working on averaging 3D phase-encoded stats (pulvinar, etc). You can write out the subsampled registered stat BRIKs but no interface support for averaging them yet. Finally, I am also working on including the latest AFNI MEMA. cheers, marty ############## UPDATE DETAILS ############## ---------------- 18Feb12 FreeSurfer0.8 tarball ------------------------------- --tiff2mpg: new script (no scale/tile/crop), left mri2mpg using rgb's --csurf: re-wrote Help->csurf, incl tiff help, View Log to top of menu --phase/offsetmovie.tcl: abspath rgbname OK --tkmedit.c: libtiff/tiffoutflag, GL_FRONT -> cursor now saved in bitmaps --csurf: black->transparent menu, fix nmovie puke briklabel (braks -> @, not #) --csurf/tclscripts: Preferences -> Save .tiff, save img/movie scripts respect --mytoppm.c: convert tiff to ppm, too (uses libtiff, no longer self-contained) --mk0: also include/compile libtiff, static compile into tksurfer (300K->1Meg!) --tksurfer.c: frame2tiff(), tiffoutflag, black2transparentflag, interface --tkmedit: rm HISTO,SAGMIRR, add new statmask entry line (currently no-op) --randsurfclust.cpp/mk0: add cdflib to csurflibs, fix Darwin compile --csurf: unique-ize AFNI-ALL links (problem if multiple avgs) --tkmedit.c/.tcl: fix BRIK +orig.BRIK filename policy --tkmedit.tcl: auto-read/write complex subsampled stats w/just _r/_x in entry --csurf: get/pass -scandir option to tkmedit --tkmedit.c: setfile-like fixes to exported tcl filename vars, -scandir option --tkmedit.tcl: add FILL,roi lower left, replace outim WRITE w/label R/W/T --tkmedit.c: fill_roi, write_roi, read_roi, labelflag --tk{surfer,medit}.c: no memory leak on re-malloc 3D,4D bufs; bufs now contig --mk0: 10.4=both, 10.5=??, 10.6=both, 10.7=bit, F7=xft, F15=bit, Ubuntu=?? --mk0: def flag compile w/disable Xft (Mac: back to reliable bitmap fonts!) --wrappers.tcl: fix bold Xft fonts on Mac 10.7 (arial bold -> no longer bold!) --tksurfer.c: ReparentNotify->redraw fix Mac 10.7 init white problem --tkmedit.c,tkregister.c: ReparentNotify->resize_window_intstep 10.7 white fix --tkmedit.c: clean up 3D buffer situation ---------------- 02Jan12 FreeSurfer0.8 tarball ------------------------------- --paint: added: -dump normals of a label, improve help message --tksurfer: allverticesflag, val2newcsurvflag (same write_binary_values funct) --paint: non-surflib write_binary_values w/o relpath default out -> SUBJECTS_DIR --paint: accept float BRIK(s), -curvout (newcurv) option, major code cleanup ... ################################################################### LATEST EMAIL UPDATE: 24 Aug 2012 ################################################################### I have updated the FreeSurfer0.8(linux)/csurf(mac) tarfiles on myrtos, but also put copies in a web-accessible place (but somewhat hidden): http://kamares.ucsd.edu/~sereno/csurf/tarballs/.tmp/ Because of the ".", you shouldn't see it if you go to: http://kamares.ucsd.edu/~sereno/csurf/tarballs/ Here are the most recent updates. The main points are, handle 512^3, 0.5mm^3 data for making hi-res surfaces (with 800K vertices!), and calculate complex avg and complex-F for hand-aligned cross subject *3D* retinotopy (for pulvinar). cheers, marty ### 12/08/24 -- FreeSurfer0.8-120824.tgz, csurf0.8-mac-120824.tgz [see full list in ../NOTES.txt] 1) deal with "new quad" (float) surface now made by MGH 2) tksurfer can finally read and smooth overlay files from command line :-} 3) cmdline utilities for making surfaces from 512^3 data (lots 'o vertices) 4) tkmedit can display 512^3, 0.5mm^3 data 5) interface for tksurfer loading volume data (SHRINK hacking on the way) 6) brik2cor/cor2brik now read/write correct AFNI HEAD file 7) fixed bug in ends of color LUT when interpolate *off* 8) tksurfer read val automatically detects complex data (1click read) 9) csurf does cross subject complex-valued F-stats for *volume* 10) csurf/tkmedit auto-reads complex cross subject 3D stats (in sphavg dir) ############## UPDATE DETAILS ############## ### UPDATE (minor bugfix): 28 Aug 2012 --/home/inverse/freesurfer/tarballs/FreeSurfer0.8-120828.tgz --/home/inverse/freesurfer/tarballs/csurf0.8-mac-120828.tgz --csurf: fix tkregtargdir var/entry missing for alignscan, if align->no invert --tkregister.{c,tcl}: harmonize/Mac-ize/usage tk/glx key bindings,help/csurf/reg --tksurfer.{c,tcl}: harmonize/Mac-ize/usage tk/glx key bindings, help/csurf/surf --tkmedit.{c,tcl}: harmonize/Mac-ize/usage tk/glx key bindings, help/csurf/med --help: tkmedit: val,val_read,val_write csurf: setupsphavg VOLAVG doc ### UPDATE: 24 Aug 2012 --surf.c: -newquad option to write new quad (float) surfaces --tksurfer.c: {find,select}_orig_vertex_coords OK w/NEW_QUAD_FILE_MAGIC_NUMBER --tksurfer.c: write trisurf, new/oldquad from div'd-to-tri if undividequadsflag --tkmedit.c: also read NEW_QUAD surfaces --tksurfer.c: finally -real/-imag/-stat/-smoothsteps for cmdline load overlay --tkmedit.c: "tkmedit -f cor/mgz" works, fix Linux tearing: mov win, 1st update --tkmedit.c: read_images saves mgz headvals in globals, write_images req's read --tkstrip.c/wmfilter.c/fill.c/tksurfer.c(readonly): same read/write_images fix --add 3dcopy to included AFNI for convert *.nii to *.BRIK/HEAD --brik2cor.c: repl orig2cor, gen 512^3/0.5mm^3, read ORIENT_SPECIFIC, trilin/nn --tkmedit.c in/display/out 512^3 --cor2brik.c conv 512^3 back to BRIK --calcimg.c in/out 512^3 --tkstrip.c in/out 512^3 --wmfilter.c in/out 512^3 --fill.c in/out 512^3 --surf.c in 512^3 --tksurfer.c: -loadmri1 option requests load this 3D dataset --csurf: onetime checkbutton right of VOLUME to make SURFACE load selected 3D --csurf: new hires SubjectTools menu (old+mgz tkstrip/wmfilter/fill/surf) --csurf: use brik2cor (currently: AFNI align full BRIK only) --tkregister: accept 512^3, fix old off-edge bug --tkmedit: working mgz cube check (copy fixed primary/second from tkregister.c) --mk0: leave otherarch myinstall libs, csurf.tgz to dist, cp arch-specific AFNI --tksurfer.tcl: val: "R" auto-reads/pushes if complex data (_r,_i or _x,_y) --tksurfer.tcl: val: "W" auto-write/swaps if complex data (_r,_i or _x,_y) --csurf/tkregister.c: use/save/edit target-image TR entry on Setup Functscan --csurf: VOLAVG volume Don complex-F test implemented (on _x,_y only) --tksurfer.c: fix non-interpolate color LUT ends, fix help (val2rgb,intplut) --tkmedit.c: -real/-imag in addition to -real/-complex --tkmedit.c: re-wrire substatpatt: cmdline/intern: _{r,i,m}, interface: onevar --csurf: tkmedit cmd: use -real/-imag vs. -real/-complex, -substatpatt_{r,i,m} --csurf: VOLUME-STATS autoloads VOLAVG cross subj subsampled if there --tkmedit.c: fix offedge cursor crash/1x-fail (maxk2),Linux key1-4 resize redraw --clean compile of csurfsrc.tgz on myrtos inserted into FreeSurfer0.8 ################################################################### LATEST EMAIL UPDATE: 04 Oct 2012 ################################################################### hi I will update the distributions after I do more testing to make sure I haven't broken anything. Hi-res (0.5mm^3) csurf updates I finally got MGH mris_inflate to work with hi-res 600K vertex surfaces. Their code is *extremely* optimized for the standard size meshes derived from 1x1x1mm data. It always stops inflating at a curvature criterion that is too high for a hi-res surface (which on a per vertex basis is smoother). The *only* way to fix this was to increase the neighborhood size (since the curvature criterion couldn't be changed). This causes the curvature to be estimated over a larger region -- taking an extra 30 min computation!). Eventually, I will persuade the MGH guys to add another option for "desired_rms_height". After even more effort, however, I was not able to get the MGH mris_make_surfaces to make a pial and white, which is critical for estimating cortical thickness (mris_make_surfaces reads the orig surface, brain.mgz, wm.mgz, and filled.mgz). The problem could be the broken MGH code for reading the pixel size out of the .mgz header -- all MGH .mgz files made by MGH freesurfer have a pixel width of 0 in their header! If you use something else, their tkmedit bails... So... after a crazy weekend of hacking, I fixed up the stale read 3D images part of tksurfer. You can now read in up to three 3D image set into tksurfer in addition to a surface (user interface added to the large, F3, interface), and there is a 4th self-intersect-prevention buffer generated online, and flags for consulting them during SHRINK. I have been using: brain.mgz (made w/PD and refurbished tkstrip) filled.mgz (with my explicit cutting planes feedback) T2.mgz (quantitative T2*) The pial algorithm samples the T1 data and tries to move toward a particular value (e.g., 55) that characterizes the pial surface. That alone, however, results in bulges all over the place, and opposite banks of the sulci bulging past each other, esp. with young subjects :-} To avoid crossing sulci, the outwardly moving smoothwm surface leaves a trail of where each vertex has been in a 3D buffer. This prevent-self-intersect buffer is then consulted during shrink to stop the opposite bank surface from interpenetrating I think mris_make_surfaces uses something simliar, but I didn't look at it in detail. To stop bulging across the midline and out the bottom of the brainstem, a second volume, filled.mgz is consulted. My refurbished old-style manual cutting planes are written into filled.mgz with a darker color (so they are not used to make the surface). During shrink, *any* non-zero data -- including the cutting planes -- stops the shrink force. Finally, with quantitative T1 data, a real problem is the dura under the cerebellum, which unlike in a T1-weighted images is unfortunately the same color as the gray matter of *both* the cerebral cortex and cerebellar cortex (i.e., the standard MGH algorithms actually rely on a T1-weighted artifact). Since we also generate a quantitative T2-star image that does have a different color there, that bulge is now stopped by reading in an consulting a third 3D volume. The standard MGH pathway failed on these images at the same point -- that is, after sampling from 0.8^mm3 data to 1x1x1mm). This means that the Bayesian tissue classifier was also fooled. cheers, marty ############## UPDATE DETAILS ############## ### UPDATE: 04 Oct 2012 --compiled tcltktix on Linux, not yet pasted into FreeSurfer0.8 --tk{med,reg,surf,strip}.c: intercept wm close GL win event w/testclose --tkmedit.c: mv startup GLwin to right for interface onscreen (441 + 10 + 1024) --tkmedit.c: correct (ignored on read) ORIENT_SPECIFIC in write ROI/regsubsamp --tkmedit.c: fix all3+zoomflag curs drawslice/drawslice2 (revert:rm zoomflag=1) --tkmedit.c,tcl: fix draw_surf/updnslice w/all3+zoomflag (HOR:scaletrough->thk) --tkmedit.tcl: unset all3views unsets/hides zoomflag (no non-3views zoom) --tkmedit.c: max intens all3flag shows planefocus, stop tkwin jump Mac resize --tksurfer: Linux: don't raise GL win if just Expose event (was irritating) --tkmedit.c: 512^3 fix: piecewise lin norm, write_regsubsamp_stat, write_roi --calcimg.c: simple average, subtract, divide :-} --csurf/fill.c: add opt -clipfeedback, def changed to 0, add to ExpertPrefs --csurf: RH/LH fill color in ExpertPrefs WMFill, Surf tabs (same var, no edit) --csurf: incr nbrs for hires inflate (long parm search, 15min/hemi), selecthemi --csurf/wrappers.tcl: hotkey menuflash, menubind(was overridden)-> menuacceltxt --tksurfer.c: read second mri data set (fix MRIloaded) (TODO: third/last) --tksurfer.c: write_images .mgz, export write_self_images, tkstripshell->quads --tksurfer.c: shrink: toggle/clear/test/write istilt self-intersect shell --tksurfer.tcl: update SHRINK: add forcemode, flag/CLR/W selfinter, rm bot --tksurfer.c: export read_images() -> read_images/read_images2, $inim/$inim2 --csurf: add interactive load inim2 (filled.mgz, no adjustable starttime load) --wmfilter.c: fix gray line 1 pix from edge (zero SUBSAMPLE_BOUNDARY) --tksurfer.c: im3/inim3/MRI3flag/MRI3loaded/chkthirdflag/chkthird_{hi,lo}lim --tksurfer.tcl: add interactive load third 3D image set, ck3:lo,hi --brik2cor.c: cmdline floatfac now combined with HEAD floatfac (if found) --tk{surfer,medit,register}.c/.tcl: accept equals key as a plus (scale hotkey) --csurf: 6 new help files for entries/buttons on main csurf interface ################################################################### LATEST EMAIL UPDATE: 13 Dec 2013 ################################################################### The main update is that the "w" option in the cross subjects panel to run AFNI 3dttest for real-valued data (one condition at a time...) now works :-} (it wasn't properly painting back to a single subject or running surfclust). These are designed to be used alongside the standard MGH freesurfer (csurf can conveniently run recon-all), but also include tools for making hi-res surfaces (512^3, 0.5mm^3). A larger, also updated, linux tarfile (~270M) that also includes the very old (ca. 2001) surface-making binaries is here: zakros:/home/inverse/freesurfer/tarballs/FreeSurfer0.8-131213.tgz buc05:/usr0/freesurfer/dist/FreeSurfer0.8-131213.tgz To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz Here is a summary of the updates (full details appended). ### 13 Dec 2013 (fix xsub t-test, offscreen render, fix help panels, cleanup) 1) cross subject t-test (AFNI 3dttest) painted and surfclust'd w/phasetype="w" 2) MGHTools->Register now also runs mris_sphere for all-manual morph 3) csurf Preferences menu item to change namefile (for 3D xsub thalamus avg) 4) paint accepts short BRIKs (for DWI 'stats') 5) tksurfer alt/cmd-k makes bigger surface cursor (also color neighbor edges) 6) fix render offscreen (for extra hi-res, new R-click help at rgb WRITE) 7) higher max vertex count (1M->4M) allowed for init orig tessellation 8) live surfclust parms controls added (on pop-up from R-click "label:") 9) updated 36 help panels cheers, marty ### UPDATE: 13 Dec 2013 -- details --lib/help/csurf/setupsphavg: document phasetype=w updates --tksurfer.tcl: block {patch,curv,area} config -value callback (even disabled!) --tksurfer.tcl: setfile {patch,curv,area} blks select_{curv.patch,area} callbak --csurf: putback mk{3d,flat}script setfile's (blk'd callback tksurfer.tcl works) --tk{surfer,medit,register,strip}.c -- flush report run interface,cmdli scripts --csurf: add mris_sphere (all default) to MGH Register sequence --bresize.c: help a little better: TODO: both-way example! --csurf: samp2subj pass1: if real, don't skip surf2surf --csurf: samp2subj pass2: if real, don't skip surfclust (N.B. tstat => _h) --csurf: samp2subj pass2: if real, look for AFNI -tstat- not csurf-intern -stat- --csurf: mghsphereregcmd warns missing morph register targ (.tif) --lib/help/tkmedit/valn2up: vals typo --tksurfer.c: fix crash: raise_window w/o open gl window open --tksurfer.tcl: TODO: setfile mk abbrev trigs select_{curv.patch,area} callback --tksurfer.tcl: tixcombo -variable {curv,patch,area}abbrev so setfile updates --tksurfer.tcl: make select_patch act like viewcuts on read *.3d --setdefpatchview.tcl: don't apply flat xforms to *.patch.3d (we want viewcuts) --lib/tcl/{curv,eccen.fs,polar,real,twocond}-flat.tcl: readenv bef. setdefpatch --lib/help/tksurfer/{scripts,rgb,tksurfer} -- funcs/vars, offscreen render, "S" --tksurfer.tcl: rm hack to for old fixcolors missing entries ending in .e* --wrappers.tcl: fix fixcolors to (mostly) check widget class --lib/tcl/movie360.tcl: add diag 360 rotation, zoom-and-back --lib/help/csurf/{csurf,makenewfunct} --csurf: rearrange Preferences menu, add more separators --csurf: Preferences -> Change Subj for Curr Session to change namefile --lib/help/csurf/smoothcurvinflatesulchires => new helpfile, edited non-hires --tksurfer.tcl: 3toggle inset: disk(but=rect) => rect(but=off) => off(but=disk) --lib/help/tksurfer/cuts: add remake cuts w/label trick --lib/tcl/setdefpatchview.tcl: accept $type*.patch.flat* to set patch view vars --tksurfer.tcl: patch:match $hemi.$type*.patch.$suff*, curv:match $hemi.$type* --lib/help/csurf/tksurfer -> bigcursor hotkey doc --tksurfer.tcl: bind toggle bigcursor to Cmd/Alt-k --tksurfer.c: change bigcursorflag to draw edges to each neighbor, bind Mod-k --paint.c: accept AFNI short BRIK (for DWI), require BRICK_FLOAT_FACS=0 --tksurfer.c: eventloop: Tk_GetNumMainWindows(), static global window vars --tksurfer.c: lower occluding white offscreen map window (not filled on Linux) --tksurfer.c: fix openglxwindow renderoffscreen, XMoveWindow hack for Mac --tksurfer.c: separate close_window(), export to tcl --lib/help/tkmedit/all -> usage of ALL w/spherical ramp --csurf: fix: add close $id accidentally rm'd below into writearrayparms (!) --FreeSurferEnv.sh: fix execute-prevention test (no "-bash" broke Mac 10.7 bash) --mk0: update helpfile list --csurf: in medtestrender: sub{real,image} => up{real,imag} --csurf: def missing tkmedit rawdata arg stimcycles (e.g., surfavg, notfour) --libhelp/tkmedit:rm vals,vals_{write,read},mskn2s,valn2s,msks,msks_{read,write} --lib/help/tkmedit: sfmid,sfslope,sfthresh --lib/help/tkmedit: valup,valup_{write,read},valn_read,valn2up,smoothstats roi_time,maskn2up,maskup,maskup_{read,write},mask_ck,fwhm --tkmedit.tcl: use renamed functs/vars --tkmedit.c: rename all subsamp/substat/2sub var/functs to upsamp/upstat/2up --tksurfer.tcl: add alt-shift-arrow translate_brain help/keybindings --lib/help/tksurfer/{xrot,yrot,xtrans,ytrans} --lib/help/csurf/{rc-VOLUME,tksurfer}: doc tkmedit cmdline, tksurfer shift-arr --csurf: pass nondef -wmfillthresh to tkmedit so edit->wht OK below wmfillthresh --tkmedit.c: accept -wmfillthresh (def=2=WM_MIN_VAL), edit->wht if below --tksurfer.c: add Shift-arrow -> translate keybindings (vs. no-shift -> rotate) --surf.c: 1M->4M def maxvertices/maxfaces (bucky3), check overflow, add maxopts --csurf: log csurf.dat writes (accid. deleted close $id here, fixed above!!) --csurf: save/pass -wmfillthresh parm to reconditioned fill --csurf: statbrikstem accepts *Coef*+orig.BRIK (in add. to *+orig_?+orig.BRIK) --csurf: forcebrik LSB -> MSB HEAD fix message written to cmds-only file --csurf: Preferences to open/close file into which only cmds are dumped --FreeSurfer0.8: add lib/Linux-i386/{GLU,libjpeg so's} (!) --FreeSurferEnv.csh,sh: replace lsb_release with parse /etc/issue, auto rh9 --wrappers.tcl: rm lsb_release (was crashing Fedora15!) --tkmedit.c: correct FWHM report for 512^3 --fill.c: expose optional -wmfillthresh parm for smoothed upsamp wm (bucky3) --lib/help/tksurfer/val3d_{paint,clust} --tksurfer.tcl: add clust parms to NormSamp,Cluster Controls for live surfclust ################################################################### LATEST EMAIL UPDATE: 06 Jan 2014 ################################################################### The main updates are: (1) time shift now allowed in reversed-time raw averages (avoids having to use huge full FTs) (2) wmfilter/tkmedit can now do anisotropic *Gaussian* plane filter to emphasize locally planar edges in 3D images (esp. useful in thalamus, but also makes better wm.mgz than original wmfilter when truncated) (see PFGAU button and right-click help there) (3) tkmedit can do 2D color operations (label or edit out regions in elliptical portions of im,im2 space) (see right-click on "im2:" for live transparent mask, and OP button on F3 interface for editing data) (4) 12 new/updated help panels These are designed to be used alongside the standard MGH freesurfer (csurf can conveniently run recon-all), but also include tools for making hi-res surfaces (512^3, 0.5mm^3). A larger, also updated, linux tarfile (~270M) that also includes the very old (ca. 2001) surface-making binaries is here: zakros:/home/inverse/freesurfer/tarballs/FreeSurfer0.8-140106.tgz buc05:/usr0/freesurfer/dist/FreeSurfer0.8-140106.tgz To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ---------------- 06Jan14 FreeSurfer0.8/csurf0.8 tarballs --------------------- --tkmedit.tcl: force check update: readsurf, redraw-reset-of-failed-2dcol-flag --mk0: add new helpfile: imim2op --lib/help/tkmedit/{sphnorm,test1,imim2op[NEW],saveimg,smooth,smoothstats} --tkmedit.tcl: add "OP" button plus entry to run imim2op's in F3-panel --tkmedit.c: imim2op edits im (op=0: edit ellipse im,im2 space OFF), opts/usage --wrappers.tcl: controls ents/cks: bind Return, locREDRAW|redrawbutton|redraw --lib/help/tkmedit/{label,imentry,im2entry}: im2alpha ->overlayalpha, 2Dcol doc --tkmedit.tcl: add F4 {im,im2} 2D col ctrls, toggle 2D coloverlay, redraw logic --tkmedit.c: live color elliptical region of im,im2 space w/transparent label --lib/help/tkmedit/{wmfilterstd,wmfiltergau} -> help for new buttons --wmfilter.c: rm read/write wmfilter.dat: avoid accid redo last, no gausstrunc --wmfilter.c: gaussflag skips nearzero, gauss opt bug, report read wmfilter.dat --csurf: Shift-{left,middle} click PFGAU adds trunc to editable/COMPARE --tkmedit.c: rm wmfilter_corslice(): stale, tkmedit.tcl run_wmfilter replaces --mk0: update helpfile list --add lib/help/tkmedit/{wmfilterstd,wmfiltergau}, rm lib/help/tkmedit/wmfilter --tkmedit.tcl: PFILTER -> R-click PF,PFGAU->editable, mid-click output->COMPARE --tkmedit.tcl: run_wmfilter: std/trunc or gau, load output editable or 2nd buff --wmfilter.c: add notrunc/nocfrac Gauss convolve in plane of lowest variance --wmfilter.c: rm im2, f2->f, cfrac[n]z parms, rename func, better datfile read --csurf: fixed bug in singlsub randblock not auto-updating StatMask Paintfile --csurf: report commented-out, tmptcl surf/med script name/cmds in cmdsonly log --csurf: popup reports name of cmdsonly file on close --mk0: dist/insttmp new 64-bit fs binaries --dist/precompiled/bin/Darwin-x86_64/{mri_convert,mri_surf2surf,nmovie} --tksurfer.tcl: block (harmless) callback to redrawbutton before GL window made --lib/help/csurf/setuprawavg: time shift help --csurf: add TR shift parameter to rawaverage, bakcompat default=0 --rawaverage.c: add shift by TR's in reversed tseries before avg (pad w/end2) ------------------------------------------------------------------------------ ################################################################### LATEST EMAIL UPDATE: 13 Jan 2014 ################################################################### Here are the main changes (see UPDATES.txt for complete history: (1) fixed sign of rawaverage time shift (sorry about that!!) (2) write out values on surface *under* a DSP'd label (transparent display). That is, ignore values in the DSP'd label and read them from current display. This allows a one-step label-use (no need to re-cut). Currently bound to: shift-middle-click the "W" on the "label:" line. For reference, left-click is write values from all currently visible vertices, and middle click is write out vertex-color-label (current colors of displayed vertices -- for assembling displays with different color scales onto one surface). As always, pop-up help at right-click any button. (3) new cmdline script (in 3 diff language versions: runra.{tcl,csh,sh} to run up to 'n' copies of recon-all in the background and monitor them as they finish and start a new process until a long list of subjects is reconstructed. This is for batch reconstruction using MGH freesurfer on a multi-core machine. (4) 7 new/updated help panels To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ---------------- 13Jan14 FreeSurfer0.8/csurf0.8 tarballs --------------------- --FreeSurferEnv.sh: rm bashism --lib/help/csurf/{csurf,setuprawavg,reconall} --revra.{tcl,csh,sh}: run up to n copies recon-all in bg for long subj lists --lib/tcl/{eccen,polar,twocond}-{views,flat}.tcl -> fix log messages --lib/help/tksurfer/{cuts,smooth,smooth_steps,label_write} --csurf: fix setup rawavg panel rev time label --tksurfer.c: kill confusing "###" warn if non-.val/.val2 empty before swap --rawaverage.c: rewrite harmless/wasteful/confusing/signerr avg for non-padded --tksurfer.c: clear_values, read_binary_surface: fixedval=1, undefval=0 (sparse) --tksurfer.c: fix_nonzero_vals also undefval=0 (for sparse: was just fixedval=1) --tksurfer.tcl: read_label_to_val (label: "R") does fix_nonzero_vals (sparse) --tksurfer.c: write_annoted_vertices now uses curr .val (was 0.0) (for fill BA) --tksurfer.tcl: shift-middle-click 2x overload label W: DSP'd vtx .vals to label --tksurfer.tcl: add missing global abbrev's in proc's for val/label/insurf/fs/fm --tkmedit.tcl: purple button feedback for long-running PF/PFGAU, purple kill --tkmedit.tcl: wmfilter in bg, pidnamerunning proc to test bgproc finished --tkmedit.tcl: fscolormap2lut defaults lut if MGH talaiarch labels file missing --tkmedit.tcl: resolv val2rgblutsub -> val2rgblut in setfile (subjdir MGH lut) --tkmedit.tcl: change uplevel setfile ... in procs -> add global abbrev to proc ------------------------------------------------------------------------------- ################################################################### LATEST EMAIL UPDATE: 05 Feb 2014 ################################################################### Here are the main changes (see UPDATES.txt for complete history): (1) when tksurfer displays label with DSP, current transparency ("alph" entry) also used (was just using color in r,g,b entries). To set transparency of all labels the same, use in "alph" entry (2) clicking tksurfer "area:" label toggles to "area2" to read in a second area file for calculating area ratio (middle-clicking "area:" auto-reads/calculates/displays area ratio as 'curv') (3) 1600 lines of csh compile/run code ported to POSIX sh (not visible) To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ---------------- 05Feb14 FreeSurfer0.8/csurf0.8 tarballs --------------------- --README.txt: updated to remove csh compile requirement --mk0: port to sh, save working csh script as mk0.csh (can now compile w/o csh) --mk: port to sh, save working csh script as mk.csh --getonearch: port to sh, save working csh script as getonearch.csh --brik2bfloat.c: fix write bfloat hdr file (y,x,t, not x,y,t) connectome DTi --mk0: add new help file: area_lab --lib/help/tksurfer/{area,area_read,area_write,area_lab} --tksurfer.tcl: also load areafiles to curv dropdown, select_curv col autosets --tksurfer.tcl: calcdisp_arat bound to middle-click "area:" label --tkstrip.tcl: rm unneeded backslashes in curly brace -command args/logic --tkregister.tcl: rm unneeded backslashes in curly brace -command args/logic --tkmedit.tcl: rm unneeded backslashes in curly brace -command args/logic --tksurfer.tcl: rm unneeded backslashes in curly brace -command args/logic --tksurfer.tcl: bold "area:" label swaps with "area2" for read_binary_areas2 --tksurfer.tcl: overload "R" area with read_binary_areas2 --tksurfer.c: read_binary_areas2(), compute_area_ratio(), $area -> .origarea2 --mk0: cosmetic tidying --csurf: add entry for sample surface for 3D stats to phase combine panel --lib/help/tksurfer/{rect,labelalpha} --tksurfer.tcl: labelalpha Return: reset alpha of all currently displayed annot --tksurfer.c: set_annot_alpha: reset all labels alpha same --tksurfer.c: read interface alpha at read_label_to_annot_using_col time ------------------------------------------------------------------------------- ################################################################### LATEST EMAIL UPDATE: 15 Apr 2014 ################################################################### Here are the main changes (see UPDATES.txt for complete history, detailes of last 2 updates appended below): 1) tkregister now auto detects sample policy "round" (in MGH register.dat's from tkregister2/bbregsiter) vs. "trunc" (original tkregister). You can also change the sampling policy live with the F3 interface. For a while, MGH tkregister2 and bbregister register.dat's have had a line containing "round" after the transform matrix. With previous csurf versions, this was only a problem when you mixed tkregister2/bbregister-derived matrices with csurf tkregister ones. Now they can be mixed. For gory details, see csurf: Help -> tkreigster 2) tkregister/paint/tksurfer/tkmedit autodetect and use "round" vs. nothing (or "tkregister") in MGH register.dat (e.g., for surface normal sampling of raw timecourses from tksurfer label, 3D stats overlays in tkmedit). 3) tksurfer and tkmedit can now save a log containing the tcl commands executed when you do any interface action (so you quickly make a tcl script to automate any series of interface actions). To turn this on, click the "tcl:" label in tksurfer or tkmedit, or use: "Preferences -> Log tksurfer/tkmedit actions as tcl cmds" 4) fourier can compute single-subject p-values based on permutation of frequencies (multi-threaded, still takes a half an hour). This generally returns more significant p-values than p-values from the original F-ratio calculation. To use, set a non-zero value to number of permutations on the Fourier panel 5) added more 32-bit libs so nmovie works on curr default 64-bit Linux install 6) update Help -> csurf/tkregister/tksurfer/tkmedit To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ### UPDATE: 15 Apr 2014 --edit: lib/help/csurf/{setupfunct,tkregister,tkmedit,tksurfer} --tkmedit.tcl: bold "tcl:" if clk'd to log interface tcl cmds, bold if startup --tksurfer.tcl: bold "tcl:" if clk'd to log interface tcl cmds, bold if startup --tkregister.tcl: updated help panel bindings --new files: lib/help/tkregister/{savereg,readreg,round} => add to mk0{.csh} --csurf: "init round" tick allow INIT old/new regdat, report current, else def=1 --tkmedit.c: roundreg for do_regupsamp_stat,get_timecourse,write_roi_timecourses --tksurfer.c: read regdat round, use in paint_surface,normdsamp_timecourse_stat --tkregister.tcl: move/uncover gl window w/interface size change --tkregister.c: export func/vars to save GL winxy for interface size chn --tkregister.tcl: popup warn change round policy on SAVE REG --tkregister.tcl: F3 omit unused top line widgets (POP GL, READENV), squish --tkregister.tcl: F3 tick report/override roundregflag read from register.dat --tkregister.c: tcl export roundregflag so tkregister.tcl can change on the fly --tkregister.c: optional rint() vs. 2 int truncates (reversed) and one floor --tkregister.c: read/write optional register.dat "round" to match tkregister2 --tkmedit.tcl: logcmd all button/entry/check/radio --tkmedit.tcl: logcmd: {r,w}{native,upsamp}{mask,stats},gettseries,do_imim2op --tkmedit.tcl: logcmd: setfile,test_{write,read}_images,run_wmfilter,check*,def* --tkmedit.tcl: turn off incorrect pixval when zoomed (TODO: fix, turn back on) --tkmedit.tcl: tkmeditlogflag, enabledisablelog, setfile does logcmd --wrappers.tcl: proc controls does logcmd's for its entries,checks --lib/help/tkmedit/imim2op, lib/help/csurf/csurf --tkmedit.c: add 2nd imim2op twocol oper: new:1=ell2on (existing:0=ell2off) --tksurfer.tcl: floss fieldsign tk, fixcolscale: fix fieldsignflag, report flags --tksurfer.c: export fieldsignloaded: tksurfer.tcl test fail read, fs scalebar --csurf/tk{surfer,medit,strip}.tcl: rm procs foundbywhich, canwriteormakefile --wrappers.tcl: add foundbywhich, canwriteormakefile, cleanup/reorder/comment --tkstrip.tcl: rm canwriteormake, foundbywhich (now in wrappers.tcl) --tksurfer.tcl: rm foundbywhich, canwriteormake (now in wrappers.tcl) --tkmedit.tcl: rm canwriteormake, foundbywhich (now in wrappers.tcl) --csurf: Preferences -> Log tksurfer actions as tcl cmds --tkmedit.c, export/option tkmeditlogflag so csurf can pass --tksurfer.c: if tksurferlogflag, send tcl command to log left_click x,y --tksurfer.c, export/option tksurferlogflag: tksurfer can chk, csurf can pass --tkmedit.tcl: pidnamerunning now uses ps uxww for Linux, too --tkmedit.tcl: rm xhost+ req send inter-proc tclcmd + findsendto from SEND PNT --tksurfer.tcl: rm xhost+ req send inter-proc tclcmd + findsendto from SEND PNT --tksurfer.tcl: tksurferlogflag: logcmd every interface action -> tksurfer.log --tksurfer.tcl: logcmd: setfile,{r,w}{vc,val,stat,surf},paint,smooth,roi,shrink --tksurfer.tcl: clicking "tcl:" toggles enable/disable tksurferlogflag --wrappers.tcl: testreplace uses logcmd (wraps many interface commands) --wrappers.tcl: add open/write/close log interface tcl cmds --paint.c: fix read opts bug disabling -bok (tksurfer:paint_surface() OK) --mk0{.csh}: install extra precompiled below --nmovie: Linux: older bin (newer 395K not compat w/Fedora7,Centos5.9 32b libs) --dist/precompiled/lib/Linux-i386 libs for (just!) 32b nmovie on def 64bit OS --add5: libXaw.so.7, libXi.so.6, libXxf86vm.so.1, libglut.so.3, libtiff.so.3 --lib/help/csurf/makerelaxationcuts (redo/multipleLINE) --fourier.c: funcptr wrapper for loop of threads for compute_fourier_stat_slice --fourier.c: afs/cfs/ts->loc, sigim,rawim(big=0.3G)->4D for threaded (5% slower) --fourier.c: permute freq, recalc F, p=fraction-permuted w/higher F => better ### UPDATE: 7 Mar 2014 [previous, for reference] --mk0{.csh} -- afni/progs/dist/inst: 32b libs AFNI/tk{surf,med,reg} on 64b OS --mk0,mk0.csh: better dist/inst/afni/ for precompiled libs --FreeSurferEnv.{csh,sh}: linux add LD_LIBRARY_PATH (centos 32bit for 64bit) --fourier.c: read AFNI float too (to short buff), was: read as short w/o warn! --rm unused -lGLU from tk{medit,register,strip} => still in tk{surfer,wheel} --paint.c: add subvoxel -offset for testing --paint.c: also read 256^3 or 512^3 float .mgz/.mgh (OK for -complex, too) --runra.sh: fix 'which' response testing --lib/help/csurf/tkmedit --tkmedit.c,tcl: opencursorflag, cmd-O (overlay forces open) --tkmedit.tcl: if -pf,-tr infix already there and $force, overwrite --tksurfer.c: bad neighbors warnings in read_binary_surface, find_neighbors --tksurfer.c: find_neighbors catches >100 nei vtmp overflow (vtx=0:surf bug?) --brik2cor.c,fill.c,orig2cor.c,regcor.c,surfcombine.c,wmfilter.c =>void *lcalloc --surlib.c,tkmedit.c,tkregister.c,tksurfer.c,tkstrip.c => void *lcalloc --surf.c: fix overflowing pack tables w/512: read actual image size (bucky bug) --surf.c: increase max vtx/faces 4M->6M for unsplit hemis cerebellum recon --tkmedit.tcl: pass/warn kcnt from F2 panel --wmfilter.c: add -kcnt to allow 7x7x7 kernel, -kcnt clamps to 5 or 7 --lib/help/tkmedit/{wmtrunc,wmfiltergau,wmfilterstd} --tkmedit.tcl: catch attempt to add second infix --tkmedit.tcl: planefilter done popup says how to save, warns infix name change --tkmedit.tcl: check tmp wmfilter outfile exists before create, rm when done --tkmedit.tcl: middle-click on TRUNC button applies trunc to editable buffer --mk0,mk0.csh: add 3drotate to saved-from-AFNI --tkmedit.tcl: report GaussPlaneFilter kfwhm and order ops: Trunc+PlaneFilter --tkmedit.c: allow 'no -f' tcl script, quit tkmedit local if COR-001 not found --tkmedit.c: fix flip_corview_xyz crash w/512 --brik2cor.c: noresampflag: hires-aware override HEAD for 1pix=>1pix --tksurfer.tcl: add bokflag/sulfrac/gyrfrac to "NormSamp, Clust Controls" popup --tksurfer.c: add -bokflag/-sulfrac/-gyrfrac, paint.c:paint_surface Bok correct --tksurfer.c: read_binary_curv saves curvmin/max in globals --csurflibs/csurflib.h: add .thickness to vertex structure (!) --paint.c: Bok correct: use curv and middle-of-cos bump, req's dfrac{min,max} --paint.c: copy thickness read into curv field to new csurflib .thickness memb --calcvert.c: no strsep() in IRIX: back port to strtok() --calcimg.c: no rintf() in IRIX, ifdef IRIX rint() --mk0: IRIX insttmp: fix tar z flag --*.cpp Makefiles: rm -Wall from IRIX CFLAGS since just here use CC, not gcc/g++ --all Makefiles: IRIX CFLAGS: add "-n32 -mips3", LIBS: -lm,-ljpeg after -ltiff --IRIX csurflibs/clustlib.h: ifdef C++ header files: => /**/,,/**/,,/**/ --mk0: gmake using IRIX CC won't accept .cpp, so mk0 prog moves files to .cc --IRIX tifflib patch: rm C++ style comments from tiff2pdf.c,tiff2pdf.c --IRIX tifflib patch: tif_stream.cxx: ios::iostate old_state; => int old_state; --IRIX tifflib patch: libtiff/tif_stream.cxx: #include => --mk{.csh}: $makeprog set but not used (found w/IRIX compile), report set env --mk0{.csh}: rm double AFNI install, req confirm use existing AFNI if not force ################################################################### LATEST EMAIL UPDATE: 04 May 2014 ################################################################### Here are the main changes (see UPDATES.txt for complete history, detailes of last 2 updates appended below): 1) new "label:" button "C" to generate overlap labels. In contrast to the "RC" button (read, re-cut label), this cut button does *not* restore currently invisible vertices, so doing "C" for 2 or more labels leave the intersection (AND) of them, saveable with "W". 2) add MATLAB "Jet" colorscale (colscale=15, blue/cyan/yellow/red) Bounds of scale (dark blue, dark red, clamped beyond) set by truncphase entries, accessible on large [fn]-F3 panel and View Functional Data as "jt", reversed w/invphase. Unlike other scales, extreme values are dark so best adapted to full rank data. If fthresh/fmid not zero, fades to background. 3) if tkregister sample policy is "round", add 1/10 micron (0.0001 mm) offset to transform to avoid aliasing zoomed voxels at zoom=2. 4) "R" button on "val:" line now also accepts a 1frame 1D float *.mgh file (e.g., output of FSL/freesurfer surface-based pipeline). Note that these files typically do not contain indication of which hemisphere they came from (if fsaverage, can be read into either!). The "PaintFile:", "StatMask Paintfile:" and "val:" dropdowns will be loaded with any available .w or .mgh files. The tksurfer read_binary_values command auto-detects magic number in valfile or curv, or *.mgh suffix to determine format. 5) Setup Align/Funct scan accepts conforming (256/512) .mgz file for MOVEABLE (for qT1 pseudo 'functional' overlay) 6) conflicting internal variable name semantics cleanup, csurf vs. C/tcl: [hopefully be no visible effect of this!!] csurf: $session = "130503MS" $scandir = "image/polar1" => change varname to: $iscandir C/tcl: $session = "/usr0/fspace/130503MS/image" => varname: $isession $scandir = "polar1" To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ### UPDATE: 04 May 2014 --register.tcl: if round policy change accepted, update roundregorigflag --lib/help/csurf/{csurf,setuprender} update --wrappers.tcl: incr okclose win name (crash from double-click upper left 'x') --tksurfer.c: invphase flips MATLAB_JET, silently correct flip scale limits --lib/help/tksurfer/{val_jt,label} update --lib/help/csurf/{makerelaxationcuts,tksurfer} update --tksurfer.tcl: DSP->D, add C: like DSP, but recuts label for 2+ labels overlap --tksurfer.c: read_label_to_annot_using_col can recut (with no restore) --newhelpfile: lib/help/tksurfer/label_readcut --lib/help/tksurfer/{smooth_steps,smooth} --lib/help/tksurfer/{label_write,label_read,label_clear,label,fill,cuts} --tksurfer.tcl: DSP->D, add C: like DSP, but also re-cuts label to get overlap --tksurfer.c: read_label_to_annot_using_col can recut: find AND of 2+ labels --### conflicting internal varname fix done: [i]session/[i]scandir var rename --tkstrip.tcl: match new tkstrip.c name: $session->$isession (incl "image") --tkstrip.c: srname->sename, tclexp sename: $session->$isession --csurf: add redundant/safe "set iscandir $page" (usu. done by browse notebook) --tkregister.tcl: match new tkregister.c name:$session->$isession (incl "image") --tkregister.c: rename [p]srname->[p]sename, tclexp sename: $session->$isession --tkmedit.tcl: match new tkmedit.c name: $session->$isession (incl's "image") --tkmedit.tcl: rm unused proc setsession --tkmedit.c: rename tcl export of sename: $session -> $isession --wrappers.tcl: $session -> $isession (affects tkmedit, too) --{movie360,phasemovie,offsetmovie,fs-make,borders}.tcl: $session -> $isession --{eccen,polar,fs,real,twocond}-{flat,views}.tcl: $session -> $isession --tksurfer.tcl: rm unused proc setsession --tksurfer.tcl: match new tksurfer.c name: $session->$isession (incl's "image") --tksurfer.c: rename tcl export of sename : $session -> $isession --csurf: rename global $scandir to $iscandir (usu. includes "image") --csurf: rename proc getfunctscandirslist -> getfunctiscandirslist --tksurfer.tcl: rm tksurfer.tcl trace setting exported $scandir to no-image $dir --csurf: $session="130503MS" $scandir -> $iscandir="image/polar1" (w/"image") --C/tcl: sename=$session -> $isession="/usr0/fspace/130503MS/image" (w/"image") scname=$scandir="polar1" --### begin fixing conflicting internal csurf vs. C/tcl var meanings --lib/tcl/fs-make.tcl: also write fs/fm as wfiles, now uses setfile, needs $dir --csurf: fieldsigncmd: pass dir=[trimoneparent $page] for fs-make setfile --update lib/help/tksurfer/val_w1 --newhelpfile: lib/help/tksurfer/val_jt --tksurfer.tcl: F3 MATLAB jet "jt" colscale, scale ends: truncphasemin/max --tksurfer.c: MATLAB_JET=15 colscale (e.g. fs), fade, {s}f{thresh,mid,slope} --tkregister.c: add 1/10 micron offsets to xform matrix to fix zoom=2 aliasing --tkregister.c: left ifdef'd out ROUNDTARG code in drawslice/select_pixel --lib/tcl/real_{views,flat}.tcl: if floatstem is *.mgh, *don't* append -$hemi.w --csurf: getuniqwfilelist accepts *.mgh files (put into Paintfile dropdown) --csurf: getuniqwfilelist checks -[rl]h.w there before stripping it --lib/tcl/{polar,eccen,twocond}-{views,flat}.tcl: use $maskfloatstem if exists --csurf: functscan READ HEADER reads mgh/mgz header w/tkmedit to fill in panel --csurf: change confusing check label on main interface: surfload -> load2surf --csurf: allow FUNCT=>SUBJ button to pass .mgz file to tkregister as MOVEABLE --tkmedit: make -header also work w/-f or no -f, update help --tksurfer.c: read_binary_values accepts 1frame-1D-float-.mgh file --tksurfer.tcl: also load .mgh files to "val:" dropdown --tkregister.c: fixed select_pixel bad bounds chk crashing SAG right edge click --tkregister.c: fix bad imnr1_2 select_pixel bounds check --tkregister.tcl: double click tkwin raises gl window (replace rm'd POP GL) --tkregister.tcl: showvisible after 'set overlay blah' update TARGET/MOVEABLE --csurf: fix addfunctscan showstopper: setinitroundflag before defaults created --lib/tcl/setdefpatchview.tcl: "cortex" made synonym of "full" for fsaverage --tksurfer.tcl: add cortex to patch look list --tksurfer.tcl: use shrinkcomboarrows --wrappers.tcl: add shrinkcomboarrows (height:18->17/14Fedora, width:15->13) --edit: lib/help/csurf/{setupfunct,tksurfer} ### UPDATE: 15 Apr 2014 [previous, for context] --edit: lib/help/csurf/{setupfunct,tkregister,tkmedit,tksurfer} --tkmedit.tcl: bold "tcl:" if clk'd to log interface tcl cmds, bold if startup --tksurfer.tcl: bold "tcl:" if clk'd to log interface tcl cmds, bold if startup --tkregister.tcl: updated help panel bindings --new files: lib/help/tkregister/{savereg,readreg,round} => add to mk0{.csh} --csurf: "init round" tick allow INIT old/new regdat, report current, else def=1 --tkmedit.c: roundreg for do_regupsamp_stat,get_timecourse,write_roi_timecourses --tksurfer.c: read regdat round, use in paint_surface,normdsamp_timecourse_stat --tkregister.tcl: move/uncover gl window w/interface size change --tkregister.c: export func/vars to save GL winxy for interface size chn --tkregister.tcl: popup warn change round policy on SAVE REG --tkregister.tcl: F3 omit unused top line widgets (POP GL, READENV), squish --tkregister.tcl: F3 tick report/override roundregflag read from register.dat --tkregister.c: tcl export roundregflag so tkregister.tcl can change on the fly --tkregister.c: optional rint() vs. 2 int truncates (reversed) and one floor --tkregister.c: read/write optional register.dat "round" to match tkregister2 --tkmedit.tcl: logcmd all button/entry/check/radio --tkmedit.tcl: logcmd: {r,w}{native,upsamp}{mask,stats},gettseries,do_imim2op --tkmedit.tcl: logcmd: setfile,test_{write,read}_images,run_wmfilter,check*,def* --tkmedit.tcl: turn off incorrect pixval when zoomed (TODO: fix, turn back on) --tkmedit.tcl: tkmeditlogflag, enabledisablelog, setfile does logcmd --wrappers.tcl: proc controls does logcmd's for its entries,checks --lib/help/tkmedit/imim2op, lib/help/csurf/csurf --tkmedit.c: add 2nd imim2op twocol oper: new:1=ell2on (existing:0=ell2off) --tksurfer.tcl: floss fieldsign tk, fixcolscale: fix fieldsignflag, report flags --tksurfer.c: export fieldsignloaded: tksurfer.tcl test fail read, fs scalebar --csurf/tk{surfer,medit,strip}.tcl: rm procs foundbywhich, canwriteormakefile --wrappers.tcl: add foundbywhich, canwriteormakefile, cleanup/reorder/comment --tkstrip.tcl: rm canwriteormake, foundbywhich (now in wrappers.tcl) --tksurfer.tcl: rm foundbywhich, canwriteormake (now in wrappers.tcl) --tkmedit.tcl: rm canwriteormake, foundbywhich (now in wrappers.tcl) --csurf: Preferences -> Log tksurfer actions as tcl cmds --tkmedit.c, export/option tkmeditlogflag so csurf can pass --tksurfer.c: if tksurferlogflag, send tcl command to log left_click x,y --tksurfer.c, export/option tksurferlogflag: tksurfer can chk, csurf can pass --tkmedit.tcl: pidnamerunning now uses ps uxww for Linux, too --tkmedit.tcl: rm xhost+ req send inter-proc tclcmd + findsendto from SEND PNT --tksurfer.tcl: rm xhost+ req send inter-proc tclcmd + findsendto from SEND PNT --tksurfer.tcl: tksurferlogflag: logcmd every interface action -> tksurfer.log --tksurfer.tcl: logcmd: setfile,{r,w}{vc,val,stat,surf},paint,smooth,roi,shrink --tksurfer.tcl: clicking "tcl:" toggles enable/disable tksurferlogflag --wrappers.tcl: testreplace uses logcmd (wraps many interface commands) --wrappers.tcl: add open/write/close log interface tcl cmds --paint.c: fix read opts bug disabling -bok (tksurfer:paint_surface() OK) --mk0{.csh}: install extra precompiled below --nmovie: Linux: older bin (newer 395K not compat w/Fedora7,Centos5.9 32b libs) --dist/precompiled/lib/Linux-i386 libs for (just!) 32b nmovie on def 64bit OS --add5: libXaw.so.7, libXi.so.6, libXxf86vm.so.1, libglut.so.3, libtiff.so.3 --lib/help/csurf/makerelaxationcuts (redo/multipleLINE) --fourier.c: funcptr wrapper for loop of threads for compute_fourier_stat_slice --fourier.c: afs/cfs/ts->loc, sigim,rawim(big=0.3G)->4D for threaded (5% slower) --fourier.c: permute freq, recalc F, p=fraction-permuted w/higher F => better ################################################################### LATEST EMAIL UPDATE: 18 May 2014 ################################################################### Here are the main changes (see UPDATES.txt for complete history, details of last 2 updates appended below): Sorry for the constant update spam. The fixes are mostly relevant for 3D retinotopy, and for better understanding of complex-valued smoothing effects. I am currently working on cross-subject permutation tests for complex-valued data. 1) Better single-subject complex statistical mask support (csurf/tksurfer/tkmedit/help). I finally got my mind clear (again) about why to avoid using the complex amplitude derived from complex-valued smoothing where a statistic has been inserted as the complex amplitude. This will reduce significance more -- because of local phase dispersion -- than will masking unthresholded complex-smoothed data with a smoothed real-valued statistic; the real-valued smoothing ignores phase (which it should). The effect is esp. bad w/3D smoothing (see tkmedit fixes below). 2) The fourier.c permutation test now generates a 3D -log10(p) _p BRIK (in addition to inserting -log10(p) into amplitude of _r,_i BRIKs) and the PAINT button auto paints and surfclust's _p, generating _q (N.B.: the surfclust uses the hard thresh in the SingleSub SurfClust PreThr F/p entry, which will need to be different for F and 'p' -- actually -log10(p)). More testing showed that most of the gains I thought were from using the permutation test were actually coming from point 1 above :-} On the positive side, the great similarity of the unsmoothed permutation test stats to our original F stats was heartening :-} 3) Help updates: Help -> Calc 3d Fourier Stats (permutation, smoothing) Help -> View Functional Data (new outfiles, F table, tksurfer -> R-clk fmid (explain per-vertex squash color scale pipeline) tksurfer -> R-clk SMOOTH (explain complex smoothing) 4) Tkmedit now has combobox dropdowns for overlay data that are auto-loaded with available stat BRIKs (and bfloats) for native and upsampled valfiles (real and complex), native and upsampled maskfiles, and ROI BRIKs. There were also bugs fixed in the native mask loading (it was loading valfile again, overlaymaskflag and double entries not set until second read). By masking with smoothed stats, there is a substantial improvement in the significance of brainstem 3D 5) Tkmedit can now 3D FILL an roi to $sfthresh if a mask is loaded. The FILL button has different behaviors depending on display state: --no overlay: 3D fill underlay within WMTRUNC limits --overlay: 3D fill real or complex amplitude above $fthresh --mask: 3D fill mask value above $sfthresh FILL also has a optional 3D radius limit, and respects any temporary cuts in underlay image to limit the fill. The ROIs can be used to mask overlays or to extract 3D timecourses. To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ### UPDATE: 18 May 2014 --tkmedit.tcl: add CLR button left of interpolLUT to clear up-sampled buffers --tkmedit.c: clear_upsamp_stat() clear any already upsamp'd (0-3) --lib/help/tkmedit/roi_fill: mask-defined ROI update --tkmedit.c: if mask loaded and in use, FILL to sfthresh instead of fthresh --tkmedit.tcl: fix_statpatt_m_if_bfloat before readnativemask --tkmedit.tcl: readnativemask: mk dbl entries, overlaymaskflag=1 before upsamp --tkmedit.tcl: block read nonconforming (not 256/512^3) as upsamp stat/mask/ROI --tkmedit.tcl: read{native,upsamp}mask: better err if select imag of cplx pair --wrappers.tcl: add shrinkcomboarrows more (for tkmedit.tcl) --tkmedit.tcl: valn/valup entry: add combobox dropdown loaded w/BRIKs,bfloat --tkmedit.tcl: mskn/mskup entry: add combobox dropdown loaded w/BRIKs,bfloat --tkmedit.tcl: roi: add combobox dropdown loaded w/BRIKs --tkmedit.tcl: fix incorrect entry read on readnativemask (was reading valfile) --lib/help/tksurfer/fmid: document basic per-vertex squash color scale pipeline --lib/help/tksurfer/smooth: general diff between complex vs. real smoothing --csurf: select_complexstatsource: catch -no_mask-, better error check/messages --csurf: fixswfileprefs: 1sub phase sig+mask: order: _f,_h,_p,_q, else no mask --csurf: paintcmd: if permtest, run surfclust on _p to get _q (re-use F parms) --csurf: select_complexstatsource ask reset Data Type cplx (callbk does cpx chk) --lib/help/csurf/setupfour: doc diff effect smoothing on perm _p vs. amp(_r,_i) --lib/help/csurf/{setupfour,setuprender}: doc _p file --csurf: getuniqcomplexstemlist: don't trim _p --csurf: paintcmd: if permtest, overwrite amp(r,i) '_f' wfile w/real _f from 3D --csurf: paintcmd: if permtest, also paint _p (fourier mks _f BRIK if permtest) --fourier.c: also output _p BRIK if permtestcnt>0 (turnoff/warn if bfloat out) --csurf: cpregcmd copies/reports/updates rounding policy --csurf: fourier always -fout: N.B.: won't match _r,_i if permute test (for cf.) --lib/help/csurf/setupfour: add help for permutation test, _f output --fourier.c: sigim[1] redefined: a=>f, -fout (def) saves F ("a" not read/output ################################################################### LATEST EMAIL UPDATE: 07 Jun 2014 ################################################################### Another minor update. See UPDATES.txt for complete history, details of last 2 updates appended below. Here are the main changes: ### 07 June 2014 1) "fsavg" checkbut, View Functional Data -> disp singlesub data on fsaverage 2) popup reports filled_{curr,orig}area for FILL/ROI/N/A/R 3) tkmedit val/mask/roi comboboxes init'd correctly w/overlay 4) FOURIER button also does 3D clust filter (3dmerge) for brainstem maps 5) better/tighter startup window positions so tkmedit display not covered To install: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ### UPDATE: 7 Jun 2014 --lib/help/csurf/setuprender --lib/help/tksurfer/restore --tksurfer.tcl: middle-click-RESTORE to re-cent surf (recalc_surface_center) --tksurfer.c: recalc_surface_center(): for new surface read in over init --csurf: View Functional Data "fsavg" chk does mri_surf2surf, load to fsaverage --lib/tcl/setdefpatchview.tcl: cortex* synonym of "full" (tksurfer.tcl already) --csurf: for fsaverage: add/rec inflatedext2=inflated_avg, load to surfacecombo --tksurfer.tcl: warn fthresh>fmid on fthresh/fmid Return w/BRy --tksurfer.tcl: popup reports filled_{curr,orig}area area for FILL/ROI/N/A/R --tksurfer.c: make filled_{orig,curr}area global for tcl export --tkmedit.tcl: wm geometry now uses exported glxwin{x,y,h,w} vs. abs nums --tkmedit.c: export glxwin{x,y,h,w} --tksurfer.tcl: wm geometry now uses exported glxwin{x,y,h,w} vs. abs nums --tksurfer.c: export glxwin{x,y,h,w} --csurf: shrinkcomboarrows, squish labels/buttons, lengthen entries => smaller --tksurfer.c/.tcl: tighten GLX/tk startup positions left/up, match new tkmedit --tkmedit.c/.tcl: GLX/tk win startup pos left so csurf panels don't fully cover --lib/help/csurf/setupfour: better 2D and 3D cluster filter documentation --csurf: fouriercmd: also run 3Dclust _f=>_h w/AFNI 3dmerge for brainstem mask --csurf: medtestrender mask checks/uses _h if found (N.B.: requires at least _f) --csurf: fourier panel: expose existing 3D Cluster vars clusterrad/clustervol --tkmedit.c,tksurfer.c,csurf: def:{s}fslope=1.5,fmid=1.1,sfmid=3,{s}fthresh=0.3 --tkmedit.tcl: combobox for LUT, load w/default lut if none found in scandir --tkmedit.tcl: set roi combo to passed-by -label (MY_AREA+orig.BRIK), see suff --tkmedit.tcl: view right end of value in valn/mskn entries (just init load) --tkmedit.tcl: set valn/valup/mskn/mskup combos to -real/-upread/-mask/-upmask ### UPDATE: 18 May 2014 --tkmedit.tcl: add CLR button left of interpolLUT to clear up-sampled buffers --tkmedit.c: clear_upsamp_stat() clear any already upsamp'd (0-3) --lib/help/tkmedit/roi_fill: mask-defined ROI update --tkmedit.c: if mask loaded and in use, FILL to sfthresh instead of fthresh --tkmedit.tcl: fix_statpatt_m_if_bfloat before readnativemask --tkmedit.tcl: readnativemask: mk dbl entries, overlaymaskflag=1 before upsamp --tkmedit.tcl: block read nonconforming (not 256/512^3) as upsamp stat/mask/ROI --tkmedit.tcl: read{native,upsamp}mask: better err if select imag of cplx pair --wrappers.tcl: add shrinkcomboarrows more (for tkmedit.tcl) --tkmedit.tcl: valn/valup entry: add combobox dropdown loaded w/BRIKs,bfloat --tkmedit.tcl: mskn/mskup entry: add combobox dropdown loaded w/BRIKs,bfloat --tkmedit.tcl: roi: add combobox dropdown loaded w/BRIKs --tkmedit.tcl: fix incorrect entry read on readnativemask (was reading valfile) --lib/help/tksurfer/fmid: document basic per-vertex squash color scale pipeline --lib/help/tksurfer/smooth: general diff between complex vs. real smoothing --csurf: select_complexstatsource: catch -no_mask-, better error check/messages --csurf: fixswfileprefs: 1sub phase sig+mask: order: _f,_h,_p,_q, else no mask --csurf: paintcmd: if permtest, run surfclust on _p to get _q (re-use F parms) --csurf: select_complexstatsource ask reset Data Type cplx (callbk does cpx chk) --lib/help/csurf/setupfour: doc diff effect smoothing on perm _p vs. amp(_r,_i) --lib/help/csurf/{setupfour,setuprender}: doc _p file --csurf: getuniqcomplexstemlist: don't trim _p --csurf: paintcmd: if permtest, overwrite amp(r,i) '_f' wfile w/real _f from 3D --csurf: paintcmd: if permtest, also paint _p (fourier mks _f BRIK if permtest) --fourier.c: also output _p BRIK if permtestcnt>0 (turnoff/warn if bfloat out) --csurf: cpregcmd copies/reports/updates rounding policy --csurf: fourier always -fout: N.B.: won't match _r,_i if permute test (for cf.) --lib/help/csurf/setupfour: add help for permutation test, _f output --fourier.c: sigim[1] redefined: a=>f, -fout (def) saves F ("a" not read/output ################################################################### LATEST EMAIL UPDATE: 06 Sep 2014 ################################################################### ### 06 Sep 2014 (compile for 64bit-only Linux, fsaverage update, bugfixes) 1) 64-bit linux compile now available 2) add Linux libjpeg62 for recent releases, fix FreeSurferEnv.sh LD path 3) fsaverage-adds.tgz: fixed inflated_avg, and new flattenings 4) make trunphaseflag/max/min work with "bi" colscale 5) calcvert can convert (all-vertex) wfiles to native floats for MATLAB 6) "locklabel" (tksurfer F3 panel): locks vertices under label during shrink 7) MGHTools -> Flatten Surface allows re-flatten already flat 8) fix tcl crash on missing braces in $paint-3D_f 'if' Probably the most useful thing is the Linux 64-bit compile. On current 64-bit installations (e.g., Ubuntu 14.04) most of the 32-bit libraries have been omitted so the previous 32-bit linux compile won't run without additional installs. Now it should just work. Tested on a bunch of 64bit installs. One case of redraw problem in tksurfer (German Ubuntu 14.04/Thinkpad) fixed by: Preferences -> unclick Double Buffer (it was still double buffered...) There are also some upgrades to the fsaverage subject (fixed inflated_avg surface, orig area files that report more accurate surface areas on FILL/ROI). The README from the new tarfile: fsaverage-add.tgz is pasted in below. To install csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz See the fsaverage-adds README for how to use/install the new files. cheers, marty [README.txt from fsaverage-adds.tgz] ################################################# 7 July 2014 -- new inflated_avg full flattenings ################################################# This tarfile contains new flattenings of the fixed fsaverage inflated_avg (fixes giant triangles at icosahedral poles), along with fixed inflated_avg area files. The inflated_avg area does not suffer from the 2/3 reduction seen in the average folded surfaces. This reduction occurs because cross-subject variation in secondary folds (crinkling in major sulci) is simplified in the folded average, which reduces cortical convolution and thus cortical surface area. Note that this area reduction is unevenly distributed; it is more profound in sulcal cortex, where 3D variability is greater. This explains why fsaverage inflated is so much smaller and differently shaped than any individual inflated surface. The fsaverage inflated_avg surface has a few gigantic triangles at the north and south poles of the icosahedral supertessellation. These have been corrected by locking all the vertices in {rh,lh}-FIX-POLES.label and allowing the two patches at the poles to relax into a uniform mesh. Once these files have been intalled, when an area if filled, the "orig surf" number in the popup report does not have to be corrected. Here is how to install the files. First move aside the existing, install the new ones, then copy new to explicitly-named for easy revert: ## mv existing aside cd $SUBJECTS_DIR/fsaverage/surf mv lh.inflate_avg lh.inflated_avgORIG mv lh.area lh.areaORIG mv rh.inflate_avg rh.inflated_avgORIG mv rh.area rh.areaORIG ## install new files cd fsaverage-adds cp surf/lh.inflated_avg $SUBJECTS_DIR/fsaverage/surf cp surf/lh.area $SUBJECTS_DIR/fsaverage/surf cp surf/lh.cortex2.patch.3d $SUBJECTS_DIR/fsaverage/surf cp surf/lh.cortex2.patch.flat $SUBJECTS_DIR/fsaverage/surf cp surf/rh.inflated_avg $SUBJECTS_DIR/fsaverage/surf cp surf/rh.area $SUBJECTS_DIR/fsaverage/surf cp surf/rh.cortex2.patch.3d $SUBJECTS_DIR/fsaverage/surf cp surf/rh.cortex2.patch.flat $SUBJECTS_DIR/fsaverage/surf cp label/rh-FIX-POLES.label $SUBJECTS_DIR/fsaverage/label cp label/lh-FIX-POLES.label $SUBJECTS_DIR/fsaverage/label ## make explicitly named for revert: cd $SUBJECTS_DIR/fsaverage/surf cp lh.inflate_avg lh.inflated_avgNEW cp lh.area lh.areaNEW cp rh.inflate_avg rh.inflated_avgNEW cp rh.area rh.areaNEW How the new flattenings were generated: (1) start with default fsaverage inflated_avg (2) make label with hole just over defects in north and south 'poles' (3) tksurfer: display label, F3 "locklabel", SHRINK 40 (4) save new inflated_avg surfaces (5) make new 'original' area files from them (6) re-cut, re-flatten them (2 flattenings each) (7) adjust flattened view settings in csurf Here are the csurf Views settings: Preferences -> Expert Preferences -> Views tab Default Viewing/Bitmap Position: FULL/CORTEX RH rotate: 96 scale: 0.95 xmov: 5.0 ymov: 2.0 LH rotate: 79 scale: 0.95 xmov: 2.0 ymov: 2.0 The View setting adjust the patches so that they roughly correspond to the orientation of a lateral view of an inflated hemisphere. The views number are saved in */$scandir/scripts/position.tcl and used every time a surface is read/displayed (or RESTORE'd), so that the surface will be presented in the same useful orientation, so that bitmaps can be directly overlapped. The relaxation cuts are not extremely deep, so the surface can't relax to its full original surface area. The curr surface area of the two flattenings are 73% of the surface area of the original cut 3d inflated_avg surface. To correct for this in a final image (e.g., to show same-scale inflated and flattened), scale up the flat bitmaps 1.17x (relative to the 1 cm scale bar on the image): 1.17 = sqrt(1/0.73) The square root is because scale factors are 1D linear, not area. ################################################################### LATEST EMAIL UPDATE: 17 Oct 2014 ################################################################### A few new features, many small bug fixes. Full details appended. First, you can now locally patch a complex surface *cut* without completely starting over, by using a label that covers the parts of the cuts you don't want. Do this by middle-clicking (instead of default left-clicking) the "label:" line "D" (=display) button (N.B. you have to make the label on an *uncut* surface :-} ). You can also kill a long running FILL with with cmd-F (i.e., shift-cmd-f). Both of these are mainly useful for revising complex flattening cuts on very large surfaces (e.g., my postmortem human cerebellum with 5M vertices). Second, there is a new, different "D" button on the "area:" line. This one is used to calculate and display local areal distortion (with the red/green curvature color scale) for any surface or patch. The distortion is the area ratio of the current local vertexwise area divided by original local area. There is now a color scale bar displayed for the red/green curvature color scale (which is used to display the area ratios). The top and bottom of the scalebar are reported and controlled by the entries on either side of the word "bar" (just above the fthresh entry), which is the same as with all the other color scales. I also rewrote nmovie from scatch because it was misbehaving on Mac (no laptop left-click drag, arrow keys not working, dirty quit) and it depended on many stale libraries. The new one should work the same as the MGH nmovie for rgb's and tiff's (MGH nmovie still included as nmovieMGH). The new one has no menu (click or space bar to start/stop, left- or right-click-drag to scroll, right-click or L/R arrows to stop/step, up/down arrows to speed up slow down). With this inspiration, I added also added similar arrows/space control (rewind, step, playback speed) to mpeg_play. Finally, I added some crude hacks for direct manipulation of surface pose in tksurfer. First, click on the surface window, then with control *and* shift depressed, you can rotate, scale, and translate with a click-drag using the left, middle, and right mouse buttons. This works best if you move in short straight strokes, releasing after each stroke (esp for rotation). I will code this more properly one rainy day (hmmm... that would be most days here). To make the frame update faster, the surface color is cached during the movement (because you can't adjust stat thresholds, etc during a movement...). As always, bug reports appreciated. ### 17 Oct 2014 (patch cuts, display areal distortion, direct manip) 1) local undo surface patch cuts using label (middle-click label "D" button) 2) new "D" button for "area:" to calc+disp curr/orig area ratio (distortion) 3) nmovie rewritten (Mac arrkeys, click-drag laptop scroll, static libtiff) 4) new scripts: inflatemovie.tcl, flattenmovie.tcl 5) direct manip/color-cache: clk surfwin, ctrl+shift + left/mid/right-clk drag To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ############## UPDATE DETAILS ############## ---------------- 17Oct2014 csurf0.8 tarballs -------------------------------- --nmovie.c/tksurfer.c/tkmedit.c/tkregister.c/mytoppm.c/sgiimagelib.c: iclose bug --tksurfer.c: set_*_color functs cache calc'd col, use if move (overlay:spd=6x) --tksurfer.c: make unselect vertex show up (was: not visible til next redraw) --tksurfer.c: block shift-left-clk show curvim (vs select!) unless curvimloaded --lib/help/csurf/tksurfer: update live rotate/zoom/translate --mk0{.csh}: add new helpfile, Hiroshi's color LUTs to $CSURF_DIR/lib/lut --lib/help/tksurfer/val_w3: new file --tksurfer.tcl: add lib dir LUTs to "lut:" dropdown --tksurfer.tcl: add w3 colscale to F3 interface, move jet up to make room --tksurfer.c: better error on read non <0-255> <0-255> <0-255> lut --tksurfer.c: mv: req ctrl-shift-R-click-drag: don't overlap ctrlscale,tcourse --tksurfer.c: Hiroshi magenta-blue-cyan-green-yellow-red mirr wheel --tksurfer.c: direct right-click-drag up/down translate up/down --tksurfer.c: direct mid-click-drag scale up/down around startclick --tksurfer.c: direct left-click-drag surface rotate (curv:OK overlay:slow) --csurf: add AFNI button to rawaverage panel --tksurfer.tcl: expose noninteccendiskflag (ecc inset) "ecp" chk F3 interface --tksurfer.tcl: expose logtransflag (for ecc inset) as "exp" chk F3 interface --tksurfer.tcl: turn curv scalebar on automatically when displaying area ratios --tksurfer.c: fix low brightness cm scale bar when not draw_colscalebar --tksurfer.tcl: cmplx/olay/fixcolscale update bar/disk butt only scalebar=OFF --tksurfer.tcl: init/change scalebar butt disk->bar if realval or no overlay --lib/help/tksurfer/fill: HOWTO/why kill fill --fourier.c: if !statssubsamp, faster clearer BRIK read (no stats,buff/unbuff) --nmovie.c: space for start/stop loop, slightly diff logic than click --mpeg_play: 'p' (or space) for play, 'l' for play+loop, better usage, defaults --mpeg_play: live adj mpeg_play frame rate with up/down arrow --movie360.tcl: run mpeg_play in background to not hang tksurfer interface --tksurfer.tcl: init/change scalebar control button "disk"=>"bar" if real-val'd --mk0{.csh}: add val_lt to mk all-in-one helpfile --lib/help/tksurfer/val_lt: better explanation of colscale12->14 --tksurfer.tcl: unset overlayflag or calc arearatios: force redo autocolorscale --tksurfer.c: display curvature color scalebar, autonorm scalebar limits --tksurfer.tcl: "D" ops reinstate curr surf area (.area) compute_normals_areas --lib/help/tksurfer/{area_disp,area_lab}: area_disp: new helpfile, revise a_lab --tksurfer.tcl: change mid-clk overload area label to mid-clk overload of "D" --lib/help/tksurfer/labelalpha: document change of "alph" to "tran" for squish --tksurfer.tcl: "area:" line "D" button disp distortion w/curr2orig arearatio --tksurfer.c: compute_curr2orig_area_ratio (write w/write_binary_areas) --lib/help/csurf/tkmedit: hotkeys update --tkmedit.c: change {cmd-}k to 1-time bigcursor, removed at next redraw --inflatemovie.tcl: add rotpump option (multiple inf/def while rotating) --nmovie.c: add -scale, -redrawframes options --tksurfer.tcl: re-expose normalize_area function on F3 interface bottom --mk0{.csh}: add flattenmovie.tcl to dist (skips missing intermediate) --lib/tcl/flattenmovie.tcl: new script to make basic flatten movie --lib/help/csurf/makenewsubj: update to reflect mostly MGH recon-all --csurf: surfaces combo also filled with inflated????, sphere???? --setdefpatchview.tcl: make "occ*" (e.g., occsm) synonym of "occip" --csurf: mghspherecmd: $bindir -> $mghbindir (never used!) --csurf: ExpertPrefs reorder mris_flatten -distance parms into cmdline order --csurf: block singlequote,redirects in runacmd cmd string, popup error --lib/help/tksurfer/label_read: document overloaded "D" button --tksurfer.tcl: overload "D" button with read_label_to_undo_cut --tksurfer.c: read_label_to_undo_cut --tksurfer.c: killfillflag for hi-res too-long-running fill --mk0{.csh}: add inflatemovie.tcl to dist --lib/tcl/inflatemovie.tcl: new script to make inf/def/inf/def movie loop --tksurfer.tcl: tcl log: "turn ON/OFF" => "turned ON/OFF" --lib/help/csurf/smoothcurvinflatesulc: fix stale other help ref --csurf: widen "custom" translate fields 2->3 (too easy to miss 100) --mk0{.csh}: compile new nmovie, mv/retain MGH version to nmovieMGH --nmovie.c: write csurf vers: static tifflib, Mac click-drag works, clean quit --mv dist/precompiled-other/lib/Darwin-x86_64/libX11.dylib back (XQuartz=vers10) --lib/help/csurf/reconall: update (bash, MPRAGE TR, back to NIFTI example --mpeg_play,mk0: mpeg_play ctrlbar.c patch for R-arrow=Step, L-arrow=Rewind --csurf: runacmd explicitly blocks/warns single quote or redirect in $command --movie360.tcl: redirect mpeg_play output to avoid write pipe error ---------------- 06Sep2014 FreeSurfer0.8/csurf0.8 tarballs ------------------- --FreeSurferEnv.sh: rm set disabling append Linux LD_LIBRARY_PATH for libjpeg62 --mv dist/precompiled/lib/Darwin-x86_64/libX11.dylib to precompiled-other (?) ... ################################################################### LATEST EMAIL UPDATE: 02 Nov 2014 ################################################################### A few new features, and more bug fixes. Full details appended. The first new thing is yet two new buttons on the "patch:" line (READ and WRITE changed to R and W to make space, and M (mask) and C (cut) added. The M and C buttons allow directly masking or cutting away parts of any current surface with the currently selected patch without having to make an intermediate label (handy for flattening large surfaces, like the cerebellum, in pieces). The second feature is a new line at the bottom of the larger [fn]-F3 tksurfer panel for performing and saving 3D fills of the currently displayed surface. The fill voxel size can be adjusted in order to generate a new coarser fill volume that can be tessellated in order to downsample a surface (tested with 5M vertex cerebellum surface). As always, bug reports appreciated. ### 02 Nov 2014 (patch mask/cut, 3D fill) 1) "M"=mask, "C"=cut buttons on "patch:" line to mod current surf w/patch 2) tksurfer (F3 panel): 3D fill surf: normmv/scale/col3d/"fat"/fill3d/writeims 3) fix tcl error tkmedit F3 manual norm panel ( in lim/ffrac entries) 4) nmovie accepts mix of tiff sizes (centers later on first) To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ############## UPDATE DETAILS ############## ---------------- 02Nov2014 csurf0.8 tarballs -------------------------------- --lib/help/csurf/csurf: update --mk0{.csh}: add new helpfiles to tksurfer help list --lib/help/tksurfer/fill3d{_mm,_normmove,_pix,_col,_fat,_op,_fillim,_saveim} --tksurfer.c: chk/block out-of-bounds vtxnum (e.g., stale patch) in 3 readpatch --tksurfer.tcl: block attempt to directly run tksurfer.tcl interface file --tksurfer.tcl: chkwritefillim: warn no fill yet, no mgz read (get header vals) --tksurfer.c: export fillimloaded, onemgzfileloaded for tksurfer.tcl checks --tksurfer.tcl: F3 3dfill interface: normmv/pix/col/"fat"/fill_surf/writeims --tksurfer.tcl: rm defunct "2d Vectors" line from F3: room for 3d fill at bot --tksurfer.tcl: read patch (select_patch) no longer does viewcuts-like 180 rot --tksurfer.tcl: RESTORE a *.patch.3d no longer rotates like a flat patch --mk0{.csh}: add lib/help/tksurfer/{patch_mask,patch_cut} --lib/help/tksurfer/{patch_mask,patch_cut}: new files --tksurfer.tcl: add "C" (cut) button for read_binary_patch_to_cut --tksurfer.c: read_binary_patch_to_cut: don't restore any, just cut away --tksurfer.tcl: "M" (mask) button for read_binary_patch_to_mask,READ,WRITE->R,W --tksurfer.c: read_binary_patch_to_mask: use patch as mask on current surface --lib/help/tsurfer/{fill,label_write,label_read2val,label_read2valcut}: updates --tksurfer.c: export fillcolor3d (def=128) --tksurfer.c: export fillpix, fix fill_surface to recenter 3D if not eq st/ps --tksurfer.c: fix norm_move_vertices arg: int -> float (accidental atoi) --tksurfer.c: add/tclexport fill_surface option: includeintersectingflag --N.B.: last fix 512 ps/st def->1, to restore prev mv aside T1 CORdir (T1.mgz) --tksurfer.c: read_image_info also look for dims/pix in T1.mgz before def=256/1 --inflatemovie.tcl: add initzrot parm, rm rot dependence between frontbak blks --tksurfer.tcl: check{read,write}labeldir ret val, warn/block label read/write --tksurfer.tcl: fix intro'd bug in checklabeldir (rename to checkwritelabeldir) --nmovie.c: display/center tiffs if diff size than first, at exit free img mem --csurf: wmfilterhirescmd: warn CORdir precedence (try 3 pairs before fail) --csurf: fillcmd/surfhirescmd: warn CORdir precedence both CORdir,mgz present --tkmedit.tcl: fix TEST1 crasher in 8 F3-interface manual norm panel entries --tksurfer.tcl: warn missing label subdir in session dir --csurf: freshen list of binaries used and/or included in top notes --csurf: mghflatten: ?h.full*.patch.* => "full", else stringent "occip" parms --no-surf-data-change movies now use one redraw followed by all redraw_cached --runra.{sh,csh.tcl}: report name of subject (prompt/log) also when finished --mpeg_play (gdith.c): spacebar/p also stop (was just start) --tksurfer.c: linrampphase2vtxcol also caches color --tksurfer.c: minimum direct manip scale size 5% of original ---------------- 17Oct2014 csurf0.8 tarballs -------------------------------- --nmovie.c/tksurfer.c/tkmedit.c/tkregister.c/mytoppm.c/sgiimagelib.c: iclose bug --tksurfer.c: set_*_color functs cache calc'd col, use if move (overlay:spd=6x) --tksurfer.c: make unselect vertex show up (was: not visible til next redraw) --tksurfer.c: block shift-left-clk show curvim (vs select!) unless curvimloaded --lib/help/csurf/tksurfer: update live rotate/zoom/translate --mk0{.csh}: add new helpfile, Hiroshi's color LUTs to $CSURF_DIR/lib/lut ... ################################################################### LATEST EMAIL UPDATE: 07 Dec 2014 ################################################################### Small improvements, bug fixes, documentation updates, and a note on Mac OS X 10.10. Full details appended. First, movie-making script were expanded and documented, which include phasemovie, offsetmovie, movie360 (fix introduced bug), inflatemovie, and flattenmovie. Second, tcl/tk was updated to the latest 8.5 release (8.5.17). Third, I fixed stale 'ps' options that were causing a csurf startup crash on recent Ubuntu. Fourth, MGH .mgz files can now be used in the Import Extern Stats panel as stats overlays (e.g., for qT1 overlays). Finally, I figured out how to block AFNI version checks, because when the AFNI website is down, continual attempts by to3d and afni to call home in the background will block return from tcl command. I tested csurf on Mac OS X 10.10 (Yosemite) and found that everything works. However, while OpenGL graphics performance is fine, tk widget drawing speed is inexplicably quite a bit slower on some machines (e.g., Mac Pro). Compiling on 10.10 instead of 10.6 works, but doesn't help. I have filed a bug report with Apple and am working with the XQuartz maintainer Jeremy Huddleston to try to fix this. Nothing breaks; it's just irritating. As always, bug reports appreciated. ### 07 Dec 2014 (movies, small bugfix/updates, doc updates) 1) expand, document movie scripts (phase/offset/movie360/inflate/flatten) 2) update to tcl/tk 8.5.17 3) fixed recent Ubuntu csurf startup crash 4) Import Extern Stats can use .mgz stats file 5) AFNI version checking blocked (in case AFNI website down) 6) runs on Mac OS X 10.10 (tk is slow on some machines) To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ############## UPDATE DETAILS ############## ---------------- 07Dec2014 FreeSurfer0.8/csurf0.8 tarballs ------------------- --update to tcl/tk 8.5.17 --lib/help/tksurfer/script: document all 5 standard tcl scripts --offsetmovie.tcl: update to be parallel phasemovie.tcl --phasemovie.tcl: options: immed make mpg1 *or* dump simple num'd frames for QT --lib/help/csurf/{tksurfer,tkmedit}: calcimg help for MGH read non-0 workaround --calcimg.c: change pixsize=0 from error to report if option is -spacing --movie360.tcl: fix intro'd bug (drawnflag missing '$'), allow/note save tiffs --tksurfer.tcl: warn truncphasemin > truncphasemax: in entries & tick->ON --lib/help/tksurfer/truncphase -- N.B.: warn truncphasemin,max *don't* wrap --csurf: VOLUME-STATS doesn't replace 3D _f with _h if StatMask Paintfile is _f --csurf: fix 3 stale 'ps' options for Linux (fix csurf startup crash Ubuntu!) --csurf: prefix all afni cmds with: env AFNI_VERSION_CHECK=NO ... --ima2brik: setenv AFNI_VERSION_CHECK NO, else to3d hangs if AFNI server down --csurf: if MGHTools enabled, rm back compat from MGHTools and Help menus --lib/help/csurf/{smoothcurvinflatesulchires,flattensurface,compat,handnormaliz} --lib/help/csurf/{mkfinalsurfshires,mkfinalsurfs,makerelaxationcuts} --lib/help/tksurfer/{val_bi,truncphase,truncphasemin,truncphasemax} -- R/G rev! --lib/help/tksurfer/label_read: better description HOWTO fix cut w/label --csurf: readheader: read/correct actual mgz pixsize/thick (was default to 1.0) --csurf: paintcmd: rm infixlist1,2 junk, allow ExtStats read mgz special case --csurf: new functscanlists(def,statformat) mgzsingle, cbx:select_statimage sets --csurf: mghflattencmd now recognizes full*.patch* input patch as a "full" --csurf: also load inflated combo w/sphere.reg???? steps --csurf: when flatten done, reset patch combo to outp if there (was reset->1st) --csurf: debug/fix put new session inside existing subject --tksurfer.c: don't also clear all vertex marks if direct manip translate --tkregister.tcl,tkmedit.tcl,tkstrip.tcl: block attempt to run directly --tksurfer.tcl: select_patch leaves curr pose if patchname same except stepnum --csurf: trim running progress wintitle so end of long patch name not truncated --tksurfer.c: export rightclick_vertex, add float cmp_ for qsort TODO --lib/help/csurf/csurf: hi-res offscreen render tcl script example (also:rgb) --tksurfer.tcl: select_patch leaves current pose if prev surface was 3D --tksurfer.tcl: warn .origarea redefined upon "R" on "area:" line --lib/help/tksurfer/area_{read,write}: explain read/write data-field asymmetry --tksurfer.c: write_binary_areas: rm confusing commit (cp curr area->origarea) --tksurfer.c: rm old div-by-2 from normalize_area report (no effect on funct) ---------------- 02Nov2014 csurf0.8 tarballs -------------------------------- --lib/help/csurf/csurf: update --mk0{.csh}: add new helpfiles to tksurfer help list --lib/help/tksurfer/fill3d{_mm,_normmove,_pix,_col,_fat,_op,_fillim,_saveim} --tksurfer.c: chk/block out-of-bounds vtxnum (e.g., stale patch) in 3 readpatch ... ################################################################### LATEST EMAIL UPDATE: 20 Feb 2015 ################################################################### A few new functions, interface improvements, better docs, bug fixes. See below for details. Direct manipulation of the surface now only requires Shift plus click-{left,middle,right}-drag -- it used to require Shift+Ctrl+clickdrag When making an average surface from a set of subjects with AVGSURF button on the spherical cross subject average panel, there is now an auto-fix for the giant triangles that appear at the north and south poles of inflated_avg. Still working on slow X11 performance on Mac OS X 10.10 (Yosemite). OpenGL (surface display) is fine. It's just the stupid interface buttons that got slow. There is a new function to more conveniently combine multiple labels into one (see R-click help for the "C" button on the "label:" line), and the label dropdown finally reloads itself when new labels are added. ### 20 Feb 2015 (easier direct manip, AVGSURF, combine labels, docs) 1) direct surface manip now only req's Shift-{L/M/R}-click-drag (was +ctrl) 2) auto-fix giant triangles AVGSURF inflated_avg poles (make_average_surface) 3) new combine labels function: see "C" button R-click help on "label:" line 4) update docs 5) Mac: XQuartz (X11 lib v10.0) now required (better stability) To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ############################## Latest addition to UPDATES.txt ############################## ---------------- 20Feb2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: shift-mid-click on "w1" -> switch to "w3" without needing fn-F3 --csurf: allow config/save 'w2' RGBY wheel colscale View Functional Data panel --tksurfer.tcl: label combo listcmd live re-read labeldir (man reabbrev sm log) --tksurfer.tcl: clear rgb combo on listcmd live re-read rgbdir (was appending!) --lib/help/tksurfer => trim dashed lines that overflow in Linux help: label_readcut, val_w1, val_clear, swapstatval, restore label_write, label_stat, label_read2val, label_read label_clear, label,cuts, area_read, area_disp, angle_offset --lib/help/tkmedit/imim2op -> trim dashed lines that overflow in Linux help --lib/help/csurf => trim dashed lines that overflow in Linux help --lib/help/tksurfer/label_readcut: update --tksurfer.tcl: read_label_cut_clearvals 2 bound to label line Shift-Middle-C --tksurfer.c: read_label_cut_clearvals <2=add>: add label to existing cut label --tksurfer.c: clr/unmark: selected=-1 (dbl but not sglbuff was hiding drawcurs) --lib/help/tksurfer/{val3d_clust,val_w1}: update doc --tksurfer.tcl: warn/advise empty .stat on CLU after just read real-valued --tksurfer.tcl: middle-click on "w1" -> switches to "w2" without needing fn-F3 --csurf: reinstate a chunk of code in concat stim file accidentally deleted --tksurfer.c: locklabelflag also blocks curv/val smoothing under label --tksurfer.tcl: logcmd locklabel (accidental omission) --tksurfer.c: fix shrink-no-display crash: wrap XPending w/if(openglwindowflag) --lib/help/csurf/setupsphavg: updated for inflated_avg pole fix --csurf: AVGSURF button now auto-fixes giant triangles in poles of inflated_avg --csurf: catch grep -c csurf to make csurf source'able again from wish8.5 prompt --fix path typos in NOTES.txt doc about how to install fsaverage-adds.tgz --N.B.: v9->v10 change can cause csurf crash on system w/mixed v9/v10 paths --change Mac X11 compile to req XQuartz libX11.6.dylib vers10.0 (prev only Tix!) --lib/help/tksurfer/{label_timecourses,xtrans,ytrans,restore}: update doc --lib/help/csurf/tksurfer: update doc --tksurfer.c: remap GL shift-R-click => ctrl-mid-click, directmanip => justshift --csurf: if empty surfext, surf-missing popup notes opposite hemi surfs there --lib/help/tksurfer/script: clean up doc typos/duplications --calcvert.c: warn -padvalfile assumes oldcurv, warn >250K vtx, suggest meant nc --calcvert.c: 04d: allow {swap}floatin -> all-vertices ascii ---------------- 07Dec2014 FreeSurfer0.8/csurf0.8 tarballs ------------------- --update to tcl/tk 8.5.17 --lib/help/tksurfer/script: document all 5 standard tcl scripts --offsetmovie.tcl: update to be parallel phasemovie.tcl --phasemovie.tcl: options: immed make mpg1 *or* dump simple num'd frames for QT ... ################################################################### LATEST EMAIL UPDATE: 06 Mar 2015 ################################################################### A few new functions, interface improvements, docs, bug fixes. See UPDATES.txt excerpt below for details. ASCII surfaces Reading and writing of ASCII surfaces (e.g., ASCII GIFTI export) is minimally supported. The expected ASCII file format is: ASCII Triangle Surface File Format (ASCII): -------------- header --------------------- #!ascii ... [triangles] ... vertexcount facecount ---------- vertex positions --------------- [vertex triples are implicitly numbered] x y z x y z ... [x,y,z triples up to vertex count] ---- vertex numbers around each face ------ [faces are implicitly numbered] corner1 corner2 corner3 corner1 corner2 corner3 ... [triples up to face count] ------------------------------------------- Reading MGH annotation files (*.annot) The "label:" line "D" button now reads MGH annotation files. These combine a vertexwise color overlay with a color-to-brain-structure lookup table that MGH freesurfer characteristically uses in reverse -- that is, for a given unique color at a vertex, look up the structure name and ID number. These multi-labels can now be used to extract surface data (real or complex) for one of the labels inside it as follows: 1) load vertex data of interest to .val(.val2) 2) select MGH annotation file in "label:" dropdown 3) left-click the "D" (label display) button 4) click vertex in colored label to load r,g,b color 5) reset name in "label:" entry to output label file 6) Shift-left-click-"W" Once an annotation is loaded, the csurf log will report the brain structure of each vertex. The transparency of the MGH labels can be controlled with "tran" at upper left. Morph target In recon-all, buckner40 is the default spherical morph target. For hand reconstructed surfaces (e.g., hi-res) the MGHTools -> Register Surface now defaults to buckner40 (there was a bug preventing its use, now fixed; can select old FreeSurfer0.8 target instead in Expert Preferences -> SphereReg). F5 tkmedit interface For editing large complex surfaces (think cerebellum) it helps to have a tkmedit interface that doesn't take up much screen space. [fn]-F5 makes tkmedit have a long thin horizontal interface useful for this purpose. ### 06 Mar 2015 (read/write ASCII surf, disp/use MGH annotation) 1) read/write GIFTI ASCII surface (e.g., export from MIPAV) 2) display MGH annotation file, can use to extract labelwise surfdata 3) MGHTools->RegisterSurf default morph target now buckner40 (recon-all) 4) longthin F5 tkmedit interface + many sm interface, R-click-help updates ################################################################### To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 06Mar2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --lib/help/tksurfer/{label,label_read,label_readcut,label_clear,label_write} --lib/help/tksurfer/{meshr,meshg,meshb,smooth_steps,cuts} --tksurfer.tcl: label buttons chk suff, then setfile, check{read,write}labeldir --tksurfer.tcl: shift-left-"W" overload to get: write_val_annotedcol_vertices --tksurfer.c: recog subj root if cmdline started in label dir, better indents --wrappers.tcl: use join to flatten list of args passed by testreplace --tksurfer.c: write_val_annoted{col}_vertices write complex if complexvalflag --tksurfer.c: write_annoted_vertices renamed to write_val_annoted_vertices --tksurfer.c: clear_annot also clears/frees brainregions --tksurfer.c: if MGH annot loaded, update r/g/b entries with current annot col --tksurfer.tcl: add $anlabel to setfile list (rm unused $annot) --tksurfer.tcl: labelentry/D now also load/use .annot files as well as .label --tksurfer.c: write_val_annotedcol_vertices: dump out vtx data from 1 MGH annot --tksurfer.c: click prints annotname by rev lookup annot color in MGH 'LUT' --tksurfer.c: read_mgh_annot: read MGH .annot to brainregion struct, load color --tkmedit.tcl dup "surf" tick F5 panel (N.B.: must load surf before goto F5) --tksurfer.tcl: scroll entry to useful end of filename after select val/val3d --tksurfer.c: fix funct name: rightclick_vertex -> middleclick_vertex (!) --lib/help/tksurfer/{label,val3d_read,val3d_clust}: update --tksurfer.tcl: add copy of S/V button to val3d for read/paint/swap 3d stats --tkregister.tcl: bigger Linux putbelowtkwin gap startup interface size change --tkregister.c: add 10 to Linux TKGL_YGAP avoid Ubuntu startup overlap problem --tksurfer.tcl: val3d: warn/fix colscale mismatch, help (PNT to see, samp ctrls) --lib/help/csurf/tkmedit: document F5 interface, rm stale cmdline example --tkmedit.tcl: add long/thin fn-F5 micro interface --lib/help/tksurfer/isocont: thicken isocont hot key --lib/help/tksurfer/val_ltw: new file (update help list in mk0) --lib/help/tksurfer/val2rgb: update complex phase vs. amp color LUT --lib/help/tksurfer/val_jt: emphasize jet scale limits set by truncphase --tksurfer.c: rm JET colscale return/cache so parallel to other colscale cases --tksurfer.c: make read_ascii_surface tcl synonym for read_binary_surface --csurf: change def morphtarg to buckner40 (MGHTools->Reg) to match recon-all --csurf: load surf combo with orig? for import hacking (was orig,orig1,orig2) --tksurfer.tcl: add "R" button on F3 "insurf:" for consistency --copy surface format specs from lib/help/csurf/csurf to lib/help/tksurfer/surf --lib/help/csurf/csurf: document ASCII surface format --lib/help/tksurfer/{surf,hemisurf}: cleanup after interface code untangle --tksurfer.tcl: allow full path in F2 "surf:" surface extension entry --tksurfer.tcl: fix/rename/untangle select_surfext from fullpath F3 entry --tksurfer.c: read_binary_surface detects/accepts #!ascii tri/quad/quad2tri --csurf: fix inflate's'cycles typo blocking non-hi-res smooth/inflate --mk0: add outsurfasc_write helpfile to list --lib/help/tksurfer/outsurfasc_write: new helpfile --tksurfer.tcl: add W-ASCII button on F3 interface for write_ascii_surface --tksurfer.c: write_ascii_surface (tri or quad depending on ExpertPref flags) --tkmedit.c: rm Tcl_Eval sendupdate (was no longer defined in tkmedit.tcl!) --tksurfer.c: flush remaining queued click-drag xforms by lookahead to up-click --tksurfer.tcl: expose phase LUT (lutw) in fn-F3 --tksurfer.c: glFlush in openglx to start w/black window (2x glFinish ignored) ---------------- 20Feb2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: shift-mid-click on "w1" -> switch to "w3" without needing fn-F3 --csurf: allow config/save 'w2' RGBY wheel colscale View Functional Data panel --tksurfer.tcl: label combo listcmd live reread labeldir (man reabbrev->sm log) --tksurfer.tcl: clear rgb combo on listcmd live re-read rgbdir (was appending!) ... ... ################################################################### LATEST EMAIL UPDATE: 22 Mar 2015 ################################################################### Some new functions, interface/doc improvements, bug fixes. See UPDATES.txt excerpt below for details. Pearson Correlation Searchlight A new button ("X" on the "label:" line) performs a Pearson product-moment correlation between two loaded data sets over a set of local surface-based 'searchlights' specified by a label or annotation color. For each vertex, a correlation is done in a 'searchlight' defined as a set of nearest vertices to each vertex in a label. The size of the searchlights can be controlled by vertex count (num), area (mm^2), or radius (mm). The vertex-wise result is put into the .stat field and displayed when done. The data to be compared can be real or complex. In the complex case, the amplitude is used (circ correlation for phase coming next update -- UPDATE 24 Mar: now included in back-dated 22 Mar tarfiles). The region over which to calculate spotlights can be specified by a regular label or by a single color in a loaded MGH annotation file. Here is an example of how to get a searchlight correlation between a real data set and the amplitude of a complex data set using a regular label to define the searchlight centers: 1) load 2nd (real) data set ("R" on "val:" line) 2) shift-middle-click "S/V" => swap to bottom of stack 3) load 1st (complex) data set ("R" on "val:" line) 4) select labelfile from "label:" dropdown 5) click "X" on "label:" line: 6) set parameters in popup: fillneartype -> 2 (radius) num_sqmm_mm -> 7.0 (mm) cmptype -> 1 (compare complex-amp to real) click "Ready" 7) view output (auto changes colscale to real) Use MGH annotation to extract stats/timecourese from 3D files The previous update allowed reading MGH annotation files and using them to extract surface data to a label. The current update extends this to extracting stats and raw timecourses from 3D data (more functions added to "T" and "S" buttons). Previously, extraction from 3D files required a label. An example is: 1) load vertex data (to decide which 3D data to extract) 2) select MGH annotation file in "label:" dropdown 3) left-click the "D" (label display) button 4) click vertex in colored region to pick it (load r,g,b col) 5) middle-click "T" or "S" buttons to extract data to ASCII files Display SamSrf (pRF) data analysis in csurf Sam Schwarzkopf released a MATLAB toolbox to calculate and display population receptive field (pRF) analysis using freesurfer surfaces here: http://figshare.com/articles/SamSrf_toolbox_for_pRF_mapping/1344765 The results are saved in ASCII label files in a "prf" subdir of a freesurfer subject. These are now loaded (along with other subjects and sessions labels) as a group at the bottom of the tksurfer "label:" dropdown. Sam's labels have an underscore (e.g., 'rh_') after the hemisphere (instead of a 'rh.' for an MGH label, and a 'rh-' for a csurf label). If the label is part of a complex-valued pair such as: ~/prf/rh_pRF_sf_pol_r.label ~/prf/rh_pRF_sf_pol_r.label or ~/prf/lh_pRF_sf_ecc_r.label ~/prf/lh_pRF_sf_ecc_r.label reading the data from either one using "R" on the "label:" line will automatically load the other (and auto-reset color scale settings appropriately). Note that csurf labels ('rh-' prefix), by contrast, usu. store real and imaginary values in a single label file (6 entries per line instead of 5). Small updates Can display just borders of MGH annotation or single labels (shift-middle-click the check to the left of "label:"). When RECON-ALL is purple/running, it now properly kills a partially done reconstruction. There is a new pfbrik script to conveniently run the Gaussian plane filter on an AFNI BRIK. On Mac, TextEdit will be used as an editor (best with X11 *not* in fullscreen) as opposed to Paleolithic xedit. ### 22 Mar 2015 (corr searchlight, data extract w/MGH annot, read SamSrf #1) "X" butt: Pearson corr 2 datasets (searchlight every vtx label/annotcol) 1) "X": Pearson or CircCorr 2 datasets (searchlight every vtx label/annotcol) 2) extract stats/3D-timecourses from one or all MGH annotation labels 3) read/display output of SamSrf pRF retinotopic map analysis 4) RECON-ALL panel: fix purple kill, accept BRIK input (auto to NIFTI) 5) can display just borders of MGH annotation or single labels ################################################################### To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 22Mar2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: rm corr parms from label popup, add setup prepopup to "X" butt --tksurfer.tcl: confirm 3 kinds of swap with a diagram of stack --tksurfer.tcl: swap/show corr, reset col when done w/corr_over_label/annotcol --tksurfer.c: do GLX window events during corr_over_label, find_retin_borders --tksurfer.tcl: overload "X" button: middle-click does corr_over_annotcol --tksurfer.c: corr_over_annotcol (wrapper, like annotcol stats/timecourses) --csurf: Preferences -> Bigger Logs: 18 lines each vs. 7 lines each --wrappers.tcl: change def helpwin (tksurfer/tkmedit popups) rows 11 -> 18 --lib/help/tksurfer/label_stat,label_timecourses,nocut,swapstatval: updates --lib/help/tksurfer/label: document SamSrf labels --tksurfer.tcl: label: "R" auto-reads pair of SamSrf labels given either one --tksurfer.tcl: label: dropdown loads SamSrf ${hemi}_pRF_sf_{pol,ecc}_r.label --tksurfer.tcl: also load SamSrf labels like: ${hemi}_pRF_sf_pol_r.label --tksurfer.tcl: if Mac, look for TextEdit (N.B.: not good for fullscreen) --tksurfer.c: corr_over_label cmdline help (shell and tcl interp) --tksurfer.tcl: bad fill/cmp type error/help for docorr (before log errors) --tksurfer.tcl: bind mid-click nearestbuttons to set fillneartype (L-click too) --tksurfer.tcl: fillneartype, cmptype state now maintained by interface --mk{.csh}: add new helpfile --lib/help/tksurfer/label_corr: new helpfile --lib/help/tksurfer/swapstatval: update explain new/revised bindings --tksurfer.tcl: add "X" button to label line to run corr_over_label --tksurfer.tcl: swap_val_val2=>mid-S/V, swap_valval2_valbakvalbak2=>shift-mid --tksurfer.c: read_label_to_val sets valloadedflag --tksurfer.c: corr_over_label: searchlight correlation (real/cplx to real/cplx) --update mk0{.csh} to including pfbrik --bin/noarch/pfbrik: new csh script to run tkmedit gauss planefilter on BRIK --cor2brik.c: fix out HEAD ORIGIN(-128,128,128),DELTA(1,-1,-1): correct reexport --csurf: fix kill RECON-ALL purple: hand-kill recon-all+tee, rm IsRunning file --csurf: recon-all panel: fix return to same dir for second+ input files --lib/help/csurf/reconall: document BRIK allowed --csurf: ask to auto-convert AFNI BRIKs provided by FIND to recon-all panel --lib/help/tksurfer/{label_timecourses,label_stats}: document the 9 functions --tksurfer.tcl: bind 9 cases to buttons: "T" (3 cases) and "S" (6 cases)... --tksurfer.tcl: add arg/errchk tcl funct getstattseries label/annotrgb/annotall --tksurfer.tcl: add arg/errchk tcl funct getstat for label/annotrgb/annoall --tksurfer.tcl: add arg/errchk tcl funct gettseries for label/annotrgb/annotall --tksurfer.tcl: expand S/T to 9 cases: time/stat/both by label/annotrgb/annotall --tksurfer.c: write_annotcols_timecourses_stats (same: all regions curr annot) --tksurfer.c: write_annotcol_timecourses_stats (tmpfile->write_label_timecrs..) --lib/help/csurf/tksurfer: fix direct manip mouse doc --tksurfer.c: swap Shift-mid/right click to trans/scale to be same as Freeview --tkmedit.tcl: context-sensitive F5 help if surface not loaded --tksurfer.c: set_annot_alpha forces alpha "{U,u}nknown" region to transparent --lib/help/tksurfer/label_toggle --tksurfer.tcl: shift-middle-click label tick toggles annotbordflag --tksurfer.c: read_label_to_annot_using_col also finds borders for single label --tksurfer.c: read_mgh_annot finds borders of labels, annotbordflag toggles vis --tksurfer.c: MESH r,g,b reports clicked color of single labels, too ---------------- 06Mar2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --lib/help/tksurfer/{label,label_read,label_readcut,label_clear,label_write} --lib/help/tksurfer/{meshr,meshg,meshb,smooth_steps,cuts} --tksurfer.tcl: label buttons chk suff, then setfile, check{read,write}labeldir ... ################################################################### LATEST EMAIL UPDATE: 10 Apr 2015 ################################################################### The new things are, find geodesic paths, display gradients of various kinds, and bugfixes. Full details in UPDATES.txt. Geodesic Paths/Labels A new button ("Dijk" just to the right of "DIST" in the TRANSLATE panel) calculates an approximate geodesic path between the last two clicked points and displays it on the current surface (folded, inflated, flat). It does this by tracing geodesics on smoothwm (not the current surface). The path is found using a Dijkstra algorithm by the MGH freesurfer binary, mris_pmake, by Rudolph Pienaar (this requires you have installed FreeSurfer 5.3 and have defined the FSURF_DIR environment variable). The path follows the edges of triangular faces and is therefore very slightly longer than a geodesic path. When finished (about 5 sec for any length path), the path is displayed in yellow, using the label generated by mris_pmake. The path can be used to make quantitative linear measurements on cortical areas. The displayed path/label can be used to define the edge of another label since FILL and ROI respect displayed labels. The label can also be used to extract a straight line of data. Per-vertex Calculation/Display of Gradients in Curv/Val/Phase Gradient arrow fields can now be calculated and displayed for several kinds of data. There is a new "GR" button at the end of the fieldsign ("fs:") line. After loading a flat patch, a default left click on "GR" calculates and displays the gradient of curv (or sulc). You will have to zoom in to make out the per-vertex arrows. The gradient vectors can be normalized with the new unlabeled tick at the bottom of the phasecontour box (just to the left of "fmid:"). The length of the vectors (normalized or unnormalized) can be adjusted with the unlabeled entry immediately to the right of that tick box. A middle-click on the "GR" button instead calculates the gradient of the current data (real) in the .val field. Finally, a shift-middle-click calculates the gradient of the complex phase (in this case, finite differences are calculated with circular subtraction). In general, the gradients are calculated and stored in the bottom of the complex stack in valbak/val2bak, and $gradvecbakflag is autoset to display them. Displaying your own gradient/arrow/2d-directional data 1) put x,y vectors into complex label (6 entries per line) 2) read with "R" on "label:" line (goes to va/val2 fields) 3) shift-middle-click "S/V" => swap to complex stack bottom 4) load surface data over which arrows will be displayed 5) shift-middle-click this checkbox to show arrows Note that the arrows will rotate with the patch. With patch rotation set to 0.0 in (Preferences -> Expert Preferences -> Views), the positive x direction will be *down* and the positive x direction will be *left*. Displaying Two Phase Gradients Simultaneously The two gradients used to calculate visual (or other) fieldsign can be displayed interactively along with fieldsign using the "F" button. The procedure for visual fieldsign is: 1) load/smooth 1st (e.g., polar) data set 2) shift-middle-click "S/V" => swap it to stack bottom 3) load/smooth 2nd (e.g., eccen) data set 4) click "F" button See the right click help for the "F" button for details. Displaying Phase as Vector Relative to Window Frame To directly visualize the polar angle normally only represented by color, a vector can be draw at each vertex *relative to the display window* to indicate the local polar angle. Unlike the gradient vectors, these vectors are not 'stuck' to the flat surface and *don't* rotate (at a particular vertex) when the surface is rotated. They *do* rotate when revphaseflag or angle_offset are adjusted. To try out this experimental display, load a polar angle data set from the right hemisphere and do a shift-middle-click on the unmarked tick box just to the left of "fs:" (see R-click help for the tick box for details). Small updates New tcl function, print_selected_list, dumps the current list of selected vertices to an ASCII file. The area ratio button ("D" button on the "area:" line) now by default shows *log* area ratio. The automatic startup of TextEdit on Mac for editing tcl scripts (incl. file doesn't exist yet) or NOTES files is fixed on 10.9 and 10.10. On Mac, TextEdit will be used as an editor (best when X11 is not in fullscreen) as opposed to Paleolithic xedit. The read_fieldsign function can now autodetect and read fieldsign and fieldsign mask in the form standard curvature format files. ### 10 Apr 2015 (geodesics, gradients) 1) calculate geodesic path on surface, show as label 2) calculate/display gradients of curvature, val, or phase 3) display two gradients (fieldsign calculation) ################################################################### To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 10Apr2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: overload unlab'd arrownormflag check w/toggle angoffrevarrflag --tksurfer.tcl: editfile: 'open -e', touch to mk new file, OK on OSX 10.10 --tksurfer.tcl: toggle arrownormflag resets arrowscale (ON=>0.5mm, OFF=>5) --tksurfer.c: fix compute_gradient on phase (save gradients til loop done) --tksurfer.c: correctly track compute_angles r,i=>th,r thru swaps,push,readnew --lib/help/tksurfer/comp_fs: document confusing polar angle grad directions --tksurfer.c: read_{fieldsign,fsmask} now autodetects, correctly reads curvfmt --mk0{.csh}: new helpfiles: arrownorm,arrowscale --lib/help/tksurfer/{arrownorm,arrowscale}: new helpfiles --tksurfer.tcl: arrownormflag/arrowscale unlabeled chk/entry under phasecont --tksurfer.c: adjust grad vec colors if fieldsign so both visible over it --tksurfer.tcl: "F" button to run fieldsign, optionally display 2 gradients --tksurfer.c: filter/zero gradient outliers to zero -> dark red arrowheads --tksurfer.c: finally made *seriously confusing* angoffrevarrflag hack work! --tksurfer.c: angoffrevarrflag: angle_offset/revphaseflag ctrl win-rel arrows --tksurfer.tcl: tick gradvec{bak}flag only resets parms if other not ON --tksurfer.c: arrownormflag: ignore amplitude, arrowscale sets length in mm --tksurfer.tcl: overload nonbinaryfs tick w/toggle gradvecflag,gradvecbakflag --tksurfer.tcl: "GR" button to run compute_gradient --tksurfer.tcl: squish entry, "sl:" to nothing, to mk space for "F"/"GR" butts --tksurfer.tcl: squish "sl:" to nothing to make space for "F" and "GR" buttons --mk0{.csh}: new helpfiles: comp_fs,comp_grad --lib/help/tksurfer/nonbinaryfs: update for toggle gradvec{bak}flags overload --lib/help/tksurfer/{comp_fs,comp_grad}: new helpfiles --tksurfer.c: fsdata2gradsflag: compute_fieldsign converts data to gradients --tksurfer.c: compute_gradient: arg=2=phase (circsubtract) -> valbak,val2bak --tksurfer.c: draw_cursor norm/big: don't draw select edges to ripped vertices --tksurfer.c: add adjustable gradient arrowheads, add/export arrowscale --tksurfer.c: block compute_{fieldsign,gradient} on non-flat surface --tksurfer.c: add/export compute_gradient(0=curv,1=val) -> valbak,val2bak --mk0{.csh}: add new helpfile: djik --lib/help/tksurfer/dijk: new helpfile --tksurfer.tcl: Dijk: warn/use $hemi.curv if $hemi.smoothwm.H.curv not found --tksurfer.tcl: "Dijk" butt measure/disp ~geodesic path between last 2 selected --tksurfer.c: add/export print_selected_list(): scripts/CurrVtxList.txt else log --tksurfer.tcl: select_curv rec $hemi.area.logarat, fix R/G colscale resets --bin/noarch/mri2mpgs: fix AFNI bg, recursive subdirs problem --lib/help/csurf/tksurfer: doc "area:" line "D" button, "label:" line "X" butt --lib/help/tksurfer/area_disp: explain new function and revised "D" bindings --tksurfer.tcl: rebind area "D": left=>logarat,mid=>arat,shift-mid=>pial/white --tksurfer.tcl: calcdisp_curr2orig_logarat: use compute_logarea --tksurfer.c: add/export compute_logarea() --lib/help/tksurfer/label_corr: clarifications ---------------- 22Mar2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: rm corr parms from label popup, add setup prepopup to "X" butt --tksurfer.tcl: confirm 3 kinds of swap with a diagram of stack --tksurfer.tcl: swap/show corr, reset col when done w/corr_over_label/annotcol --tksurfer.c: do GLX window events during corr_over_label, find_retin_borders --tksurfer.tcl: overload "X" button: middle-click does corr_over_annotcol --tksurfer.c: corr_over_annotcol (wrapper, like annotcol stats/timecourses) --csurf: Preferences -> Bigger Logs: 18 lines each vs. 7 lines each ... ################################################################### LATEST EMAIL UPDATE: 02 May 2015 ################################################################### The main new things are, fast Yosemite display, CARET "videen-style" color scale, remember colscales when swapping data sets, display gradient amplitude as color, and bugfixes. Hack Fix for Slow Interface on Mac OS X 10.01 (Yosemite) The drawing speed of the tk interfaces (e.g., csurf panels, tksurfer) slowed to a crawl on Mac OS X 10.10 (Yosemite). This is likely due to a bad interaction between XQuartz/tk with the new "App Nap" power-saving priority 'feature'. Until XQuartz and the tk guys fix this, I found an ugly but effective fix: put up a temporary xterm in front of the interface window when it is being drawn. This speeds up the drawing of the interface roughly by a factor of 100 :-} which makes using csurf on Yosemite bearable. CARET "videen-style" Color Scale This is the spectral-like CARET color scale used in the Glasser and Van Essen papers (and many other CARET maps). It is available either by: 1) middle-click the "BR" coloscale (vs. left click) 2) left-click the "Bg:" label to get a full colscale pop-up 3) F3 big panel ("vd") Remember color scales If you have two data sets loaded (e.g., via the S/V button, which can swap stat and val, or real and imaginary, or a pair of real and imaginary data sets), the color scale that you set on each of the data sets will be remembered if you swap back and forth. A pale imitation of MGH tksurfer's more general facility (but 2 is better than 1!). Display gradient amplitude as colorscale After a gradient (of curvature, val, or phase) has been calculated, instead of displaying it as arrows, you can display its amplitude as a color scale. See R-click help to "GR" button for details. Small things A lot of small updates to the documentation. ### 02 May 2015 (hack for Yosemite, CARET videen-style colscale) 1) hack to make csurf/tksurfer work reasonably on MacOSX 10.10 Yosemite 2) CARET "videen-style" colscale=17 (L-click-"Bg", F3, or mid-click BR) 3) S/V swapping between data sets saves/swaps color scale settings 4) can display gradient amplitude as color map (vs. arrows: R-click help GR) ################################################################### To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 02May2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --csurf: Fourier panel PAINT skips surfclust if cluster area is zero --tksurfer.c: multitimecourseflag restore orig overlay behavio, tcl script only --lib/help/csurf/tksurfer: improve GL/tk win overloaded clicks docs --tksurfer.c: popup at init rawdata load 1 timecourse, skip show orig/samp surf --lib/help/tksurfer/{val_jt,val_vd}: doc fixed controls --tksurfer.c: fix videen-style fthresh trunc, disable videen fmid/fslope --tksurfer.tcl: L-click "Bg" gives popup w/verbose radio labels all colscales --tksurfer.tcl: fmid/fthresh/truncphase{min,max} presets on click "jt", "vd" --tksurfer.tcl: warn/explain panel for display gradient ampl as shading --tkmedit.tcl: update to new trace syntax --tkregister.tcl: update to new trace syntax --tksurfer.tcl: update to new trace syntax --csurf: add "vd" CARET VanEssen "videen-style" to View Funct Data colscales --lib/help/tksurfer/{val_w1,val_BRy,val_BRw}: update help --tksurfer.tcl: middle-click overload: BRy->jet, BR->vd (without F3) --mk{.csh}: add new helpfile, val_jd, to dist --lib/help/tksurfer/val_vd: new helpfile --lib/help/tksurfer/{val_jt,truncphasemin,truncphasemax}: doc use trunc limits --tksurfer.tcl: select jet/vd zeros fthresh/fmid, resets truncphasemin/max --tksurfer.tcl: add Caret videen-style "vd" colscale on F3 panel --tksurfer.c: add CARET/VanEssen "videen-style" colscale=17=VIDEEN_STYLE --lib/help/tksurfer/{fmid,fslope,angle_offset}: add shortcuts --mk{.csh}: add new helpfile, smooth_grad, to dist --lib/help/tksurfer/smooth_grad: new helpfile --tksurfer.tcl: F3 panel smoothtype "gr" (tcl:smooth ), =valbakonly --tksurfer.c: compute_grad_to_ori_in_baks for cereb curv gradients --lib/help/tksurfer/{comp_grad,arrownorm}: update --tksurfer.tcl: shift-middle-click arrownorm: conv/disp gradamp to real overlay --tksurfer.tcl: comp_disp_grad only does compute_angles_vals_to_baks if phase --tksurfer.tcl: horrible hack for yosemite slowdown: tmp xterm over tools panel --tksurfer.tcl: "curv:" dropdown loads thickness, resets R/G colscale mid=2.3mm --csurf: horrible hack for yosemite slowdown: tmp xterm over setupscans panels --wrappers.tcl: positionpopup returns position (for yosemite csurf hack) --lib/help/tksurfer/{swapstatval,comp_fs}: update --tksurfer.tcl: swap_settings w/swap_{val_val2,stat_val,valval2_valbakval2bak} --tksurfer.tcl: corrected prev binding (was an Shift in there, too) ---------------- 10Apr2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --tksurfer.tcl: overload unlab'd arrownormflag check w/toggle angoffrevarrflag --tksurfer.tcl: editfile: 'open -e', touch to mk new file, OK on OSX 10.10 --tksurfer.tcl: toggle arrownormflag resets arrowscale (ON=>0.5mm, OFF=>5) --tksurfer.c: fix compute_gradient on phase (save gradients til loop done) --tksurfer.c: correctly track compute_angles r,i=>th,r thru swaps,push,readnew ... ################################################################### LATEST EMAIL UPDATE: 13 May 2015 ################################################################### sorry for the sooner-than-usual csurf spam. Here is another update with some new functionality, 2 visible bug fixes, and new documentation: New (~45M) tarfiles are at: http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/UPDATES.txt http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-linux-150513.tgz http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-linux64-150513.tgz http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-mac-150513.tgz Surface Labels -> 3D AFNI mask ROI BRIK The main new thing is the ability to dump out a 3D ROI AFNI mask BRIK from any regular label, a single region in an MGH .annot file, or all regions in an .annot file. The BRIK is 0/1. This is available from yet more overloading of the "D" button on the "label:" line. I've appended the new "D" button help which has all the details. The basic label->ROI function is: shift-middle-click "D" button after picking label It warns you what it's going to try to do. Bug Fixes There were two visible bug fixes: (1) Forgot to global a variable (brainregioncnt) which was preventing using the new searchlight correlation facility (the "label:" line "X" button) from working when you tried to use an MGH .annot brain region. (2) The new facility to remember color scale settings while swapping between two data sets with the S/V button was mistakenly unsetting the color scale the first time you swapped. Document Updates The overloaded buttons on the label line now have summaries at the top, so you don't have to dig down to find them. ### 13 May 2015 (surf label -> 3D ROI, bugfix, doc updates) 1) "label:" line "D" button can make 3D AFNI mask BRIK from label 2) bugfixes: swap settings OK 1st time, searchlight corr OK w/.annot To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################################################## Help for the "label:" line "D" button ######################################################################## ------------------------------------------- funct (left-click): display labels read_label_to_annot_using_col $r $g $b read_mgh_annot ------------------------------------------- funct (middle-click): undo cut read_label_to_undo_cut ------------------------------------------- funct (shift-middle-click): label => 3D ROI write_label_timecourses_stats 3 ------------------------------------------- funct (shift-left-click): annot => 3D-ROI write_annotcol_timecourses_stats $r $g $b 3 ------------------------------------------- funct (ctrl-shift-left-click): all annots => 3D ROI write_annotcols_timecourses_stats 3 ------------------------------------------- Detailed Description of Label "D" Button Actions ------------------------------------------- funct (left-click) read_label_to_annot_using_col $r $g $b read_mgh_annot ------------------------------------------- A default left-click on the "D" button reads two different kind of files available in the "label:" dropdown -- standard ASCII single-label files and binary MGH annotation files. Label file (.label suffix) Display the position of a label as a transparent colored overlay, ignoring both val's and coord's it contains -- that is, use only vertex nums. Reads vertex numbers from from an ASCII label file whose name is current value of $label (entry at left) and color the labeled vertices using specified r,g,b values (0-255). The r,g,b values that the "D" button passes to this function are taken from the current values of the r,g,b entries to the right of the MESH button. The opacity of all labels is controlled by the "tran" field ($labelalpha, default=128 is half transparent, set to 255 for completely opaque). To use label to extract surface vertex data in .val(.val2) fields, see "W" button R-click help (e.g., tcl funct: write_val_annoted_vertices). Use the "label:" line "CLR" button to clear the displayed transparent label. MGH Annotation file (.annot suffix) The "D" button can also read a binary MGH annotation file, which typically contains a set of differently colored labels, as a transparent overlay. In this case the "D" button also reads the color LUT embedded in the annotation file, which maps unique colors to brain region names and numbers. A left-click on a surface vertex loads the annotation color into the r,g,b field to the right of the MESH button. The corresponding brain region name and ID number is printed in the csurf log. To use the MGH annotation to extract surface vertex data in the .val(.val2) fields under one of the colored labels, see "W" button R-click help (tcl funct: write_val_annotedcol_vertices). Use the "label:" line "CLR" button to clear the displayed transparent label, and also, the embedded MGH color LUT. ------------------------------------------- Alt funct (middle-click): read_label_to_undo_cut keyboard equivalent: none ------------------------------------------- If the "D" button is middle-clicked (instead of default left-clicked), vertices in label are read and used to uncut the surface (if cut). If vertex not cut, no effect. To repair unintended surface cuts on a patch, first make a label that covers the parts of the cut(s) you want to undo. There are two critical points: (1) the cut-fixing label has to be *made* on an *uncut* surface (e.g., inflated). This is so that the missing vertices can be labeled. To transfer the location, you can FILL a small AREA cut around the unintended cut as a marker label then display it on the uncut surface. (2) the cut-fixing label can only be *applied* to an already-cut but *still 3D* surface (e.g., full.patch.3d). This is because the missing (invisible) vertices on an already-flattened patch will no longer be located inside the cut (they will still be back in their original 3D location). Re-read the cut surface, select the label on the "label:" entry, and middle click the "D" button to repair the cut. Before applying, you can display the cut-fixing label with a left click on the "D" button. ------------------------------------------- Alt2 funct (shift-middle-click): tcl: write_label_timecourses_stats 3 => 3d ROI ------------------------------------------- If the "D" button is shift-middle-clicked (instead of default left-clicked), the currently selected label is converted to a 3D ROI mask (0,1) AFNI BRIK at the resolution and orientation of the raw data set (the rawdata set must be present in the scandir for this to work). The sampling of the 3D data set is done according to the current sample settings (right-click the "label:" label for a popup), and uses the name of the label as a BRIK prefix. For example, a label named: rh-MY_AREA.label will be converted to an ROI BRIK named: rh-MY_AREA+orig.BRIK ------------------------------------------- Alt3 funct (shift-left-click): tcl: write_annotcol_timecourses_stats $r $g $b 3 ------------------------------------------- A shift-left-click on the "D" button (instead of default left-clicked), can be used to extract a 3D ROI mask (0,1) AFNI BRIK for one of the brain regions in a loaded MGH annotation file. As above, the ROI will be at the resolution and orientation of the raw data set (so the rawdata set must be present in the scandir for this to work). The steps are: (1) select MGH annotation from label dropdown (2) load it with left-click "D" (3) click one of the brain regions to load r,g,b color (4) shift-left-click "D" to extract 3D ROI The sampling of the 3D data set is done according to the current sample settings (right-click the "label:" label for a popup). The name of the ROI BRIK will be taken from the MGH annotation file name for the current r,g,b color. For example, for annotation file: rh.aparc.a2009s.annot clicking on the STS will set r,g,b (just to right of MESH) to 223,220,60, and the output BRIK will be named: rh-region_S_temporal_sup+orig.BRIK ------------------------------------------- Alt4 funct (ctrl-shift-left-click): tcl: write_annotcols_timecourses_stats 3 ------------------------------------------- Same as previous, but automatically dumps *all* of the brain regions in an MGH annotation files to AFNI ROI mask BRIK's. Takes a min. ######################################################################## end of "D" button help ######################################################################## ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 13May2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --fix bug: forgot-to-global-brainregioncnt prevented using do_corr w/MGH annot --fix bug: lastcolscale was -1 on first complex swap from dup'd fixcolscale var --csurf: SubjTools->ReMake surf 1hemi only tessellates 1 despite possible stale --lib/help/csurf/tksurfer: label button overloads, top summaries, writearea, GR --lib/help/tksurfer/area_{disp,read}: top summaries --lib/help/tksurfer/{label_{read,readcut,clear,read2val,write}: top summaries --tksurfer.tcl: warn popups for non-def overload actions "label:" line "D" butt --tksurfer.c: annotcol2brainregionname exp->tcl, write outp to $brainregionname --lib/help/tksurfer/label_read: new "D" overloads --tksurfer.tcl: "label:" ctrl-shift-left-"D" conv all annot regions to ROIs --tksurfer.tcl: "label:" shift-left-"D" conv 1 clicked annot region to ROI mask --tksurfer.tcl: "label:" shift-mid-"D" conv label to AFNI ROI mask BRIK --tksurfer.c: write rawdata-res 3D ROI mask BRIK of vox sampled by label/annot --tksurfer.c: AFNI write_head() --mk{.csh}: add new helpfile, label_label, to dist --lib/help/tksurfer/label_label: new helpfile --lib/help/tksurfer/{curv_bgcol,val3d_paint,label_stat,label_timecourses} --tksurfer.tcl: R-click "label:" now brings up help panel (better consistency) --tksurfer.tcl: bind sample controls popup to (default) L-click "label:" --tksurfer.tcl: "winxy:" reports clamped-to-screensize number after short delay ---------------- 02May2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --csurf: Fourier panel PAINT skips surfclust if cluster area is zero --tksurfer.c: multitimecourseflag restore orig overlay behavio, tcl script only --lib/help/csurf/tksurfer: improve GL/tk win overloaded clicks docs --tksurfer.c: popup at init rawdata load 1 timecourse, skip show orig/samp surf --lib/help/tksurfer/{val_jt,val_vd}: doc fixed controls --tksurfer.c: fix videen-style fthresh trunc, disable videen fmid/fslope ... ################################################################### LATEST EMAIL UPDATE: 28 Jul 2015 ################################################################### Here is another minor update with new functionality, new documentation, and many small doc and bug fixes. New (~45M) tarfiles are at: http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/UPDATES.txt http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-linux-150728.tgz http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-linux64-150728.tgz http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/csurf0.8-mac-150728.tgz Getting a Middle-Click from Late Model Mac OS X I improved the instructions in README.txt for getting a middle click out of late-model Mac OS X (10.9+), which has hidden the middle-click functionality. On Mac, with a Mac scroll-ball mouse, use System Preferences -> Mouse to make right mouse button "Secondary Button" and middle mouse button/scroll wheel "Button 3" to enable right and middle click (needed for edit-to-black and edit-to-white in tkmedit and help and alternate functions on many tksurfer buttons). In Mac OS X 10.9 (Mavericks) and 10.10 (Yosemite) with an apple 'trackpad' mouse, there will be no longer be any Expert Preferences mouse options for a middle click. However, a standard 3-button USB mouse will still give a middle-click in 10.9 and 10.10 if the following three options are ticked on the X11 -> Preferences -> Input tab: x Emulate three button mouse x Follow system keyboard layout x Enable key equivalents under X11 With just a trackpad (no mouse), you can still get left, middle, and right clicks using: left click: click trackpad middle click: option-click trackpad right click: command-click trackpad This is fine for accessing overloaded buttons, but is inconvenient for using tkmedit to edit 3D volume datasets (middle-click is fill, right-click is edit-to-black). Get a real 3-button mouse to do that. Interative Register/Upsample Native ROI BRIKs w/tkmedit In the previous update, I added a way to generate a 3D native AFNI BRIK ROI's from a surface label in *tksurfer* (shift-middle-click on "label:" line "D" button). The current update allows *tkmedit* to use the same files. In [fn]-F2 tkmedit interface, the "roi:" button toggles between two states: roiup: => ROI registered and upsampled to 1x1x1 roin: => ROI native Clicking on the label toggles it to "roin:", which allows reading, registering, and upsampling the native resolution ROI into alignment with the structural scan (no write). The default "roiup:" state reads and writes registered, already upsampled-to-1x1x1mm ROI BRIKs (e.g., for smooth, structural resolution ROI's and masks). These two button states and functions are parallel to "valn:" and "valup:" (and "mskn:" and "mskup:"). Percent peak-to-peak phase-encoded activation over label or vertex A shfit-right-click on the label: line "T" button calculates the average precent periodic response for vertices in a label (ignoring phase). N.B.: this requires first loading the *3D* raw fourier stat BRIKs (_x,_y), into tksurfer, which can be done by clicking "val:" to change it to "val3d:", the selecting the _x BRIK and clicking "R" (auto-reads complex). Tksurfer hacking An alternate treatment of cut borders (set $bordneiflag to 1) when inflating a cut surface with area_shrink (tksurfer-internal inflation) has been added. N.B.: inflating a surface with cuts is not a standard operation (I used this on my cerebellum). Another new area_shrink flag removes vertices with no second-order non-border neighbors (set $rmvtx2nonbordflag to 1). Tkmedit hacking Added 3D gradient calculations (calcgradamp, calcgradampdd -- nearest x,y,z neighbor and Gaussian directional derivative versions). Also added multi-threaded local normalize functions (locnorm_allslices by median or smoothed histogram max, not that useful yet). Finally, can also swap the contents of the editable and COMPARE buffers (swap_imim2). Interface improvements The overloaded buttons on tksurfer -- where using a middle click or adding shift change the action (esp. on the "label:" line) -- now all report what is about to happen to avoid confusion. Bug Fixes (1) If you use the "X" button on the "label:" line (surface-based searchlight cross-correlation) you couldn't change what you decided to correlate after the first popup, now fixed. (2) holding down tkmedit arrows to change slices now stops changing slices on up-button (was playing out buffered key repeats). (3) using ctrl-middle-click to display timecourse wasn't catching ctrl-up, so next left-click would magnify around vertex instead of selecting vertex ### 28 Jul 2015 (read native ROI, bugfixes/help) 1) HOWTO get middle click! 2) tkmedit read ROI 2-state: "roiup:" (reg'd/upsampled) <=> "roin:" (native) 3) percent peak-to-peak response (fourier-analyzed) 4) bug fixes, INPROG tksurfer, tkmedit hacks To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 28Jul2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --lib/help/tksurfer/label_timecourse: update --tksurfer.c: fix missed ctrl key-up w/long read_rawdata --tksurfer.c: ctrl-mid-click vertex prints pcntsigpk2pk if 3D stats loaded --tksurfer.tcl: shift-right-T to get avg pcnt change from label --tksurfer.tcl: ROI butt pop-up warns fill to stat/complexamp/real ([s]fthresh) --tksurfer.tcl: pop-up pre-report value: line CLR actions --tksurfer.tcl: pop-up pre-report def/nondef label D,C,CLR,R,RC,W butt actions --tksurfer.c: label timecourses opt reports pcnt activ for label to pcntsigpk2pk --bin/noarch/runra.{sh,csh,tcl}: add directory setup example --tksurfer.tcl: report 3rd file (avg float tcourse) now written by "T" button --tksurfer.c: rawdata_avgtseries: int->float, write out 3rd file (avg raw t) --lib/help/csurf/{tkmedit,makenewsubj,reconall}: update --lib/help/tkmedit/{saveimg,compare,wmfilterstd,wmfiltergau,test1}: updates --tkmedit.tcl: mid-click F3 TEST runs locnorm_allslices hacks (median/histmax) --tkmedit.c: calcgradampdd from dir. deriv. Gaussian functs --tkmedit.c: calcgradamp from x,y,z neighbors (from tksurfer) --tkmedit.tcl: mid-clk-COMPARE swaps *contents* of editable and COMPARE buffers --tkmedit.c: don't kill tkmedit if shift-right-clk w/o register.dat (!) --tkmedit.c: shift-mid-clk print3dhist: dump loc 3D hist, disp in gnuplot --tkmedit.c: locnorm_allslices: alt norm uses smoothed hist max -> abandon both --tkmedit.c: fix wintitle on read new editable (like already working im2) --tkmedit.c: multi-thread locnorm_allslices (8x faster on i7) --lib/help/tksurfer/label: update for cross-corr over label (X) button --tksurfer.tcl: put corrctrls at top of do_corr (else prevents change cmptype!) --tksurfer.tcl: warn/block FILL if label loaded but not shown --tksurfer.c: display/clear label/MGHannot sets annotloadedflag, export it --tksurfer.tcl: don't set swap_*_explain vars so overloaded S/V always reports --tkmedit.c: mediannorm_allslices: normalize by mult by avgbrain/3Dmedian --tkstrip.c: allow -outim to overwrite built-in scripts default outfiles --lib/help/tksurfer/patch_cut: typos --csurf: MGHTools -> Register Surface (to symm) wired up --tksurfer.c: shrink_area: bordneiflag: add 2% tangential force fix ragged edge --tksurfer.c: write_binary_areas{2}: b/c vtx correct, restore 2x bug at outfile --tksurfer.c: fix compute_normals_areas compute vertexwise area for quads --tksurfer.c: move read_binary_areas oldarea 0.5x correct: areatotal->vtxlevel --mk0{.csh}: update for new help file --lib/help/csurf/inflatepatchhires: new help file --tksurfer.c: rmvtx2nonbordflag to block rip vtx w/no 2nd order non-bord nei --tksurfer.c: area_shrink() rips vertices w/no 2nd order non-border neighbors --csurf: tksurferinflatepatch: interactive initial pose adj, final surf inspect --csurf: reconallcmd warns missing MGH license file --csurf: tksurferinflatepatch allows write tiffs --README.txt: update Mac middle-click/X11->input help --csurf: SubjectTools -> Inflate Surface Patch (hi-res): tksurferinflatepatch --tksurfer.c: add compute_normals_areas reportflag arg to fix too-verbose shrink --csurf: change to subject at startup if csurf started in subject's script dir --lib/help/tksurfer/restore: documents really_center_brain --tksurfer.tcl: shift-mid-click RESTORE overload: does really_center_brain --tksurfer.c: shrink_area: alt border policy: bordneiflag (avg of non-bord nei) --tksurfer.c: smooth_logarat: catch zero area (e.g., from def FS midline) --tksurfer.tcl: if areaflag, recalc full area on white, else def zero midline --tested->OK: brik2cor:native _f -> zz.mgz, tkmedit:read zz.mgz as native stat --tkmedit.tcl: read native stats (valn): accept .mgz/mgh, load to valn dropdown --tkmedit.c: read mgz/mgh float stats: extend mknativestatbufs, read_native_stat --tkmedit.c: new funct: get_mgzdatatypedims, get_mgzdatatype wrapper discards --tkmedit.c: fix repeat-arrowkey overhang GL win (slower, 1 down skipped after) --lib/help/csurf/tkmedit: document toggle roi button, correct s->up typo --tkmedit.tcl: re-enable SEND/GOTO if turn off all3 while zoomed --tkmedit.c: allow -scalefac,-offset w/byte images --tkmedit.c: make options work w/2arg: tkmedit orig.mgz -opt ... --tksurfer.tcl: popup reports samp lims in label->ROI-BRIK like tksurfer.c --tkmedit.c: better help/err for float mgz --brik2cor.c: flag (-floatmgzout) to output a float mgz --tksurfer.tcl: warn $scandir equals __noscandir__ for MGH label -> 3D ROI BRIK --tksurfer.c: 3D ROI from label incl samp lims in BRIK name {fr/mm}={min}to{max} --tkmedit.c: check/require read_regdat done for read_native_{stat,roi} --tkmedit.tcl: readnativeroi: read_native_roi,do_regupsamp_roi,labelflag,redraw --csurflib.c/h: add makeshort3D/freeshort3D (for tkmedit read native ROI) --tkmedit.c: write/export read_native_roi(), do_regupsamp_roi() --lib/help/tksurfer/label_read: explain overloaded function --lib/help/tkmedit/{valn_read, roiup}: fix typos --mk0{.csh}: update for prev renames --lib/help/tkmedit/{roin2up,roin,roin_read}: new helpfiles --lib/help/tkmedit: rename roi_{read,write,time} -> roiup_{*}, roi -> roiup --tkmedit.tcl: toggle roin/roiup state (native vs. upsamp) of 3D ROI label line --tkmedit.tcl: rename $label->$uplabel, add $rawlabel --tkmedit.c: rename label->uplabel, add rawlabel, tclexports, -rawlabel cmdline --csurf: mid-clk "fsavg" button sets oppfsavghemiflag (disp on opp fsavg hemi) --tkmedit.tcl: fix bug in error message, add help for read non-conforming ROI --lib/help/tksurfer/{arrownorm,swapstatval,val_clear}: top summaries --README.txt: rm anachronisms, intro FUNCT/STRUCT DIRS, say cp MGH fsaverage --csurf: mknewfunct: fix "mvlog mv ..." bug in attempting to mv aside session --tksurfer.tcl: Dijk checks if MGH geodesic binary is there (e.g., not in 5.1) ---------------- 13May2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --fix bug: forgot-to-global-brainregioncnt prevented using do_corr w/MGH annot --fix bug: lastcolscale was -1 on first complex swap from dup'd fixcolscale var --csurf: SubjTools->ReMake surf 1hemi only tessellates 1 despite possible stale --lib/help/csurf/tksurfer: label button overloads, top summaries, writearea, GR --lib/help/tksurfer/area_{disp,read}: top summaries --lib/help/tksurfer/{label_{read,readcut,clear,read2val,write}: top summaries --tksurfer.tcl: warn popups for non-def overload actions "label:" line "D" butt --tksurfer.c: annotcol2brainregionname exp->tcl, write outp to $brainregionname --lib/help/tksurfer/label_read: new "D" overloads --tksurfer.tcl: "label:" ctrl-shift-left-"D" conv all annot regions to ROIs --tksurfer.tcl: "label:" shift-left-"D" conv 1 clicked annot region to ROI mask --tksurfer.tcl: "label:" shift-mid-"D" conv label to AFNI ROI mask BRIK ... ################################################################### LATEST EMAIL UPDATE: 23 Aug 2015 ################################################################### MATLAB Jet and CARET color scale extension These can now be used to display complex amplitude. To do this, click the "Col:" label near the color scales to get a pop-up (R-click help avail from pop-up). New phase color scale: Fred Tonotopy Wheel There is a new built-in phase color scale from Fred Dick, "w4", which runs: gray-orange-red-blue-green-yellow-gray This gives a extra colors, while still having a small gray for the wrap-around point. Available in the View Functional Data panel, or interactively from clicking the "Col:" label to get a color scale pop-up. Copying parameters between panels On the Fourier and View Functional Data panels, there is now a "cp prev" button to copy all the parameters from the scan dir previously clicked in the left column to the currently display scan dir. Tkregister After all these years, tkregister now allows registering one local COR file (e.g., zz1.mgz) to another (e.g., zz2.mgz) without typing a lot of arguments (I use this for quick check if anything has changed with an incidental finding). tkregister zz1.mgz zz2.mgz Direct Manipulation Improvement On machines with slower video cards, up-clicks from mouse buttons were sometimes getting missed, resulting in Shift-down with no mouse button down causing direct manipulation movements on mouse move. ### 23 Aug 2015 (cp prev, cplx amp, direct manip hangover) 1) "cp prev" buttons on Fourier and View Functional Data panels 2) can use Jet/CARET for cplx amp (click "Col:" for colscale panel) 3) direct manip hangover fixed by ShiftKeyUp clears missed mouse UpClicks To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ---------------- 23Aug2015 FreeSurfer0.8/csurf0.8 tarballs ------------------ --tksurfer.c: ShiftKeyUp clears missed UpClicks (fix Shift-NoClick uses Motion) --tkregister.c: hack allows non-abs .mgz->.mgz: tkregister zz1.mgz zz2.mgz --tkregister.c: hack allows no-opt .mgz->.mgz: mkstructregdat, unset blur/invert --tkregister.c: opt -mkdefstr to mk default struct reg.dat --tksurfer.tcl: if .colcontrols there, just raise it (break works in bind!) --lib/help/csurf/setuprender: doc CARET/MATLAB complex amplitude --lib/help/tksurfer/{val_jt,val_vd}: update for complex amplitude display --tksurfer.tcl: fixcolscale sets now-allowed complex amp if real+imag loaded --tksurfer.c: if complexvalflag set, CARET/MATLAB_JET both work for complex amp --tksurfer.tcl: "Bg" to "Col" ("Colscale" omitted before) --tksurfer.tcl: add R-click help to colscales pop-up radios, explain midclk-ltw --mk0{.csh}: lib/help/tksurfer/{val_w4,val_lta}: new helpfiles --tksurfer.c: prev weird fix not required (but OK) on Linux (Mac bug?) --tksurfer.c: mv make_color_luts after read_image_info fix FRED_TONO wrap fail? --csurf: add ColorScale: "w4" (fred tono) to addrender, "jt" -> "jet" --tksurfer.tcl: add w4=18=FRED_TODO to fixcolscale, colscale pop-up --tksurfer.c: add colscale=18=FRED_TONO built-in LUT --lib/help/csurf/{setupfour,setuprender}: "cp prev" button --csurf: "cp prev" button on Fourier panel StimCycles line --csurf: "cp prev" button on Render panel ResetToDefault line --csurf: don't blow away rendertype copied to unconfig'd from Fourier phasetype --lib/help/tksurfer/{val2rgb,val2rgb_write} ---------------- 28Jul2015 FreeSurfer0.8/csurf0.8 tarballs ------------------- --lib/help/tksurfer/label_timecourse: update --tksurfer.c: fix missed ctrl key-up w/long read_rawdata --tksurfer.c: ctrl-mid-click vertex prints pcntsigpk2pk if 3D stats loaded --tksurfer.tcl: shift-right-T to get avg pcnt change from label --tksurfer.tcl: ROI butt pop-up warns fill to stat/complexamp/real ([s]fthresh) --tksurfer.tcl: pop-up pre-report value: line CLR actions --tksurfer.tcl: pop-up pre-report def/nondef label D,C,CLR,R,RC,W butt actions --tksurfer.c: label timecourses opt reports pcnt activ for label to pcntsigpk2pk ... ################################################################### LATEST EMAIL UPDATE: 12 Sep 2015 ################################################################### Pearson/circular searchlight correlation updates The Pearson/circular searchlight correlation was updated to also output a p-value (in positive exponents of 10). To make the results visible after running "X", do swap_pval_val (see R-click help for "X" button). A new function, find_uniqsamp_vertices finds 'representative' vertices for lower resolution data upsampled to higher resolution surface meshes. On interactive paint, each vertex records the uniq 3D voxel it sampled. Then, this information can be used to find the 'representative' vertex for each voxel, which is defined as the vertex in the set sampling one voxel that is closest to the average location of all the vertices in that set. The searchlight correlation can optionally restrict itself to these 'representative' vertices. This option will eventually be extended to other kinds of analyses. To see them, you have to interactively paint 3D data in tksurfer as follows: 1) open scandir w/analyzed functional data in it 2) click "val:" to change it to "val3d" 3) select a BRIK (not a wfile) from the dropdown 4) read it with "R" 5) sample to surf w/"PAINT" (clk "label:" for paint parms) 6) don't smooth so individual voxels still apparent 7) get 'representative' unique vertices with "UQ" To run the correlation searchlight, use the "label:" line "X" button. Interactively run surfclust The button to run surfclust (multiple comparison cluster exclusion filter) interactively was moved from the "val3d:" line (where it was called "CLU") to the "val:" line where it belongs (being a surface operation). To interactively run it, read in an unfiltered stats file (e.g., _f infix). Then click "label:" to get parameter controls. Then click "CS". The output will be a file with an _h, which you can read in and view with "R". Display surface-wide percent response If the raw Fourier amplitude at the stim freq has be read onto the surface (infixes _x,_y), it can be converted to percent response. This requires knowing the corresponding raw brain data average (e.g., ~800) and the number of timeseries points (e.g., 256). This can be used even when there is no raw 3D data in the directory (e.g., cross subject averages), as opposed to shift-left-click on the "T" button, which does this for a label in a scandir with timeseries data. This is accessed by a middle-click on the "val:" line "W" button. Help updates A large number of help panels (40) were updated. In particular, all the parameters in the "label:" popup now have help, and all overloaded button warn/explain when an alternate function is about to be performed. Bug fixes One bad, sometimes-crasher in tksurfer from a click in the black background has been fixed. A bug in some pop-ups hung the surface window if you closed the pop-up with the upper left 'x' button, now fixed. Gory details below. ### 12 Sep 2015 (script fixes) 1) fix movie/slices tcl scripts so GLX stays live 2) fsaverage 'representative' vertex help ### 10 Sep 2015 (corr p-val, representative vtxs, interactive surfclust) 1) p-value (opt covar) calc/disp for Pearson/circular searchlight corr 2) get 'representative' vtxs -- nearest to avg of set sampling 1 vox ("UQ") 3) Pearson/circ corr searchlight can use 'representative' vtxs 4) tksurfer: (s)fthresh and (s)fmid fully wired into LUT/CARET/Jet 5) interactive surfclust button ("CS") moved to "val:" line 6) 40 new/updated R-click help panels, warn/explain overloaded clicks 7) fix left-click in black BG sometimes a crasher (!) 8) "W" on "val:" line disp/write percent resp from _x,_y (enter avgraw,tpts) 9) Mac: csurf looks for TextEdit before paleolithic xedit :-} To install the new csurf: cd mv csurf csurf-YYMMDD tar xvfz csurf0.8-{mac,linux}-YYMMDD.tgz cheers, marty ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ### UPDATE: 12 Sep 2015 --all tksurfer/tkmedit tcl scripts now keep GLX window live while up --{mri2mpg,slices}.tcl: rm dependence on tmpcontrols --tkmedit.tcl: source $script resets userok for tmpcontrols->controls --{borders,flattenmovie,inflatemovie,offsetmovie,phasemovie}.tcl:rm tmpcontrols --tksurfer.tcl: source $script resets userok for tmpcontrols->controls --csurf: turn off surfclust in SAMP2SUBJ (2nd pass) if clustarea not > 0.0 --csurf: SURFACE-STATS skips checkstale{regdat,wfile} if subj fsaverage --lib/help/tksurfer/val3d_uniq: 'representative' vertices HOWTO for surf avg --lib/tcl/movie360.tcl: fix popup hangs GLX win, allow redo (controls w/o wrap) ### UPDATE: 10 Sep 2015 --wrappers.tcl: undo intercept killbox in controls (user must save f, kill win) --tksurfer.tcl: new dftctrls/corrctrls callers for interactive parmfix w/o kill --lib/help/tksurfer/{restore,redraw}: regularize alt click fmt --lib/help/tksurfer/{swapstatval,area_{read,disp}}: regularize alt clk fmt --lib/help/tksurfer/label_{read,read_cur,clear,read2val,write}: reg alt clk fmt --lib/help/tksurfer/val_write: document val "W" button overload --tksurfer.tcl: mid-click "W" on "val:" line: percent resp to .stat, wfile (_%) --tksurfer.tcl: wrappers controls now intercepts killbox, do_corr pauses/kills --tksurfer.tcl: inline corrctrls back into do_corr --wrappers.tcl: controls: intercept killbox (no userok in proc): no caller hang --wrappers.tcl: tmpcontrols: intercept upper-left 'x' kill no tkwait hang! --tksurfer.c: compute_dftamp2pcnt2stat for percent from _x,_y without rawdata --lib/help/tksurfer/label_corr: xcorruniq tick doc, HOWTO uniq --tksurfer.c: corr_over_label: add Pearson p calc (circ corr already done) --tksurfer.tcl: warn/explain missing find uniq vox vtxs --tksurfer.tcl: add xcorruseuniqflag to xcorr pre-popup --mk0{.csh}: add prev 15 new help files --tksurfer.tcl: mid-click "val:" line CLR also clear uniqvoxdata --tksurfer.c: clear_uniqvoxnums -> clear_uniqvoxdata (num and cnt) --lib/help/tksurfer/nsamp_{search,uniqvox,all,dfrac,bok,min,max} --lib/help/tksurfer/nsamp_{fracmin,fracmax,step,op,pre,area,sul,gyr} --tksurfer.tcl: wire find_uniqsamp_vertices to UQ --tksurfer.tcl: paint_real_or_complex checks 3D stats loaded --lib/help/tksurfer/val_clear: add clear_uniqvoxnums --tksurfer.c: rm uniqvoxnum2pvalflag, add/export clear_uniqvoxnums --tksurfer.c: add .uniqvoxnum to vtx struct, add uniqvoxnumloadedflag --tksurfer.c: paint_surface always loads .uniqvoxnum (except normop=AVGN) --tksurfer.c: save uniq 3Dvoxnum in new vtx struct memb .uniqvoxnum (was .pval) --mk0{.csh}: add HOWTO helpfile --lib/help/csurf/HOWTO: update basic retinotopy HOWTO --csurf: new new second Help menu item: HOWTO (retinotopy) --tkmedit.tcl: try TextEdit first --csurf: try TextEdit before the execrable xedit... --lib/help/tksurfer/val_lab,label_{label,stat,timecourses}: new button names --lib/help/tksurfer/val3d_{paint,read}: new button names --mk0{.csh}: mv val3d_clust to val_clust, add new helpfile --lib/help/tksurfer/val3d_uniq: new helpfile --tksurfer.tcl: mv val3d: CLU to val: CS, squish --tksurfer.tcl: rm val3d: S/V, add val3d: UQ, rename val3d PNT->PAINT --csurf: Make Scandirs, Find/Copy Raw better warning if sess is "__nosession__" --csurf: reconall warns/explains empty subjdir (vs. ask tick to use edited wm) --lib/help/tksurfer/val3d_{read,paint}: doc tcl wrapper functs --tksurfer.c: select_uniqsamp_vertices: just redraw uniqvox cent vtx selects --tksurfer.c: find_uniqsamp_vertices: get vtx nearest avg of vtxs sampling 1vox --tksurfer.tcl: add R-click popup help to NormSamp popup --tksurfer.c: click vertex also prints pval --tksurfer.c: paint_surface: was no-search=>real, now: non-avg-search=>pval --tksurfer.c: rename paint_surface uniqvoxnumflag to uniqvoxnum2pvalflag --tksurfer.c: mv uniqvoxnumflag to write_label_timecourses: uniq->ROI, can wrap --tksurfer.tcl: "X" pre-pop-up reports corr results type, fields where they go --csurf: fix quote smooth_curv command for fixing inflated_avg surf (crashing?) --tksurfer.c: corr_over_label: fix xcorr div by zero, norm covar by vtxcnt --lib/help/tksurfer/val_bi: arbitrary col1 and col2 --lib/help/tksurfer/label_corr: covar tick doc --tksurfer.tcl: add xcorrcovarflag tickbox to Searchlight popup --tksurfer.c: fix printvtxdata sometime crasher if click in background (!) --tksurfer.c: add/export xcorrvarianceflag: if 1, save numer (var), not corr --tksurfer.tcl: popups warn/explain overloaded clicks: --tksurfer.tcl: (cont.) vtxcolflag, annotbordflag, gradvecbakflag, --tksurfer.tcl: (cont.) gradvecflag, zerosymmfadeflag, angoffrevarrflag, --tksurfer.tcl: (cont.) arrownormflag, nonbinaryfsflag, bordneiflag --lib/help/tksurfer/val_read: rewrite, doc read .mgh --lib/help/csurf/val: doc accepting 1D .mgh file --lib/help/csurf/csurf: better AFNI HEAD doc --fourier.c: stop writing AFNI ORIGIN 2x! (first was copied, second was 0,0,0) --lib/help/tksurfer/label_read2valcut: file removed (put into "R" button) --lib/help/tksurfer/label_*: add titles, update for rm RC, improve readcut --tksurfer.tcl: "RC" button (read/cut) rm'd, mv funct to shift-middle-click "R" --tksurfer.tcl: if NormSamp controls there, just raise window vs. make another --tksurfer.tcl: make "label:" bold to indicate clickable --randsurfclust.cpp: better cmdline help --lib/help/csurf/setupsphavg: better help for randsurfclust --tksurfer.c: circ_corr: if pval==0.0, clamp max pos p-value exponent to 37 --lib/help/tksurfer/{label_corr,swapstatval,val_clear}: doc pval calc/clear --tksurfer.tcl: mid-click "val:" line CLR also clear pvals --tksurfer.c: add/export clear_pvals() --tksurfer.tcl: force stat mask OFF on complete xcorr --tksurfer.tcl: 3rd overload S/V: swap_pval_val (pval only exposed this confirm) --tksurfer.c: add pval calc to circ corr, dump -log10(p) to new .pval field --tksurfer.c: add/export swap_pval_val(), pvalloadedflag --tksurfer.c: add .pval to vertex structure, clear to 0 on surfread --tksurfer.c: Jet/CARET draw_colscalebar sets bar max/min to truncphase max/min --lib/help/tksurfer/label_corr: warn effect of swap --tksurfer.tcl: warn stat/val swapped so click vtx log reports stat as 'val' --lib/help/tksurfer/{curv_bgcol,overlay,offset,cvfact}: update --tksurfer.c: fix forgot-to-cache complex displayed as amp (luta,jet,CARET) --tksurfer.tcl: auto redraw radio change in colscale popup, rm REDRAW button --wrappers.tcl: helpwin: just raise if already there (was create copy) --lib/help/tksurfer/{val_lt,val_jt,val_vd}: updates --tksurfer.tcl: videen: real:zerosymmfadeflag=0,cplx:zerosymmfadeflag=1 (toggle) --tksurfer.tcl: CARET: zerosymmfadeflag=0 (mid-click to toggle) --tksurfer.c: dup zerosymmfadeflag fade code to Videen/CARET, cplx amp scalebar --tksurfer.tcl: overload mid-clk colcontrols real LUT: toggle zerosymmfadeflag --tksurfer.c: LUT: zerosymmfadeflag for fabs val/stat before cf fmid/sfmid --tksurfer.c: LUT: wire in fthresh/sfthresh/fmid/sfmid (was:fthresh,nofabsfmid) --csurf: fixswfileprefs real+mask confirmalert's self-cancel if yosemite_hack ### UPDATE: 23 Aug 2015 --tksurfer.c: ShiftKeyUp clears missed UpClicks (fix Shift-NoClick uses Motion) --tkregister.c: hack allows non-abs .mgz->.mgz: tkregister zz1.mgz zz2.mgz --tkregister.c: hack allows no-opt .mgz->.mgz: mkstructregdat, unset blur/invert --tkregister.c: opt -mkdefstr to mk default struct reg.dat ... ################################################################### LATEST EMAIL UPDATE: 22 Sep 2015 ################################################################### New Help Table of Contents One of the problems with the csurf help menu and the R-click help system in tksurfer et al is that there is no single help document, except for the marginally useful concatenation of all helpfiles in $CSURF_DIR/lib/help/CSURF_HELP.txt I didn't (yet) make a single readable document, but as a stopgap, I made a new single help window: csurf: Help -> All Help Contents (clickable) This pops up a compact table of contents for the all of the csurf menu item helps as well as all of the R-click helps for tksurfer, tkmedit, and tkregister. Each topic line in the help table of contents has 5-10 keywords (usu. button names). The topic lines are arranged by interface, and generally in upper-left to lower-right order for each program's interface. Clicking a heading, topic, or keyword displays the corresponding helpfile in a single adjacent panel. This should make it quicker to find stuff. In the process, I made revisions to almost all of the 320+ help panels to regularize them, remove stale stuff, and make them easier to read as standalone items. ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ### UPDATE: 22 Sep 2015 --cleanup csurf startup (warn no $CSURF_DIR before try load tix) --Mac: add yosemite hack to help panel --lib/help/*/*: major update/cleanup/regularization of 320+ help panels --tksurfer.tcl: cmd-ctrl-left/right arrow rotates brain in plane --tksurfer.c: ctrl-left/right arrow rotates brain in plane --mk0{.csh}: renamed helpfiles, new helpfiles, include forgotten rot/trans help --tksurfer.tcl: new help for "%:" scale entry --csurf: clickable table-of-contents of ~320 helppanes in one clearable helpwin --tkmedit.tcl: bold {x,y,z}Tal labels, change to left click --tkmedit.tcl: bind new helps --lib/help/tkmedit/{script_record,linewidth,linearflag,colscale} --lib/help/tksurfer/script_record,brainpose: new helpfiles --tksurfer.tcl: new help for click "tcl:" to record interface tcl commands --wrappers.tcl: helpwin: fix $loc="varnotfile" broken by justraise using w=fname --lib/help/csurf/rc-{subjects,surfaces,patches,sessions,scandirs,surfload{23}} --lib/help/csurf/viewrgb: new helpfile --tkmedit.tcl: respect new helpfile name (label -> seglabel) --lib/help/tkmedit/label: rename helpfile label -> seglabel --lib/help/tkmedit/im2label: new helpfile --tkmedit.tcl: im2 popup now L-click, add R-click help, make action label bold --csurf: begin compact clickable contents bound to helpfiles --tkregister.tcl: respect new helpfile name: fthresh -> fthresh2 --lib/help/tkregister/fthresh: rename helpfile fthresh -> fthresh2 --calcvert.c: allow curv/area/fs input to write to bare (swapped) floats --tksurfer.tcl: redraw select_surfext fix stalebuff on 2x in funct on Mac (?) ### UPDATE: 12 Sep 2015 --all tksurfer/tkmedit tcl scripts now keep GLX window live while up --{mri2mpg,slices}.tcl: rm dependence on tmpcontrols --tkmedit.tcl: source $script resets userok for tmpcontrols->controls --{borders,flattenmovie,inflatemovie,offsetmovie,phasemovie}.tcl:rm tmpcontrols --tksurfer.tcl: source $script resets userok for tmpcontrols->controls --csurf: turn off surfclust in SAMP2SUBJ (2nd pass) if clustarea not > 0.0 --csurf: SURFACE-STATS skips checkstale{regdat,wfile} if subj fsaverage --lib/help/tksurfer/val3d_uniq: 'representative' vertices HOWTO for surf avg --lib/tcl/movie360.tcl: fix popup hangs GLX win, allow redo (controls w/o wrap) --wrappers.tcl: undo intercept killbox in controls (user must save f, kill win) --tksurfer.tcl: new dftctrls/corrctrls callers for interactive parmfix w/o kill ... ################################################################### LATEST EMAIL UPDATE: 10 Oct 2015 ################################################################### Csurf.app for Mac I embedded the Mac csurf distribution inside an applescript wrapper, Csurf.app, so that it acts like a regular Mac Application (even has an icon). It is a easier to install/update (drag to Applications) and start (double-click). The functionality and code in the csurf directory: /Applications/Csurf.app/Contents/MacOS/csurf is exactly identical, and can be moved out of there and used as before. Since Csurf.app can't see your current shell variables environment, if csurf detects it's inside the wrapper, another csurf Preferences menu item gets added: Preferences -> Save Curr Subj/Sess Dirs for Startup which can save the current subjects and sessions directory to ~/.csurfrc, which will be read, if there, on (next) Csurf.app startup. This file is ignored with the regular csurf install (since it would override the bashrc/cshrc/env settings of SUBJECTS_DIR and FUNCTIONALS_DIR). On Mac OS X 10.9+, The very first time you start Csurf.app, you will have to temporarily set your System Preferences -> Security & Privacy "Allow apps downloaded from:" setting to "Anywhere". Open Csurf.app and say "OK to use app downloaded from internet". After the first open, you can put your Security & Privacy preferences back to restrictive (e.g., just "App Store"), and Csurf.app will always reopen. If you start Csurf.app with a restrictive settings without having done this once, you will get an extremely misleading error message: "Csurf.app is damaged and can't be opened. You should move it to the Trash" (fix by following instructions above). This intentionally misleading 'damaged' message is a plot by Apple to try to force independent developers to pay Apple a 'developers tax' (I didn't pay). Tksurfer reads multiframe .mgh vtxlist files Freesurfer and FSL sometimes use the .mgh volume format to store surface vertex list data as a pseudo-volume. Previously, the tksurfer "val:" entry line could read ("R") one-frame float .mgh vtxlist files with width equal to number of vertices and height and depth equal 1. Now it can read .mgh vtxlist files with height and depth not equal to 1 (FSL-style). Also, if there is more than one frame in the .mgh file, an "R" makes a pop-up to allow selecting which frame to read. Surfclust can filter .mgh vtxlist input The surface-based cluster exclusion filter, surfclust, can now read .mgh format, including multi-frame .mgh files. For now, output remains a *.w file. Fixed nmovie crash on Ubuntu, Yosemite On some Ubuntu 14.* and Yosemite installations, nmovie would crash with an XSetInputFocus error. Real-valued Color Lookup Table Options (8-way) Previously there was one tickbox ("intplut") that controlled how a real-valued color look-up table was interpreted (interpolate vs. non-interpolate). Now there are three, "intp" -> $interpolatelutflag "bot" -> $botedgelutflag "sym" -> $zerosymmfadeflag which results in 8 different possible combinations. These flags only affect LUT's for real-valued data or complex-valued amplitude. If "intp" is ticked, the r,g,b entries in the table are linearly interpolated to the next table entry for intermediate data val's. If unticked, the r,g,b color stays constant until the next, possibly unevenly spaced, table entry. If "bot" is ticked, the r,g,b entries in the table specify the data value for the bottom of the range of a color. If unticked, the r,g,b entries in the table specify the data value for the center of a color. Center-defined colors are more intuitive, esp. when interpolated, but bottom-edge defined colors are easier to use when you want to define/mark specific contours. Finally, if "sym" is ticked, (s)fthresh and (s)fmid will cut into the color scale symmetrically in both directions from zero, instead of only from the bottom. Ticking "sym" with "bot" ticked also flips the meaning of bottom for negative values -- that is, the 'bottom' of a color is redefined as nearest zero, from either above or below. ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ### UPDATE: 10 Oct 2015 --csurf: Render panel: add/cpprev botedgelutflag,zerosymmfadeflag --mk0{.csh}: add new helpfiles --csurf: add new LUT flag helpfiles, add all-help curvtick/offset/cvfact line --lib/help/tksurfer/{botedge,zerosymm,val2rgb,curv_tick}: new helpfiles, update --tksurfer.tcl: intplut->intp, bot/$botedgelutflag, sym/$zerosymmfadeflag ticks --tksurfer.tcl: F2 panel: replace "none" and "curv" radios with "curv" tick --tksurfer.c: clamp hi/lo non-interpolated center-defined colors (was trunc) --tksurfer.c: 8 LUT cases: interpolateflag x botedgelutflag x zerosymmfadeflag --lib/help/tksurfer/val2rgb: fix doc fabs fthresh, add zerosymfadeflag --csurf: sphavglists(00,clustsurf) to pick surf used by surfclust for area calc --tksurfer.c: disp window keyboard pose changes now logged (like tk window) --tksurfer.tcl: fmid/fslope/angle_cycles/angleoffset keyboard shortcuts logcmd's --tksurfer.c: R-click clear vertices does logcmd --csurf: env-overriding dotcsurfrc read/write Csurf.app only (it can't see env) --tksurfer.tcl: DIST and Dijk also return pop-ups (was just log) --tksurfer.c: use genstrret_1k to return Euclidean dist --tksurfer.tcl label-line binds: if notdivider => if divider break (OK in bind) --tksurfer.tcl: brainpose by sliders reports C/tcl cmds to tcllog (vs tcl procs) --csurf: fixswfileprefs: ImportStats no-match-mask-err popup->log, rm 10.10 hack --csurf: menu item to write .csurfrc using current state of subj/sess/FSURF dirs --csurf: if ~/.csurfrc exists, read "export name=val" to tcl env if exist tclvar --applescript/Csurf.app: make applet.icns (flat, darken red) --mk0{.csh}: include applescript in "dist", make Csurf.app if Darwin "insttmp" --applescript/Csurf.app: source .csurfrc else mkdir fsdata/{subjects,sessions} --tksurfer.tcl: "val:" line "R" choose frame popup if .mgh fileheader nframes>1 --tksurfer.c: new/exported funct, read_mgh_header (partial, uncompressed only) --tksurfer.c: new/exported var, mghvalframe: choose later frame in .mgh valfile --nmovie.c: rm XSetInputFocus (was X crash on Ubuntu14 laptop, some 10.9) --surfclust.cpp: read given frame .mgh file if instem suff .mgh, wfile out only --surfclust.cpp: readmgh (e.g. lh.cope1.mgh 1974x1x83=163842 w/2 frames) --tkmedit.tcl: force show "roi" tick on read upsamp roi --csurf: SetupFunct panel "SubjectDir Target Image Set" controls stats underlay --lib/help/csurf/HOWTO: new section on disp 3D retinotopy, revise fourier/surf --tksurfer.tcl: warn/help bad non-integer SMOOTH args --tksurfer.tcl: warn ROI fill ignores truncphase, return --wrappers.tcl: helpwin -inactiveselectbackground $bgcol to avoid black --csurf: change reconall/avgsurf script to req. tcsh (maybe tcsh inst'd w/o csh) --csurf: check tcsh installed also for reconallcmd, avgsurfcmd w/start anyway --csurf: startup check tcsh installed (for recon-all), warn/allow start anyway --csurf: better error msg on refuse to overwrite NIFTI already conv from BRIK ### UPDATE: 22 Sep 2015 --cleanup csurf startup (warn no $CSURF_DIR before try load tix) --Mac: add yosemite hack to help panel --lib/help/*/*: major update/cleanup/regularization of 320+ help panels --tksurfer.tcl: cmd-ctrl-left/right arrow rotates brain in plane --tksurfer.c: ctrl-left/right arrow rotates brain in plane --mk0{.csh}: renamed helpfiles, new helpfiles, include forgotten rot/trans help --tksurfer.tcl: new help for "%:" scale entry --csurf: clickable table-of-contents of ~320 helppanes in one clearable helpwin ... ################################################################### LATEST EMAIL UPDATE: 20 Nov 2015 ################################################################### Mac OS X 10.11 (El Capitan) csurf/Csurf.app now work on Mac OS X 10.11 (El Capitan). The new version also works on previous releases back to 10.6.8 (Snow Leopard). [gory details for the masochistic] The new System Integrity Protection, SIP, on Mac OS X 10.11, among other things, no longer passes some shell environment variables to subshells (e.g., $PATH and $DYLD_LIBRARY_PATH are not passed). The first line of csurf was: #! /usr/bin/env wish8.5 which relied on $PATH being passed to the subshell that env starts so the right X11 wish8.5 got called (instead of the Aqua wish8.5). This also relied on $DYLD_LIBRARY_PATH being passed so that the csurf-internal tcl libs got used (instead of the incompatible Aqua tcl libs). Here is the workaround (trick based on different interpretation of backslash in sh and tcl) to avoid a subshell (exec replaces the current shell, and sh can use an inline environment): #! /bin/sh # next b/c Mac 10.11 doesn't pass DYLD_LIBRARY_PATH to subshell \ DYLD_LIBRARY_PATH=$CSURF_LIBRARY_PATH exec wish8.5 $0 ${1+"$@"} The "env" command was also being using inside csurf to start tksurfer, since some variables were being passed as environment variables to tcl scripts. Those variables are now passed using a tmpfile. HOWTO first-time Csurf.app start-up To use Csurf.app on Mac OS X 10.9+, first temporarily set System Preferences -> Security & Privacy "Allow apps downloaded from:" setting to "Anywhere" and open Csurf.app once and say "OK to use app downloaded from internet". After first open, put Security & Privacy preferences back to restrictive (e.g., just "App Store"), and Csurf.app will always reopen. If you don't do this, you will get misleading error message: "Csurf.app is damaged and can't be opened. You should move it to the Trash". Read VTK surfaces and data overlays An initial and not-completely-general :-} facility has been added to directly *.vtk files (ASCII format, for displaying Leipzig MIPAV data). VTK ASCII triangle surface files can be read into tksurfer. To appear in the csurf "surfaces:" dropdown, the filename must be given a freesurfer-like prefix. For example, rename: .vtk to rh.orig..vtk If these files are appended with overlay data -- that is, vertexwise ASCII data in one or more columns per vertex after surface specification, and following an intercalated header line: POINT_DATA then tksurfer will accept them as a val file (they will be loaded into the "val:" dropdown. For this purpose, the preceding surface specification will be ignored. The number of vertices must match that of the currently loaded surface. The MIPAV and freesurfer coordinate system definition differ, so you will have to rotate the brain 180 deg in the z-axis. The surfaces can be converted to native freesurfer surfaces using "W" on the "outsurf:" line on the larger tksurfer F3 panel. To rotate, scale, and save out a *.vtk surface surface with a tcl script, do: really_rotate_brain_y 180 really_scale_brain 1.5 1.5 1.5 ;# guess: this shrunken? really_center_brain setfile outsurf lh.orig write_binary_surface confirmalert "now restart tksurfer to init w/new center" ######################################### Latest addition to $CSURF_DIR/UPDATES.txt ######################################### ### UPDATE: 21 Nov 2015 --lib/help/csurf/{csurf,rc-surfaces}: HOWTO make vtk surf appear in "surface:" --csurf: surface combo includes $hemi.{orig,inflated}* at end, better sorting --lib/help/tksurfer/val: doc new multi-column ASCII .vtk vertex data format --lib/help/csurf/csurf: doc new ASCII .vtk surface format --tksurfer.tcl: "val:" line "R" choose column num popup if .vtk filehdr ncols>1 --tksurfer.tcl: also load *.vtk files (sub+sess) to "val:" (ignore $hemi) --tksurfer.c: read_binary_values: .vtk w/3lines: POINT_DATA,SCALARS,LOOKUP_TABLE --tksurfer.tcl: also load *.crv files into "val:" dropdown (ignore $hemi) --medtestrender checks functscanlists($page,tkregtargdir) exists old csurf.dat --csurf: add explicit csurf "h" help butt lower right (parallel to tksurfer etc) --tkregister.tcl: small upper left "h" button for tkregister help --tkmedit.tcl: small upper left "h" button for tkmedit help --tksurfer.tcl: small upper right "h" button for tksurfer help --wrappers.tcl: allow abs helpfile -- tk{surfer,medit,register} in csurf subdir --csurf: R-click csurf help from intermenu, above "Structural"/"Functional" --lib/help/csurf/{viewscandirs,handnormalize} --csurf: R-click help for SessionTools setup panels --csurf: all help: add omitted "val:" line help for "W" button --lib/help/tksurfer/val_write: better explanation of C/tcl functions used --lib/help/tksurfer/label_timecourses: pointer to % from already painted _x,_y --lib/help/tksurfer/label_corr: better documentation of wrapper functions --Csurf.app (no change to applescript) now works on Mac OS X 10.11 --csurf: rm env: surftestrendernopanel, medtestrender, surftestrender --csurf: rm env: fixinflatedavg, fieldsigncmd, findretinborderscmd --csurf: surfercmd: tclenv->file, if $csurftclenv != "",readenv.tcl uses to set --csurf: mk3dscript, mkviewcutscript, mkflatscript source readenv.tcl --readenv.tcl: $csurftclenv exists/nonempty/there, var=val lines set tcl vars --[tkmedit.c/tkregister.c don't need -csurftclenv: no tcl vars passed via env] --[need -csurftclenv b/c can't use env, even tho it *does* pass non-PATH,DYLD] --tksurfer.c: new/exported csurftclenv: non-empty only if -csurftclenv --csurf: new: DYLD_LIBRARY_PATH=$CSURF_LIBRARY_PATH exec wish8.5 $0 ${1+"$@"} --csurf: go back to sh vs. tcl comment startup trick to pass DYLD_LIBRARY_PATH --csurf: old: #! /usr/bin/env wish8.5 => fail: env doesn't pass DYLD to subshell --FreeSurfer.{c}sh: CSURF_LIBRARY_PATH to fix Mac OS X 10.11 nopass-env2subshell --MacOSX 10.11 (ElCapitan): PATH, DYLD_LIBRARY_PATH not passed to subshell --csurf: fix writelog if run dir moved out from under running csurf ### UPDATE: 10 Oct 2015 --csurf: Render panel: add/cpprev botedgelutflag,zerosymmfadeflag --tksurfer.tcl "bot","sym" on F3 panel, sm radios: "none"->"no", "curv"->"cv" ... ... ################################################################### LATEST EMAIL UPDATE: 30 Dec 2015 ################################################################### ----------------------------------------------- Keyword search in Help, all-help-in-one ----------------------------------------------- A Cmd-f (linux: Alt-f) in any Help popup does a search for a keyword in that panel (starts at top, wraps). Handy for longer panels. Use "NEXT" or or Cmd-g (linux: Alt-g) to find next occurrence. A middle-click on lower right "h" in csurf (or Cmd-capital-H, linux: alt-capital-H) in the csurf interface -- brings up all 24,000 lines of help for csurf, tksurfer, tkmedit, and tkregister in a single keyword-searchable panel. ----------------------------------------------- Pop-up for live-record Tcl Commands ----------------------------------------------- When "tcl:" is clicked in tksurfer or tkmedit in order to record tcl commands for the purpose of automating a series of interface actions, each generated tcl command now appears in a pop-up xterm (in addition to being written in a scripts dir log file). ----------------------------------------------- Single vertex removal/restore from labels ----------------------------------------------- The edges of labels can be ragged after an AREA or LINE cut. The new PTS button (next to LINE) allows quickly touching up the edges of a label by removing or adding to each of the single vertices in the currently selected list. For example, to trim ragged edge of label: 1) recut label with "C" on "label:" line 2) select one or more edge vertices to trim 3) left-click PTS Or, to fill in gaps in the edge of a label: 1) recut label with "C" on "label:" line 2) select one or more edge vertices to extend 3) middle-click PTS (like tkmedit edit-to-white) ----------------------------------------------- Save/Restore Views ----------------------------------------------- The new Views "Save" and "Goto" buttons (in the TRANSLATE panel) allow quickly saving and restoring an arbitrary surface view/pose (rotations/translations/scale). If another csurf is started with the same subject, "Goto" can be used to match the pose of the first. ----------------------------------------------- Surface-based cluster exclusion on VTK files ----------------------------------------------- The command line program, surfclust, does surface based cluster-size-exclusion for correction for multiple comparison (in csurf, usu. run by the PAINT button at the single subject level, or by the SAMP2SUBJ button at the cross-subject level). The surfclust command line usage is appended below. Surfclust, now accepts ASCII .vtk files directly as input. These must contain a surface followed by 1 or more columns of stats per vertex (pick one column to operate on with -vtxvalcol). The output is another ASCII .vtk file that contains the same surface, and a single column of surface-cluster-filtered stats. When given an .mgh input file, surfclust now writes an .mgh output file (was: only write freesurfer *.w wfile output given .mgh input). The program, randsurfclust, now also works with a .vtk surface as input. This program determines minimum cluster exclusion size (for surfclust) given hard stat thresh, desired corrected p-value, and smoothing steps (using Monte Carlo sim). The program, multiclust, now also accepts and writes .vtk/.mgh files. This program generates non-overlapping, numbered clusters given a paired list of ascending thresholds and cluster sizes. See: Hagler, D.J. Jr., A.P. Saygin, M.I. Sereno (2006) Smoothing and cluster thresholding for cortical surface-based group analysis of fMRI data. Neuroimage 33:1093-1103: http://www.cogsci.ucsd.edu/~sereno/papers/SurfCluster06v.pdf ----------------------------------------------- Write vtk surf/value/surf+value files from tksurfer ----------------------------------------------- The "W" button on the "val:" line, which by default writes a freesurfer wfile, can now also write *.mgh or *.vtk value files from currently displayed vertexwise data. It can also write an all-in-one *.vtk file that contains the current surface plus one column of vertexwise values. See the R-click help for the "val:" line "W" button. The new "VTK" button on the larger F3 panel can write out a *.vtk version of the current surface. Note that for now, this (and the all-in-one option above) simply writes out the surface in freesurfer native coordinates with no transformation, so the surface may not display as a lateral view in a vtk viewing program. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Fixed recently-introduced bug that prevented reading non-default parameters in movie tcl scripts. Tcl logging for pose changes and tkmedit GL window clicks improved. A Shift-down in another window when starting with focus in the surface window no longer incorrectly engages direct manipulate. Can now select text from confirm popups (e.g., long file paths, measurements). ########################################################################## ### UPDATE: 30 Dec 2015 --multiclust.cpp: marty: allow .mgh/.vtk input/output (parallel to surfclust) --multiclust.cpp: extern global recurscnt/maxusedrecurscnt (decl:surflib.h) --multiclust.cpp: (from surfclust) incr stacksize deep recursive growCluster --randsurfclust.cpp: allow vtk surf input --randsurfclust.cpp: crashes w/recursive growCluster -> incr stacksize to max --csurf: add View:Save/Goto and F3 VTK write surf to all-help --tksurfer.tcl: .mgh/.vtk "val:" line "R" resets colscale real-valued if cmplx --tksurfer.tcl: shift-ctrl-mid-clk val "W": write_vtk_surface_plus_values --tksurfer.c: write_vtk_surface_plus_values, auto-append .vtk as previous --tksurfer.c: write_vtk_surface, auto-append .vtk to outname if not there --tksurfer.tcl: rm F3 FL (flatten) button til works again (makes space for PTS) --tksurfer.tcl: F3 panel: W-ASCII=>ASC, VTK (write_vtk_surface), autoappend .vtk --tksurfer.c: read_binary_values: accept *.vtk start w/header *or* POINT_DATA --lib/help/tksurfer/{val,val_read,val_write}: updates, "W" overloads --tksurfer.tcl: ctrl-middle-W: write vtk POINT_DATA valfile (force realonly) --tksurfer.tcl: ctrl-left-W: write mgh valfile (force real-only) --tksurfer.c: add write_vtk_values (begin POINT_DATA: allvertices,float,1frame) --tksurfer.c: add write_mgh_values (allvertices,float,1frame) --clustlib.cpp: warn half that (calcStats w/300K already over 15 min) --clustlib.cpp: block >300K growCluster recursions (crashes above 750K) --surfclust.c: extern global recurscnt/maxusedrecurscnt (declared: surflib.h) --surflib.c: surflib.h: global recurscnt/MAXRECURSCNT to catch growCluster crash --surfclust: still crashes w/recursive growCluster -> incr stacksize to max --surflib.c: comment out redone MRIScomputeNormals,mrisComputeVertexDistances --wrappers.tcl: new confirmalert $bgcol w/barely vis frame indicate selectable --wrappers.tcl: okreplace indents filename --tksurfer.tcl: GO (run tcl script) suppresses ret=0,1 in addition to ret="" --surfclust.cpp: add help, examples, arg checking --surfclust.cpp: .vtk: transcribe surf, append one col vals --surfclust.cpp: .mgh: req .mgh input, writes only 1 frame regardless of inp --surflib.c: MRISwriteVtkSurfaceAndValues: transcribe surf, append 1 col vals --surflib.c: MRISwriteMghValues: one output frame regardless of input frames --csurf: add View:Save/Goto to all-help --lib/help/tksurfer/{save_pnt,goto_pnt,saveview}: document $subjtmpdir --surflib.c: MRI_DIR -> CSURF_DIR --surflib.c: regularize MRISreadValues{Mgh,Vtk}File to return ecode --surflib.c: mv MRISreadValues{Mgh,Vtk}File from surflib.cpp to here --surflib.c: add mrisReadVtkFile function --surflib.c: add 2nd fork (mrisReadVtkFile) to MRISread/MRISreadOverAlloc --surflib.h: add MATCH_{PREFIX,SUFFIX} macros, FIRST_IMG_BYTE, MAXVTKLINE --surfclust.cpp: add -vtkvalcol, MRISreadValuesVtkFile --tksurfer.c: make backup of surfer.mat before writing new, hardcoded->defines --tksurfer.tcl: add Save/Goto View buttons inside TRANSLATE panel --csurf: fixsurfaces trace for fsaverage: if inflated_avg there, use it --csurf: previous forces error/explain on try to misconfig Funct or SphAvg Dir --csurf: block/explain SURFACE/VOLUME-STATS if this notebook page not config'd --nmovie.c: break to STOPPED if wastefully LOOPING w/1 image --wrappers.tcl: confirmalert selectable textwidget ($usetext=0 to revert) --lib/help/tksurfer/{save_pnt,goto_pnt}: improve orig coords explanations --mk0{.csh}: include new helpfile --lib/help/tksurfer/cutpts: new helpfile --lib/help/tksurfer/{cutline,cutarea}: update to remove awk cut/uncut overloads --tksurfer.tcl: mv awk LINE/AREA cut/restore points overloads to new PTS button --tksurfer.c: Enter/LeaveNotify: ignore Shift down in otherwin w/start GL focus --tksurfer.tcl: shift-mid-clk overload AREA/LINE w/cut_vertices (1+ marked) --tksurfer.tcl: mid-clk overload AREA/LINE w/uncut_connected_vertices (1+ mark) --tksurfer.c: new/export: uncut_connected_vertices (also export cut_vertex) --tksurfer.c: cut_line: re-enable cut_vertex: open/closed line same (AREA/LINE) --tkmedit.c: add/export left_click, use if tkmedit.log in do_one_glx_event --tkmedit.tcl: log tkwin arrowkeys (arrow bindings) --tkmedit.tcl: log GLwin arrowkeys (tcl changeslice call from do_one_glx_event) --csurf: Re-Make Surf (hi-res): block use mri_fill --tkmedit.tcl: fix log report for sag/hor trough, sag/hor-tal/native coords --tkmedit.tcl: open xterm, run tail -f tkmedit.log in it upon record tclscript --tksurfer.tcl: open xterm, run tail -f tksurfer.log in it on record tclscript --wrappers.tcl: mk xcmd/cmdkey global here (rm in csurf/tk{surf,med,reg,strip}) --lib/help/tksurfer/cuts: mention auto-setup-output-names menu items --csurf: mid-click on csurf "h" button brings up full help --csurf: 3 selected text widget logs black on linux (-selectforeground black) --wrappers.tcl: helpwin: selected text widget help black on linux --csurf: viewonehelp: focus on helptext, position cursor beginning --wrappers.tcl: helpwin: focus on helptext, position cursor beginning --wrappers.tcl: helpwin: OK kills search panel like "x" --wrappers.tcl: helpwin: fix alt-f,g to work on Linux --csurf: viewonehelp: fix alt-f to work on Linux --wrappers.tcl: helpwin: strip periods from helpfile name (b/c window path) --wrappers.tcl: move replchar from csurf to here (now needed in helpwin) --csurf: move replchar to wrappers.tcl (needed by helpwin there) --lib/tcl/{flattenmovie,inflatemovie}.tcl: use parms (bug from changed controls) --lib/tcl/{movie360,phasemovie,offsetmovie}.tcl:use parms (new ctrls),close@end --csurf: check/block/warn "#" in recon-all pathname (subshell fails) --csurf: file chooser height 400->500 --csurf: italicize (bold/unbold) main all help TOC headings --csurf: rename ifont->ifontb, add ifont for allhelp --wrappers.tcl: rename ifont->ifontb, add ifont --csurf: add hemi,3dradios,surfradios,other3dvol to help TOC --lib/help/csurf/csurf: help TOC, Cmd-f/NEXT,,Cmd-g, search big help --csurf: bind Alt/Cmd-H to all help in one window (CSURF_HELP.txt) --csurf: finish R-click help (hemi, 3d radios, surf radios, other 3d vol) --mk0{.csh}: add new helpfiles --lib/help/csurf/{rc-hemi,rc-volradio,rc-vol,rc-surfradio}: new helpfiles --csurf: use wrapper26nm.tcl onefindpanel for onehelp window in allhelp --wrappers.tcl: add search to help panels (Cmd-f, NEXT====Cmd-g) --lib/help/csurf/{csurf,rc-surface} mention make empty subject --tksurfer.c: read_binary_values: VTK: check first line only, skip to POINT_DATA --tksurfer.c: read_binary_surface: VTK: more feedback, more checking ### UPDATE: 21 Nov 2015 --lib/help/csurf/{csurf,rc-surfaces}: HOWTO make vtk surf appear in "surface:" --csurf: surface combo includes $hemi.{orig,inflated}* at end, better sorting --lib/help/tksurfer/val: doc new multi-column ASCII .vtk vertex data format --lib/help/csurf/csurf: doc new ASCII .vtk surface format --tksurfer.tcl: "val:" line "R" choose column num popup if .vtk filehdr ncols>1 --tksurfer.tcl: also load *.vtk files (sub+sess) to "val:" (ignore $hemi) --tksurfer.c: read_binary_values: .vtk w/3lines: POINT_DATA,SCALARS,LOOKUP_TABLE ... ########################################################################## # usage for surfclust program: ########################################################################## sereno% surfclust Usage: surfclust -instem instem -subj subjname [options] [zero clusters below requested size for cluster-size exclusion] Notes: .w/.mgh input => surf for area calc from SUBJECTS_DIR .vtk input => req's surf+vtxdata in 1 infile (smoothwm-like) .vtk input => -subj,-hemi,-surf ignored: infile has surf+data .mgh/.vtk output each require equivalent input .mgh/.vtk write 1frame/1col regardless of input frames/cols quit if >300K recursions during growCluster (fix: raise -thresh) Required: -instem wfile: omit hemi, extension: -rh.w *or* full .mgh name: *or* full .vtk name: -subj subject name (can be ico, not-req'd/ignored if .vtk) Optional: -outstem wfile: omit hemi, extension: -rh.w *or* full .mgh name: *or* full .vtk name: -indir input dir (def . overidden by abs instem) -outdir output dir (def . overidden by abs outstem) -mghvalframe .mgh infile frame (if omit, assumes 1st=0) -vtkvalcol .vtk infile col (if omit, assumes 1st=0) -hemi rh or lh (default=rh, ignored if .vtk) -thresh hard thresh before clustering (def=10^-10) -threshabs use absolute val when thresholding (def=no) -minarea minimum cluster size (def=1mm^2) -surf surf for area calc (def=smoothwm, ignored if .vtk) -summary output detailed per-cluster stats (def=no) -talcoords xform coords to talairach space (def=no) -nofixmni no fix mnicoords: MattBrett's txfm (def=yes) -quiet suppress messages Example (orig: read/write orig freesurfer valfile): cd \ surfclust \ -instem pol1-vreg+orig_f \ -outstem pol1-vreg+orig_g \ -hemi rh \ -threshabs \ -thresh 5.0 \ -minarea 150 \ -surf smoothwm infile: ./pol1-vreg+orig_f-rh.w outfile: ./pol1-vreg+orig_g-rh.w Example (read/write 1D mghfile, outfile has 1 frame): surfclust \ -instem /data/lh.cope1.mgh \ -mghframe 0 \ -outstem /data/lh.cope1-filtered.mgh \ -hemi rh \ -threshabs \ -thresh 5.0 \ -minarea 150 \ -surf smoothwm Example (read/write surf+data ASCII vtkfile, outfile has 1 col): surfclust \ -instem /data/lh.surf+data.vtk \ -vtkvalcol 0 \ -outstem /data/lh.surf+data_filtered.vtk \ -threshabs \ -thresh 5.0 \ -minarea 150 version: 01e ################################################################### UPDATE: 30 Jan 2016 ################################################################### ----------------------------------------------- New functions to read/write selections to labels ----------------------------------------------- There are two new C/tcl functions accessible from the "label:" line: read_label_to_select (ctrl-left-D) write_selected_list_to_label (ctrl-left-W) The function, read_label_to_select, reads a label and selects all the vertices in it as if each vertex had been left-clicked. The function, write_selected_list_to_label, conversely, can write out a label from the currently selected list. Since the C/tcl function: select_uniqsamp_vertices now *selects* the vertices it finds (it used to just display them in cyan), the function write_selected_list_to_label can be used to save the unique vertices out as a label. For reference, select_uniqsamp_vertices does the following: for each set of vertices that sample a single voxel, find the vertex closest to their average (this generates a representative set of surface vertices, so that each 3D voxel is sampled exactly once). To try it out click "val:" to get "val3d:", read a 3D data set with "R", use "PAINT" to sample it to the surface, and then "UNIQ" to run select_uniqsamp_vertices. If the data from a sparse label like this is read back onto a cleared surface, use sparse smoothing to fill in the gaps (select "sp", then SMOOTH, which only allows undefined/zero vertices to change). ----------------------------------------------- Dilating FILL ----------------------------------------------- Existing background The "er" (eroding) tick next to FILL is by default off so that repeated FILL's do not erode a label. If this checkbox is left-clicked, an eroding FILL will be done (useful for generating completely non-overlapping labels -- see R-click help). New functionality If a non-default middle-click is done on the "er" tickbox, a *dilating* FILL will instead be set up. Each successive FILL will then *add* a rim of additional vertices. This can be used to gradually grow the edges of an arbitrarily-shaped label. The dilating FILL respects/avoids any labels that might have been displayed, and is cancelled or overriden if eroding fill is selected. ----------------------------------------------- New tksurfer funct to assemble labels into MGH annotation ----------------------------------------------- There is a new tksurfer function to conveniently assemble a set of individual csurf labels into a single MGH annotation file. If the "W" button is *ctrl*-*middle*-clicked (instead of default left-clicked), yet another alternate write label function is called: write_mgh_annot Ctrl-middle-clicking "W" makes a popup where an MGH FreeSurfer Color Lookup Table (LUT) filename can be entered. Here is an example format of an MGH FreeSurfer LUT file (empty lines or lines starting with '#' are ignored). #!ascii , CsurfColorLUT.txt (in $CSURF_DIR/lib/lut) #------------------------------------------------- #id region(=labelinfix) R G B A #------------------------------------------------- 0 Unknown 0 0 0 0 1 V1_lower 150 0 100 0 2 V1_upper 150 0 120 0 14 V3_lower 0 50 200 0 15 VP_upper 0 50 220 0 Each region or structure name (except "Unknown") must have a corresponding csurf dash-style label (for current hemisphere) in the current subject's label directory. Using the example above for the right hemisphere of subject, fsaverage, the following label files must exist: $SUBJECTS_DIR/fsaverage/label/rh-V1_lower.label $SUBJECTS_DIR/fsaverage/label/rh-V1_upper.label $SUBJECTS_DIR/fsaverage/label/rh-V3_lower.label $SUBJECTS_DIR/fsaverage/label/rh-VP_upper.label Select or enter an output file ending in *.annot in the entry on the "label:" line. Finally, click READY to assemble an MGH annotation file containing these labels in these colors. Vertices on the surface not included in any label will be given structure name "Unknown" and will always be displayed as completely transparent (alpha=0). The transparency of all other structures is controlled by the "tran" entry at the upper right. Individual regions or all regions in an annotation file can be used to extract timecourses or stats from surface overlays. If $annotbordflag is set to 1 (shift-middle click the label tick), only the borders of the annotations will be drawn. ----------------------------------------------- Complex smoothing that ignores local phase diffs ----------------------------------------------- Complex-valued smoothing (vector average) will reduce the complex amplitude if data at neighboring vertices have different phases. To avoid this, a new smoothing option "cr" (complex/real) is available in tksurfer on the large F3 panel (or by middle-clicking "val" on the regular panel). The angle is derived from the vector average of neighbors, but the amplitude is then replaced with the real-valued average of neighboring complex amplitudes. This is most appropriate for data sets in which the complex amplitude has been replaced by a statistic -- e.g., _r,_i datasets, where complex amplitude is sqrt(F). ----------------------------------------------- tksurfer area/curv/lut/patch/val dropdowns update ----------------------------------------------- The area, curv, lut, patch, and val filelist dropdowns now update (pattern-match) appropriate available files on every new click of the dropdown, so any files written this session will now appear without having to restart tksurfer (previously only the case for label, tcl, and rgb dropdowns). ----------------------------------------------- tkmedit surf/im/roiup/valup/mskup/lut dropdowns update ----------------------------------------------- The surf, im, im2, roiup, valup, mskup, and lut filelist dropdowns now update (pattern match) available files on every dropdown, so any files written this session will now appear without having to restart tkmedit. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Don't crash tksurfer if FSURF_DIR not defined. Fix on Linux: File -> {Funct/Subj} NOTES The angle_offset value required to cancel a 1sec hemodynamic delay added to View Functional Data and Fourier panels Fix Recon-all panel 'file not found bug' if accidentally ADD SCAN more lines than needed Preferences -> Small Screen works again for SURFACE button Earlier warning for wrong render type (indiv vs. cross-subject) Fix "load2surf" tick for interactive shrink Put back 100ms delay to block runaway updates from fast clicks in slider trough in Linux ########################################################################## ### UPDATE: 30 Jan 2016 --tksurfer.tcl: Linux:100ms delay block runaway updates w/fast slidertrough clks --lib/help/tksurfer/label_write: update for write_mgh_annot --tksurfer.tcl: ctrl-mid-clk label "W" assemble ColorLUT csurf labels to .annot --tksurfer.c: default $lulabel/ulfname now $CSURF_DIR/lib/lut/CsurfColorLUT.txt --tksurfer.c: write_mgh_annot:assemble MGHcolorLUT csurf label infixes -> .annot --csurf: R-click help for the "h" button --csurf: add new complex/real smoothing to all-help panel --mk0{.csh}: add new helpfile to dist --lib/help/tksurfer/{smooth_cpxreal,smooth}: new helpfile, update existing --tksurfer.tcl; new "cr" (complex/real) smoothing F3 (or mid-clk F2 "val") --tksurfer.c: add/exp smooth_complexang_realamp (repl smoothed amp w/real avg) --bin/noarch/tiff2mpg: add tiling option (if ImageMagick montage on path) --lib/help/tksurfer/erode: document dilatingfillflag --tksurfer.tcl: overload erode FILL: mid-clk => dilate FILL (erode cancels) --tksurfer.c: add/export dilatingfillflag to floodfill_marked_patch --csurf: load2surf bug (forgot to global inflatedext2) --tksurfer.tcl: copy global/startup C/tcl functions/vars into comments --tkmedit.tcl: copy global/startup C/tcl functions/vars into comments --mk0{.csh}: fix broken cp to src of pre-compiled linux libjpeg --tkmedit.tcl: localize all help bindings (easier to rearrange) --tkmedit.tcl: add listcmd to "lut:" combo (for luts written interactively) --tkmedit.tcl: add listcmd to "mskup:" combo (interactive write upsamp mskBRIK) --tkmedit.tcl: add listcmd to "valup:" combo (interactive write upsamp valBRIK) --tkmedit.tcl: add listcmd to "roiup:" combo (for ROIs written interactively) --tkmedit.tcl: add combo w/listcmd to "im2:" (for vols written interactively) --tkmedit.tcl: add combo w/listcmd to "im:" (for vols written interactively) --tkmedit.tcl: add combo w/listcmd to "surf:" w/surfs for both hemis, curr first --csurf: below makes Preferences->SmallScreen work again for SURFACE button --csurf: SURFACE/surfercmd env=>opts:late csurftclenv read broke openwin configs --csurf: earlier warn wrong rendertype (View Funct/SphAvg Data menu before set) --csurf: squish padx RIGHT LEFT BOTH for freakishly large Fedora Helv 14 --wrappers.tcl: foundbywhich: strip to tail in string match else not found Mac --csurf: fix reconall ADD/DEL file not found bug: unset mghinprawscanfiles(last) --tkmedit.tcl: add Mac app nap hack --lib/help/tksurfer/val_bi, lib/help/csurf/setuprender: better "bi" scale doc --csurf: add angle_offset for 1sec delay to View Functional Data --csurf: Fourier panel calculates angle_offset for 1sec delay --lib/help/csurf/setuprawavg: improve description of reversing time --csurf: block/explain non-integer Stim Cycles Per Scan --csurf: block/explain non-integer Num TRs to timeshift --csurf: stop "Now, locate single sub..." message from wrapping on "functional" --tksurfer.tcl: don't crash interface if FSURF_DIR not def'd, just rm Dijk butt --tksurfer.c: malloc marked[] to vertexcnt of surface --wrappers.tcl: mk foundbywhich work w/compound path (fix File->NOTES linux bug) --lib/help/tksurfer/label_{read,write}: update additional overloadings --tksurfer.tcl: ctrl-left-D on "label:" line => read_label_to_select --tksurfer.tcl: ctrl-left-W on "label:" line => write_selected_list_to_label --tksurfer.c: add/export read_label_to_select --tksurfer.c: select_uniqsamp_vertices now marks, too --tksurfer.c: increase marklist 1K->150K, mark_vertex flag to skip log print --tksurfer.c: add/export write_selected_list_to_label --Makefile: tk{sur,med,reg,str},nmovie,wheel: Mac-only: add /opt/X11/{incl,lib} --tksurfer.tcl: add listcmd to "area:" combo so open dropdown updates files --tksurfer.tcl: add listcmd to "curv:" combo so open dropdown updates files --tksurfer.tcl: add listcmd to "lut:" combo so open dropdown updates files --tksurfer.tcl: add listcmd to "patch:" combo so open dropdown updates files --tksurfer.tcl: add listcmd to "val:" combo so open dropdown updates files ### UPDATE: 30 Dec 2015 --multiclust.cpp: marty: allow .mgh/.vtk input/output (parallel to surfclust) --multiclust.cpp: extern global recurscnt/maxusedrecurscnt (decl:surflib.h) ... ################################################################### UPDATE: 11 Apr 2016 ################################################################### Sample data to another subject A new overload of the "fsavg" button on the View Functional Data panel allows re-sampling the surface data from one single subject to another (standard left click resamples to fsaverage). A shift-middle-click on the "fsavg" button brings up a panel to select the other subject (must be in current SUBJECTS_DIR). This does: current subject -> fsaverage -> another subject See R-click help for details (N.B.: middle-click on "fsavg" to get sample-to-opposite-hemisphere of fsaverage still IN PROGRESS). Display MGH morph target template (.tif) frame as curv Individual frames in the MGH freesurfer tif template target (e.g., average curv or average sulc) can be loaded onto a subject's sphere.reg surface (or any other surface after sphere.reg has been loaded at least once). The average target tif's are in the standard MGH distribution, so this requires that FSURF_DIR is defined. See S/V help for how to blink back and forth between target and indiv subj data (uses swap_curv_curvbak). Multi-parameter Spherical Morph An new spherical morph option ("REG" on F3 panel) can simultaneously minimize error in curvature (e.g., sulc), a second real-valued measure (e.g., qT1), and a third complex-valued measure (e.g., polar angle) all while trying to preserve geometry (I know, I have gone to the dark side here...). The procedure is: (1) open a sphere.reg surface (2) load curvature, and/or real-valued target data, and/or complex-valued data to surface (3) sample surface data to target volumes ("reverse paint", using alternate clicks on the "val:" line "W" button) (4) load data to be morphed onto the surface (5) run sphere_morph The parameters (weights) controlling the 4 main vertex-wise terms in deformation are found at the bottom left of the large F3 interface along with a new "REG" button. The gradient descent terms, each summed across neighboring vertices, are: ws: geometry restoration (neighboring vertices vector sum) wcrv: curvature (.curv) error at current vertex, times gradient component of target curvature, in neighboring vertex direction wsta: real-valued statistic (.stat) error at current vertex, times gradient component of target statistic, in neighboring vertex direction wcpx: angle (atan2(.val2,.val)) error (circular subtraction) at current vertex, times gradient component of target angle, times complex amplitude of target (hypot(.val,.val2), in neighboring vertex direction Setting any of these parameters to 0.0 causes this kind of data to be ignored in during error minimization. Thus, there are potentially 8 different vertexwise data sets that can be involved (not including the surface geometry): CURV --target .curv sampled to image --moveable surface .curv STAT --target .stat sampled to image --moveable surface .stat COMPLEX --target .val sampled to image --moveable surface .val --target .val2 sampled to image --moveable surface .val2 Here is how to use all 8 kinds of data (N.B.: to a sphere.reg surface!) via the interface: ### load target data to surface select TARGET sulc file from "curv:" dropdown left-click "R" on "curv:" line to read to surface select TARGET real-valued stat from "val:" dropdown (e.g., qT1) left-click "R" on "val:" line to read to surface left-click "S/V" on "val:" line to move it to .stat select TARGET complex data dropdown (e.g., polar _r,_i) left-click "R" on "val:" line to read to surface ### "reverse paint" target data to volume shift-middle-click "W" on "val:" line (rev paint curv) shift-right-click "W" on "val:" line (rev paint stat) shift-left-click "W" on "val:" line (rev paint complex) ### load moveable data (data to be morphed) select MOVEABLE sulc file from "curv:" dropdown left-click "R" on "curv:" line to read to surface select MOVEABLE real-valued stat from "val:" dropdown (e.g., qT1) left-click "R" on "val:" line to read to surface left-click "S/V" on "val:" line to move it to .stat select MOVEABLE complex data dropdown (e.g., polar _r,_i) left-click "R" on "val:" line to read to surface ### morph (F3 interface) set parms: ws, wcrv, wsta, wcpx (start small) set steps/cycles click REG or as tcl commands: ### load target to surface set curv ~/surf/targ-$hemi.sulc read_binary_curv set val ~/surf/targ-qT1-$hemi.w (or .curv/.mgh/.vtk) read_binary_values swap_stat_val set val ~/surf/targ-polarangle_i-$hemi.w read_binary_values swap_val_val2 set val ~/surf/targ-polarangle_r-$hemi.w read_binary_values ### "reverse paint" target data to volume surf2sphim 0 surf2sphim 1 surf2sphim 2 surf2sphim 3 ### load data to be morphed set curv ~/surf/moveable-$hemi.sulc read_binary_curv set val ~/surf/moveable-qT1-$hemi.w (or .curv/.mgh/.vtk) read_binary_values swap_stat_val set val ~/surf/moveable-polarangle_i-$hemi.w read_binary_values swap_val_val2 set val ~/surf/moveable-polarangle_r-$hemi.w read_binary_values ### morph set wc 0.5 set wcrv 0.5 set wsta 0.001 ;# inv proportional to real values set wcpx 0.1 sphere_morph 20 ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- New S/V alt functions: swap_curv_curvbak, sawp_curv_val Fix View Functional Data reset of saved lutw colscale to standard wheel Phase color LUT does discrete colors if intp unticked ($interpolatelutflag) Fix smaller combobox dropdown every 3rd click on dropdown Fix prev unclearable old/white vtx selections when re-read surface w/selected Fix 'permissions' error (my bug) on start Mac TextEdit for NOTES Fix Mac recon-all error (from SUBJECTS_DIR env no longer passed by El Capitan) Surface/Volume window R-double-click help for surface window clicks ########################################################################## UPDATE: 11 Apr 2016 ########################################################################## --tksurfer.c: sphere_morph: precalc surf/targim ang/amp (baks so no wheel biff) --tksurfer.tcl: REG checks {curv,stat,real,imag}imloadeflag's --tksurfer.tcl: "W" butt "val:" overload: shift-L:val_to_sphim 2,val_to_sphim 3 --tksurfer.tcl: swap rare parm: shrink2d(wsh->shear) for sphere_morph(wcpx) --tksurfer.c,tcl: rename wval to wsta --tksurfer.c: add ***revpnt_stat,SPH_STAT to not overlap val/val2 --tksurfer.c: recalc sphere norm every step: simply {x,y,x}/100 --tksurfer.tcl: read .tif template popup warn sphere.reg coords not yet loaded --csurf: add shrink/morph help to all-help panel --lib/help/tksurfer/morph: new helpfile (added to mk0{.csh}) --lib/help/tksurfer/{curv,curv_read,val_write}: update tif template,surf2sphim --tksurfer.tcl: val "W" overload: shift-M:val_to_sphim 0, shift-R:val_to_sphim 1 --tksurfer.tcl: swap rare parms: area_shrink(wt/wc) for sphere_morph(wcrv/wval) --tksurfer.tcl: add REG button to run/interrupt sphere_morph --lib/help/tksurfer/swapstatval: doc new bindings --tksurfer.tcl: 4th,5th S/V bindings to expose swap_curv_curvbak,swap_curv_val --tksurfer.tcl: rm read_tif_* frames arg to parallel read_binary_values mgh,vtk --tksurfer.c: change surf2sphim to read from curv/val/va2 (was just val) --tksurfer.c: add/export functs: surf2sphim,sphere_morph, parms: wcrv,wval --lib/help/csurf/csurf: update to describe .tif format --tksurfer.tcl: if select template .tif -> chooseframe popup (documents frames) --tksurfer.tcl: load abs FSURF_DIR template .tif's into curv dropdown --tksurfer.c: rm read_tif_* frames arg to parallel read_binary_values mgh,vtk --tksurfer.c: add/export read_tif_template(), read_tif_header(), templateframe --tksurfer.c: add/export swap_curv_val(), assume curv always loaded --tksurfer.tcl: add (tif) $template to setfile sessionfiles --csurf: blkcallback colscaletype bind stops select_colscaletype reset config'd --offsetmovie.tcl: add HOWTO in error if angle_offset wrap --wrappers.tcl: always print report on source except by csurf --wrappers.tcl: helpwin: add linux/mac find/next help to right of title --lib/help/tksurfer/{intplut,botedge,zerosymm,val2rgb}: update --tksurfer.tcl: if ltw, botedgelutflag=1,zerosymmfadeflag=0 (no effect:reflect) --tksurfer.c: phase LUT: discrete colors works (both assume botedgelutflag=1) --tksurfer.c: printeventtype =>tkmedit:printXevent (count,Mac-specific Generic) --lib/help/csurf/spheresurface: explain average.tif vs. average...buckner40.tif --lib/help/tkmedit/clks: new file (add to mk0{.csh}) --tkmedit.c: right-double-click for volume window click help --mk0{.csh}: add new helpfile --lib/help/csurf/fsavg: new file --csurf: R-click fsavg gives first widget-specific setupscans-panel help --csurf: shift-middle-click fsavg sets up: curr -> fsaverage -> othersubj --wrappers.tcl: rename tmpcontrols => modalcontrols, killbox => killboxOK --csurf: if paint single subj onto fsaverage, allow use fsaverage-only patches --csurf: more bakcompat in addrawavgscan for 000319CF --csurf: 30 combos on notebook pages to -listwidth only, adjust some --tkmedit.tcl: 8 lg: -listwidth : im,roiup,roin,valup,valn,mskup,mksn,lut --tkmedit.tcl: 2 sm: -listwidth *and* listbox.width: surf,im2 --tksurfer.tcl: 7 lg: only -listwidth : tcl,patch,label,lut,val,val3d,rgb --tksurfer.tcl: 3 sm: -listwidth *and* listbox.width: surf,curv,area --csurf: 6 on mainwin: tixComboBox -listwidth 208 vs. -options listbox.width 25 --need listwidth+options for <20 char else min const width increases --small width: (<20chars) -listwidth *and* -options listbox.width --large width: (>=20chars) only -listwidth required --tixComboBox add -listwidth vs. -options "... listbox.width " --on linux, smaller only appears after previously clicking different dropdown --------------------------------------------------------------------- --finally, fix for every 3rd click on combo shrinks listbox to entry size --table of char->pix --less than than 20 chars: -listwidth *and* -options listbox.width 17->153, 18->159, 19->166 --more than 20 chars: just -listwidth 20->173, 21->180, 22->187, 23->194, 24->201, 25->208, 26->215, 30->243 35->278, 38->297, 40->315, 42->327, 45->348, 55->418, 60->453 --------------------------------------------------------------------- --lib/help/csurf/{rc-vol,rc-volradio}: update --lib/help/tksurfer/erode: update --tksurfer.tcl: ROI butt unsets dilatingfillflag, update/restore tick label --tksurfer.tcl: change "er" to bold "dl" if dilating FILL, better state report --csurf: localize csurf help next to each widget code --csurf: convert mritype entry to autofill combo to allow load non-standard vol --csurf: fix auto-cancel ViewFunct/Sphere type (no tkwait, set makingsetupscan) --csurf: inline env AFNI_ENFORCE_ASPECT=YES for afni --csurf: choosedir (mabye dir/file) uses entry title vs. "Choose Directory" --csurf: differentiate choosedir entry title strings (Choose vs. Enter) --tk{med,reg}.c,orig2cor.c: cleanup MRI_DIR->VOL_DIR --mk0{.csh}: insttmp makes tclsh/wish links (so bare matches CSURF_LIBRARY_PATH) --FreeSurferEnv.{c}sh: report *LD_LIBRARY_PATH copied to CSURF_LIBRARY_PATH --bin/noarch/{bsurf,csurffonts}: fix 10.10+ wish startup (left tclsh general) --lib/help/csurf/{tkstrip,rc-VOLUME}: update --csurf: shift-mid-click on VOLUME opens tkstrip on currently selected volume --csurf: add TkStrip to all-help panel --mk0{.csh}: new helpfiles --lib/help/csurf/tkstrip: new helpfile --tkstrip.tcl: add upper-left "h" button --lib/help/tksurfer/clks: new helpfile --tksurfer.c: fix/update cmdline click help --tksurfer.c: surface window R-double-click help for surface window clicks --lib/help/tksurfer/label_write: update for nhits display --csurf: add setenv SUBJECTS_DIR to recon-all script: ElCapitan no longer passes --tksurfer.c: don't re-malloc/destroy marked[] on re-read same vertexcnt surf --csurf: exec $editor $file >& /dev/null & => exec open -e $file (no multiple) --csurf: editfile: TextEdit case (bad geom arg -> 'permissions' err begin 10.9+) --lib/help/csurf/tkmedit: document main window clicks at top --tkmedit.c: raise/focus glx win after gnuplot histogram, popup warn rad=1 --tksurfer.tcl: do_lut2annot displays/rotates assembled labels, then hitcount --tksurfer.c: write_mgh_annot accumulates label hit count (nhits) in .stat --csurf: wrong type (funct/sphavg) warning now closes setupscans panel --tksurfer.tcl: reset flag/alpha for read/write_mgh_annot reset for log --tksurfer.c: harmonize read/write_mgh_annot (tksurfer.tcl resets flag/alpha) ########################################################################## UPDATE: 30 Jan 2016 ########################################################################## --tksurfer.tcl: Linux:100ms delay block runaway updates w/fast slidertrough clks --lib/help/tksurfer/label_write: update for write_mgh_annot ... ################################################################### UPDATE: 27 May 2016 ################################################################### Cmdline paint can output uniq samp vertices label The tksurfer function, find_uniqsamp_vertices, finds a set of 'representative' vertices for a 3D data set that has been sampled to the surface as follows -- for each set of vertices that has sampled the *same* 3D functional voxel, find the vertex closest to average location of that set. The same functionality was added to the command line program, paint, via a new option, which can be appended to the (long) command line: -uniqsampvtxs The 'representative' vertices are written to a label in the same directory as the other output files: ?h-UniqSampVtxs.label For more details (and to try this interactively), click the "val:" label to toggle it to "val3d:" and see the R-click help for UQ. Calculate data gradients on curved surfaces New overloads of the "GR" button allow calculating and displaying gradients (of curv, val, or complex-valued data in val,val2) on curved surfaces. This uses unit vectors to neighboring vertices as a basis set. 'Normal' search along vector to same pial vertex New option for paint (and tksurfer live paint) to read pial surface and do 'surface normal' sampling along line between equivalently numbered vertex instead of default csurf search along local cortical surface normals (e.g., using fractional distances from thickness file). The same-vertex method is used in SamSrf. For reference, the mris_thickness algorithm for measuring cortical thickness is: foreach numbered vtx find minimum of dist from white vtx to equiv num pial vtx dists from white vtx to neighbors of equiv num pial find minimum of dist from white vtx to equiv num pial vtx dists from neighbors of white vtx to equiv num pial average above two minimums The option is available using the "Same" tickbox under "Normsearch:" at the bottom of the Setup Functional Scans panel. Also available for live paint from tksurfer ("samevtxthickflag" tickbox on popup from left click on "label:"). The slightly higher thickness estimates from the same-vertex method sample slightly higher in the cortical column compared to the cortex normal search using fractional freesurfer thickness (thickness from mris_thickness). Convert SamSrf pRF subject to also be csurf session New prf2sess script to convert a SamSrf pRF analysis subject to have an embedded "image" directory containing wfiles, so it can be read as a csurf session (e.g., for surface average). ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Fixed small error in sphere_morph surface normal Flat *or* surface gradients arrows now zeroed when amp below fthresh. Block accidental opening of single subject with single scandir as a cross-subj surface average session. "X" (xcorr) pop-up autosaves corr output (_s), can set prefix "X" (xcorr) pop-up can output z-score (_z) instead of correlation. Random Block Panel formatting improvements "All Help In One Panel" entry in Help Contents tkmedit "m" untick to *not* also smooth 3D stats 3D cluster: better help, interface labels fix "killbox error" on kill window w/title bar 'x' ########################################################################## UPDATE: 27 May 2016 ########################################################################## --tksurfer.c: fix control-click on tk window w/focus in GLX window (like shift) --lib/help/tksurfer/val3d_uniq: update for new binding --tksurfer.tcl: middle-click UQ writes */$scandir/$hemi-UniqSampVtxs.label --tksurfer.c: add/export write_uniqsamp_vertices (ignores usecurrcoordsflag) --lib/help/csurf/setupfunct: update for new tick, changed tick labels --csurf: add UniqLab tick to Setup Align/Funct to make PAINT dump uniqsamp label --csurf: 35zr: allow start from Terminal with -f --tksurfer.tcl: fix searchlimitsOK, re-order maxs above mins --lib/help/tksurfer/val3d_{paint,uniq}: sample surf, effect white vs. inflated --tksurfer: find_uniqsamp_vertices loads orig unless c2lab/$usecurrcoordsflag --tksurfer.c: rename overlay_tm -> regdat_tmat (to be same as paint.c) --paint.c: (vers=11a): re-parallelize paint/tksurfer paint_surface() --csurf: N.B.: left midpnt contrast w/paint_surf,write_label_time set max to min --csurf: if using midpoint, also set max's to it to override tksurfer def=0.4 --csurf: live samp/PAINT: warn using midpoint when normsearch OFF w/non-0 range --tksurfer.tcl: searchlimitsOK also checks block min > max --tksurfer.tcl: get{tseries,stats,stattseries}: block like paint_real_or_complex --tksurfer.tcl: paint_real_or_complex: block normsearch=OFF w/non-zero range --paint.c: N.B.: no normdsampsearchflag: both limits always determine search --paint.c: rename thkflag to curf/tksurfer equiv normdfracflag (avoid confuse) --tksurfer.c: write_label_timecourses_stats: reset vars like paint_surface does --tksurfer.c: paint_surface: norm search OFF forces zero range (max set to min) --tksurfer.c: paint_surface updates orfname/origcoords when it uses wmgmext --paint.c: print register.dat, preappend _r prefix uniqsamp .label outfile --paint.c: add paint_surface fn/fnsamp, find_write_uniqsamp_vertices() --surflib.h: add to vtx struct: int uniqvoxnum, char uniqvoxcnt (for paint.c) --csurf/tksurfer.tcl/tkmedit.tcl: 'exec xterm ... -e bash' --nrc to keep clean --csurf: Setup Funct/Align ALL=>T catches inconsistent targTR's (e.g. diff reps) --csurf: getfunctimageslist (Image File:) filter TmpClustMask+orig,MY_AREA+orig --csurf: checkconcurrent ignores running nmovie --csurf: Fourier: no tixopts: Painted Vertex List Files inserting "image/align" --README.txt: add: run csurf from xterm, XQuartz uses .bashrc not .bash_profile --csurf: force start from xterm, not Mac Terminal (nmovie fail, then can't kill) --csurf: change killbox -> killboxOK (wrappers proc name change not propagated!) --csurf: changed surfclust default to 150 (what help says!) --csurf: changed defs to respect -dxyz=1: clusterrad:10->1, clustervol:150->40 --lib/help/csurf/{setupfour,setupimport}: fix docs --csurf: fixed 3DClust labels here: Fourier panel, Import External Stats panel --csurf: fix misleading labels (units=vox,not mm)(connected,not rad) for 3DClust --lib/help/tkmedit/smoothmask: new helpfile, add to mk{.csh} --tkmedit.tcl: add "m" tick under SMOOTH STATS for $smoothoverlaymaskflag --lib/help/csurf/setuprender: add doc for smoothoverlaymaskflag --csurf: add "m" tick render panel 3D smooth for parm $smoothoverlaymaskflag --tkmedit.c: rough in example for cmdline read env (rarely used) --tkmedit.c: add/export smoothoverlaymaskflag (def=1) to skip stat mask smooth --csurf: add "All Help In One Panel" entry to Help Contents --rename: lib/help/CSURF_HELP.txt -> lib/help/all-help --calcvert: new op -atanh: wfile -> atanh -> wfile (clamps inp -1 to 1) --lib/help/csurf/setuprand: warn/explain too-long paradigm file stem --csurf: always warn/nag too long (>7) paradigmfile stem, too long: space vs tab --csurf: cbx:select_{raw,sig}toavgdir: allow extstatscan, not just functscan --real-{view,flat}.tcl: fix multi/all: csurftclenv sets tcl vars, not env vars --/lib/help/tksurfer/label_corr: update --tksurfer.tcl: xcorr writes r2z wfile _z-$hemi.w in $val dir --tksurfer.tcl: xcorr writes corr/covar wfile _s-$hemi.w $val dir --tksurfer.tcl: add xcorr_outstem entry and r2zscoreflag to xcorr pop-up --tksurfer.c: add/export r2zscoreflag for xcorr: z = atanh(r) --prf2sess: also subst amp to make _x,_y (looks like already subst'd!) --calcvert.c: input r/i/file3 label files => r/i wfiles w/complex amp from file3 --calcvert.c: conv 5th or 6th column of labelfile to valfile (cp vtx nums) --tksurfer.c: fix small error in sphere_morph norm recalc --csurf: better csurf -help (was version mismatch crash!) --csurf: mksphavgdir blocks make avg scandir named "image/prf" --csurf: setupsphavgcx blocks open image/prf (e.g., unopened singsub conversion) --csurf: setupsphavgcx blocks open single scandir config'd as functscan --csurf: autoconfig functscan type (noerr) 1st render-open of prf2sess'd SamSrf --bin/noarch/prf2sess: new bash script to conv prf labels to session wfiles --tksurfer.tcl: if recognize pRF*_{ecc,pol}_r-?h.w, reset colscale --calcvert.c: convert 5th or 6th column of labelfile to valfile (cp vtx nums) --tksurfer.tcl: "label:" line "W" message tells whether write is real vs. cmplx --csurf: pass functscanlists($page,paintext) to tksurfer -wmgmext (live paint) --tksurfer.c: add env/opt -wmgmext to pass "Surface for Sampling 3D Data" --csurf: add Preferences -> Clear Logs (clearlogs) --csurf: add samevtxthickflag as "Same" to addfunctscan, pass to tksurfer --csurf: add samevtx,wmgmext to allhelp --lib/help/tksurfer/nsamp_wmgmext: new helpfile, update mk0{.csh} --tksurfer.tcl: add wmgmext to NormSamp, Clust Controls --tksurfer.c: add/export: wmgmext=$wmgmext (orig or white) --tksurfer.c: auto/lazy read pial from prfname=$pialcoords (no normctrls) --tksurfer.c: add/export: wrfname=$whitecoords, prfname=$pialcoords (not used) --tksurfer.c: paint_surface,write_label_timecourses_stats chk samevtx/bok req's --tksurfer.c: ctrl-middle-click now bails if missing samevtx/bokflag req's --tksurfer.c: add bokflag to normdsamp_timecourse_stat: timecourse samp wasn't! --lib/help/tksurfer/nsamp_samevtx: new helpfile, update mk0{.csh} --tksurfer.tcl: add samevtxthickflag to NormSamp, Clust Controls --paint.c: add: -samevtx , mm/frac dist to same numbered pial vtx --tksurfer.c: samevtxthickflag: use mm/frac dist to same numbered pial vertex --tksurfer.c: add/export read_binary_surface_vertexonly (to *vertexonly) --lib/help/tkmedit/clks: add GL win hotkeys --tksurfer.c: compute_{gradient,surfgrad}: zero gradient if amp < fthresh --lib/help/tksurfer/label_toggle,erode,nonbinaryfs,comp_grad: updates --tksurfer.tcl: 3 more overloads (compute_surfgrad) for "GR" button --tksurfer.tcl: 1 more overload for unmarked fs button: toggle gradvecbak3dflag --tksurfer.c: add draw_arrows3d (if gradvecbak3dflag) --tksurfer.c: add/export compute_surfgrad (data gradients on 3D surface) --lib/help/tksurfer/label: better tips for (horrible) label tools --tksurfer.c: fix occasional targim zeros from rev paint norm search vol alias --tksurfer.c: add read_sphims_at_vertex (if there) (shift-left-click) --lib/help/tkmedit/clks: add clicks for gnuplot histogram facility ########################################################################## UPDATE: 11 Apr 2016 ########################################################################## --tksurfer.c: sphere_morph: precalc surf/targim ang/amp (baks so no wheel biff) --tksurfer.tcl: REG checks {curv,stat,real,imag}imloadeflag's --tksurfer.tcl: "W" butt "val:" overload: shift-L:val_to_sphim 2,val_to_sphim 3 ... ################################################################### UPDATE: 24 Jun 2016 ################################################################### Re-cut a label including only 'representative' vertices When a label made by FILL is re-cut with a default left-click on the "C" on the "label:" line -- e.g., in order to capture current surface data to a label -- every vertex in the label is normally included. If the "C" button is instead *ctrl*-left-clicked, the $hemi-UniqSampVtxs.label is first read and consulted so that the recut label only contains 'representative' vertices (a single vertex for each sampled voxel that is nearest the average of the vertices that sampled that voxel). At re-cut time, since the resulting sparse label will typically only contain a single vertex from any given face, it cannot be displayed as a continuous surface patch. For this reason, $pointsflag will be turned on to make the sparse label visible immediately after the re-cut. To toggle $pointsflag off and on, middle-click the MESH button. Once the sparse label has been written, displaying it with the "D" button will pad the single vertices with their surrounding faces so it can be seen (see the R-click for the ROI button for a full explanation of why it has to be this way). Write surface in format for 3D printer (.stl) The "STL" button on the "outsurf:" line on larger tksurfer F3 panel writes out the current hemisphere surface in Stereolithography (.stl) format (ASCII, all-positive octant, units=mm). This makes a large file (50M). Read/Write surface in Object File Format (.off) The "OFF" button on the "outsurf:" line on larger tksurfer F3 panel writes out the current surface in the ASCII Object File Format (.off) for importing into many other surface manipulation programs (makes 10M file), Mathematica, etc. Middle-click OFF writes out surface with current colors appended to each face. Shift-Middle-click writes out surface with current colors appended to vertices (first line of file in this case changes to COFF instead of OFF). The read_binary_surface function ("R" button on "insurf:" line on F3 panel) now autodetects and reads .off surfaces. Surf-based false discovery rate (FDR) p-value correct A middle-click on the "CS" (surfcluster) button provides an alternate non-parametric FDR method of correcting for multiple comparisons. The Benjamini/Hochberg (1995) method as introduced to fMRI by Nichols estimates a corrected p-value to use for a desired false discovery rate (FDR) as follows: read F-stat onto surface calc p-val for each vertex (fcdf) sort p's in ascending order find highest p less than or equal to (i/N * q), where i = index of that p N = total num vertices q = desired probability A middle-click on the "CS" button brings up a popup with 4 adjustable parameters: smoothsteps (e.g., 5) desired_FDR (e.g., 0.05) noisedf (e.g., 256-11=245) uniqsampvtxflag (unticked: use every vtx) Vertices with a value of 0.0 are excluded because these are off the edge of the functional volume. Any invisible vertices are also excluded, so re-cut a label with "C" to restrict FDR calculation to a label. The corrected p-value is returned in a final pop-up and written into the csurf log. See the R-click help for the "CS" button for additional details. 'Representative' sampling vertex for timecourses The "T" button on the "label:" line (sample raw timecourses) can now use the 'representative' vertex mechanism (vertex closest to the average of the vertices that sampled an individual voxel). Tick "normdsampuniqvtxflag" in the "label:" popup. ROI button can also fill between phase contours Previously, the "ROI" button could floodfill a connected surface region that has stat, complex amplitude, or val above a requested threshold value. A fourth option was added to floodfill between two phase contour lines. The precendence of operations is: (a) if mask on, use: STAT > $sfthresh (b) if truncphase, use: COMPLEX PHASE within limits (c) if complex data, use: COMPLEX AMP > $fthresh (d) if real data, use: REAL AMP > $fthresh N.B.: the first matching condition wins and the other criteria are ignored. For example, to fill an region in an overlay containing real data, the "mask", "truncphase", and "cpx" ticks must all be unticked. The operations in more detail are: (a) compare .stat to $sfthresh (b) compare atan2(.val2,.val)/2Pi to $truncphasemin,max (c) compare hypot(.val,.val2) to $fthresh (d) compare .val to $fthresh In truncphase case, the phase angle is modifed by $revphaseflag, $invphaseflag, and $angle_offset before truncation is applied (like "truncphase"). In all cases, this fill procedure also respects (doesn't go past) cuts, and doesn't intrude on any currently displayed labels. Disconnected regions can be filled by marking vertices by left-clicking them in more than one region before clicking ROI. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- middle-click tksurfer val3d PAINT auto-smooths (using curr) CLONE FUNCT now clones everything (was mk links) HOWTO make single-vertex-wide are traverse label ExtStats paint bug: uniqsampvtxs2labelflag => normdsampuniqvtxflag Fix tkmedit swap bug with 3dmerge mask ########################################################################## UPDATE: 24 Jun 2016 ########################################################################## --lib/help/tksurfer/{label_readcut,mesh}: HOWTO make/disp sparse uniqvtx labels --tksurfer.tcl: middle-click MESH toggles pointsflag --tksurfer.tcl: ctrl-left-click "C" recut label respecting normdsampuniqvtxflag --tksurfer.c: read_label_cut_clearvals <0=label> respects normdsampuniqvtxflag --csurf: paintmultibrik bug/typo: uniqsampvtxs2labelflag=>normdsampuniqvtxflag --tkmedit.tcl: add surftmp to dropdown list --tksurfer.tcl: add surftmp to dropdown list --tksurfer.tcl: check selfintersectloaded (avoid ask clear selfintersect 2x) --tksurfer.c: export/maintain selfintersectloaded --lib/help/tksurfer/val_clust: doc cmdline tksurfer tcl script for FDR calc --lib/help/tksurfer/dijk: document subject/session location output path label --tksurfer.tcl: add hemi, cp Dijk subj scripts to sess scandir or subj labeldir --lib/help/tksurfer/label: add how to make 1-vtx-wide line-label traverse --imptest: *.off(gray,tricol/vtxcol)->geomview,Mathematica, *.stl->Mathematica --tksurfer.tcl: mid-clk OFF => face colors, shift-mid-clk OFF => vertex colors --tksurfer.c: write_stl_surface: face colors option, vtx col option: OFF=>COFF --csurf: add new write .off and .stl help panels to All Help panel --lib/help/tksurfer/outsurf{off,stl}_write: new helpfiles, add to mk0{.csh} --tksurfer.tcl: add F3 panel OFF button to write .stl format surface (3D print) --tksurfer.c: write_stl_surface writes .stl pos octant ASCII file --tksurfer.tcl: add F3 panel OFF button to write .off format surface --tksurfer.c: write_off_surface writes .off format file --tksurfer.c: read_binary_surface autodetects/reads .off format file --csurf: make/run no-window tksurfer script to calc cross-subj FDR (no uniqvtx) --fourier.c: autoswap LSB input timeseries BRIK (already reads LSB fullfourier) --csurf: fouriercmd: forcebrikMSB _h BRIK output (from apply clustermask) --csurf: fouriercmd: forcebrikMSB fourier pre-smooth out (was smooth prob!) --tkmedit.c: read_native_stat swaps LSB BRIK (was fail w/LSB 3dmerge mask) --tkmedit.tcl: catch/fix statmask-disabling sfthresh=sfslope=0.0 (thr,sl,msk) --tksurfer.tcl: catch/fix statmask-disabling sfthresh=sfslope=0.0 (thr,sl,msk) --tkmedit.c: left-click also prints statmask value if loaded --tk{medit,surfer}.tcl: warn sfthresh=sfslope=0.0 disables statmask --tksurfer.tcl: add val,weight smooth type option on FDR pop-up --tksurfer.tcl: new smooth type option on FDR pop-up --tksurfer.tcl: if stats loaded, also smooth w/sparse,weighted (was just val) --lib/help/tksurfer/val_clust: how to use the FDR popup, method --tksurfer.tcl: FDR popup: smoothsteps, desired_FDR, noisedf, uniqsampvtxflag --lib/tcl/{real,eccen,polar,twocond}-{views,flat}.tcl: after swap:set stat $val --lib/help/tksurfer/label_read2val: doc new read_uniqsamp_vertices binding --tksurfer.tcl: add ctrl-L-click "label:" line overload: read_uniqsamp_vertices --tksurfer.tcl: fix Shift-Middle binding "RC"->"R" button (was overlap/ignore) --tksurfer.c: fix alt/cmd-click on tk window w/focus in GLX window (like shift) --tksurfer.c: fix all label-reading functions to ignore k out of bounds --tksurfer.c: add/export read_uniqsamp_vertices (for paint.c-created label) --tksurfer.c: add/export pval_FDR, find_FDR_from_pvals() --tksurfer.c: add/export noisedf, pval_from_fourier_fstat() --tksurfer.c: add NR fcdf() -- uses betainc(), loggam() and betacontfrac() --tksurfer.c: draw_colscaledisk: top of scale resettable w/maxstatcolscale --lib/help/tksurfer/val2rgb_write: doc req. low fthresh/sfthresh for write LUT --lib/help/tksurfer/rect: document assumed input amps, no stat fade --tksurfer.c: write_val2rgblut: assume hi stat to avoid fade (only amp in LUT) --tksurfer.c: draw_colscaledisk: fix inset w/fmid=0 (was purp), hi stat no fade --lib/help/tksurfer/{roi,script}: updates --tksurfer.tcl: ROI does phasetrunc w/truncphase ON preced:stat/phase/cplx/real --tksurfer.c: floodfill_marked_patch : fill between trunc limits --tkmedit.tcl: make cursor big 2x after GOTO for changeplane (sameplane 2x OK) --csurf: addrenderscan fix missing bak compat default for new uniqvtx var --tksurfer.c: catch stale UQ after new paint --lib/help/csurf/setupfunct: better uniqvox/uniqvtx explanation --lib/help/tksurfer/nsamp_uniqvtx: new helpfile, add to mk0{.csh} --csurf: add nsamp_uniqvtx to All Help --csurf: normdsampuniqvtxflag forces normdsampuniqvoxflag (like tksurfer.c) --csurf: rename uniqsamplabelflag -> normdsampuniqvtxflag, also pass to tksurfer --tksurfer.tcl: uniqvtx tcourse pre-warn: req: native stat, paint, uniqsamp --tksurfer.c: paintTODOflag: set on load/reload 3D --tksurfer.c: normdsampuniqvtxflag requires (doesn't do) find_uniqsamp_vertices --tksurfer.c: [one extra line of C => 150 lines of interface and help...] --tksurfer.c: normdsampuniqvtxflag: sample tcourse continue if not uniqsamp vtx --tksurfer.tcl: add ~/tmp/TmpTclScript.tcl to "tcl:" menu --lib/help/tksurfer/val3d_paint: update for smooth overload --tksurfer.tcl: mid-clk overload PAINT also smooths (curr parms) before redraw --csurf: setting minvol (clustervol) to 0 skips 3D clustering (like 2D disable) --csurf: change CLONE FUNCT to just cp everything (was mk links to big files) --csurf: visually separate off options for PAINT on Setup Funct panel ########################################################################## UPDATE: 27 May 2016 ########################################################################## --tksurfer.c: fix control-click on tk window w/focus in GLX window (like shift) --lib/help/tksurfer/val3d_uniq: update for new binding --tksurfer.tcl: middle-click UQ writes */$scandir/$hemi-UniqSampVtxs.label --tksurfer.c: add/export write_uniqsamp_vertices (ignores usecurrcoordsflag) ... ################################################################### UPDATE: 04 Oct 2016 ################################################################### Read GIFTI surfaces First make a new empty subject (e.g., hcp-mmp1) with File -> New Subject, and put the *.gii surfaces into the surf subdirectory inside the new subject. To view one of the GIFTI surfaces, select it from the "surface:" dropdown and click SURFACE. To view a GIFTI surface using tksurfer directly, use a command line like this: tksurfer hcp-mmp1 rh Q1-Q6_RelatedParcellation210.R.inflated_MSMAll_2_d41_WRN_DeDrift.32k_fs_LR.surf.gii Currently, csurf reads surfaces with Base64Binary and GZipBase64Binary encoding (but not yet rarely used ASCII or ExternalFileBinary encoding). The tcl/C function read_binary_surface auto-detects the GIFTI format: setfile insurf ~/surf/Q1-Q6_Related...surf.gii read_binary_surface Since flattened GIFTI surfaces are stand-alone surfaces (i.e., not tksurfer-like patch files that rely on a parent full surface), they will be loaded into the "surface:" dropdown, not the "patch:" dropdown. Read GIFTI vertexwise data A GIFTI file containing a single column of vertexwise data overlay (e.g., *.shape.gii or *.func.gii), can be read onto a surface as a value file by selecting it from the tksurfer "val:" dropdown and loading the data onto the surface with "R" on the "val:" line (vertex count must match the current surface). The tcl/C function read_binary_values auto-detects the GIFTI format: setfile val ~/surf/Q1-Q6_Related...surf.gii read_binary_values Currently, csurf *cannot* read CIFTI files (see next for HOWTO use HCP MMP1 parcellation. CIFTI files are a peculiar kind of NIFTI file (originally ANALYZE) that has an embedded XML file before the 3D data array, but after the binary NIFTI header. For example, the XML insert in a *.CorticalAreas_dil_Colors.* file contains a color lookup table for region names, as well as a list of vertices for both hemispheres, followed by -- in what would normally be the 3D data part of the NIFTI file -- lists of region ID values for the vertices in both hemispheres. Using the HCP MMP1 parcellation The HCP MMP1 parcellation can be used directly as an MGH annotation file without the need to load any GIFTI surfaces (so I didn't really need to read GIFTI surfaces after all...). Kathryn Mills has instructions for using Workbench and MGH Freesurfer tools to resample the HCP MMP1 parcellation to full ic7.tri fsaverage resolution here: https://figshare.com/articles/HCP-MMP1_0_projected_on_fsaverage/3498446 The fsaverage annotatation files themselves: lh.HCP-MMP1.annot rh.HCP-MMP1.annot are here: https://ndownloader.figshare.com/articles/3498446/versions/2 (.zip) or here: http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/fsaverage-labels/ To load/use these freesurfer annotations in csurf: 1) unzip or download the 2 .annot files 2) put them in: $SUBJECTS_DIR/fsaverage/labels/ 3) select subject "fsaverage", open with SURFACE 4) select ~/label/rh.HCP-MMP1.annot from the "label:" dropdown (near bottom, after labels) 5) display with "D" on "label:" line The transparency can be adjusted with "tran" (tksurfer upper left -- 255 is opaque), curvature can changed from red/green to grays with the "overlay" tick (or toggled on/off with the "curv" tick at upper middle). To toggle viewing just the region borders versus filled-in regions, shift-middle-click on the tick to the left of "label:". Here is what the right hemi looks like (borders and filled-in): http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/fsaverage-labels/HCP-MMP1-annotbord-rh-inflated_avg-lat.tiff http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/fsaverage-labels/HCP-MMP1-annotfull-rh-inflated_avg-lat.tiff You can extract or operate on data from one (or all) of the annotation regions using the "W" button on the "label:" line (see R-click help for "W" button). To select one region, click it (the region name will appear in the log). This loads the unique RGB color of the region into the r,g,b fields to the right of MESH. To get a pop-up with the region name, double-middle-click it (yup). The csurf operations available for an annotation region are: "W" -> write ASCII label of curr vertex data under region "T" -> extract timecourses from raw 3d BRIK for region "S" -> extract stats from raw 3d stats BRIK for region "X" -> run searchlight cross-correlation for region New non-parametric correction option to surf-based FDR The function, find_FRD_from_pvals, not has an non-parametric correction factor for arbitrary distributions ("arbitrFDRcovarflag" tick on pop-up). As you might guess, this reduces requires a more stringent uncorrected p-value to obtain a desired p-value. The cut-off, p, is determined from: p = i/n * q/c; where i is the current sorted sample index, n is the total number of samples, q is the desired p-value, and c is approx. equal to: 1.0/(log(cnt) + 0.5772) instead of being 1.0 Save surface-based spotlights to ASCII file A new function was added: write_spotlights which writes a single ASCII file of concatenated surface-based spotlights (vertex list for each center vertex in a label file) in the following format: #!ascii , 82934 spotlight centers, lab=/usr0/sessions/fsaverage/label/rh-MY_AREA.label, surf=rh.inflated, fillneartype=1, criterion=250 spotlight 0 vertex 3457 3456 3459 ... spotlight 1 vertex 3878 3874 3881 ... [etc, to spotlight 82933] This tcl/C function is accessible with a shift-ctrl-right-click (yup) on the "W" button on the "label:" line. The parameters to this function: 0=number, 1=area, 2=radius num vertices, area mm^2, or rad mm are interactively set by middle-clicking the N, A, or R buttons at the lower right ($fillneartype) and entering a criterion (e.g., num vtxs) in the nearby entry ($criterion): This is if you want to use the spotlights for something other than built-in tksurfer cross-correlation and retinotopy border-finding functions. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- better tcl script examples, hints ########################################################################## UPDATE: 04 Oct 2016 ########################################################################## [IN PROG] --lib/help/csurf/{csurf,rc-surfaces,rc-surface: update for GIFTI} --lib/help/tksurfer/{clks,surf,val}: update for GIFTI --lib/help/tksurfer/{clks,surf,val}: update for GIFTI --tksurfer.c: double-middle-click selects vertex and prints annot (if loaded) --tksurfer.c: double-middle-click selects vertex and prints annot (if loaded) --tksurfer.tcl: "val:" entry loads *.$hemi.*.{func,shape}.gii --csurf: load "surface:" dropdown w/non-hemi-prefixed GIFTI surfs incl flat --tksurfer.c: read_binary_values now accepts one-frame GIFTI --tksurfer.c: new/exported var, giivalframe: choose later frame in .gii valfile --tksurfer.c: if surfext is *.gii ignore/fix hemi, don't append hemi to fpref --tksurfer.tcl: "surf:" entry loads *.$hemi.*.surf.gii, no preappend hemi --tksurfer.c: read_binary_surface reads GIFTI base64/gzip (no ASCII yet) --tksurfer/Makefile: $(INC_XML), $(LIB_XML_ST), -lezxml --mk0{.csh}: compile, myinstall ezxml.{h,a} --add csurf/dist/ezxml-0.8.6.tar.gz --tksurfer.c: new #include: ezxml.h --tksurfer.c: add meminflate() for in-memory gunzip, bs64_{enc,dec}() for base64 --lib/help/tkmedit/trunc --tkmedit.tcl: shift-middle-TRUNC to countvox (white_{lo,hi}lim, to log) --tkmedit.c: add/export countvox , lims included so lo=hi OK --lib/help/tksurfer/fill: update: fillbutton, script left_click coords --lib/help/tksurfer/{label_write,fillcrit,fill2*}: update --tksurfer.tcl: 6th overload (shift-ctrl-right-clk) label "W": write_spotlights --tksurfer.c: write_spotlights: ASCII to ~/label/$hemi-Spotlights.txt for label --mk0{.csh}: dist/insttmp: lib/tcl/zz-examples/{crosscorr,renderoffscreen}.tcl --lib/help/tksurfer/script: better hints/examples --tksurfer.tcl: add arbitrFDRcovarflag tick to mid-click-"CS" popup --tksurfer.c: find_FRD_from_pvals: add nonpar FDR correct: div by log(n)+0.5772 --tksurfer.tcl: better "label:" line "C" OK help after recut sparse/uniq label --lib/help/tksurfer/smooth: document tcl wrapper ########################################################################## UPDATE: 24 Jun 2016 ########################################################################## --lib/help/tksurfer/{label_readcut,mesh}: HOWTO make/disp sparse uniqvtx labels --tksurfer.tcl: middle-click MESH toggles pointsflag --tksurfer.tcl: ctrl-left-click "C" recut label respecting normdsampuniqvtxflag ... ################################################################### UPDATE: 17 Dec 2016 ################################################################### Vertex-data-to-labels for every MGH annot region A new function, which can be accessed by a shift-ctrl-left-click on the "W" button on the "label:" line:: write_val_annotedcols_vertices writes a separate label file containing the currently displayed vertex data for each region in a currently loaded MGH annotation (e.g., HCP-MMP1). Instead of entering a full label file name, a label prefix, like: .../{lh,rh}- should be entered in the "label:" entry, which will generate a series of label files that look like this (if infix is "TEST"): .../rh-TEST_R_V1_ROI.label .../rh-TEST_R_MST_ROI.label .../rh-TEST_R_V6_ROI.label .../rh-TEST_R_V2_ROI.label [etc] Display histogram of surface data A new tcl function: print_hist <0=curv,1=val,2=amp,3=ang,4=stat> pops up histogram of current surface data (curv, val, complex ampliltude, complex angle, or stat). This requires that gnuplot is installed (in either /usr/local/gnuplot or /opt/local/bin/gnuplot). To run this from tksurfer, middle-click on the "h" button in the upper right hand corner in tksurfer to get a pop-up to select data type and adjust parameters (a default left-click on "h" pops up general tksurfer help, same as csurf: Help -> tksurfer). Fsaverage additions (fixed surfs, HCP annot) now in csurf The fixed fsaverage inflated_avg surfaces and flattenings, and the HCP parcellation as an .annot file previously distributed in separate tarfiles: fsaverage-adds.tgz (fixed inflated_avg surfaces) fsaverage-labels.tgz (HCP parcellation) are now included in the standard csurf distribution in this internal subject directory: $CSURF_DIR/subjects/fsaverage-ADDITIONS A new fixinflateavg bash script can be used to fix the N/S poles on an average surface made outside of csurf (normally this is automatically done if an average surface made with CrossSess AVGSURF button). New tcl/C function: searchlightop_val2stat This multithreaded function can perform three different operations (more planned) using a surface spotlight across the entire brain: searchlightop_val2stat fillneartype's: 0: nearest n neighbors 1: nearest up to area 2: nearest up to radius criterion's: if fillneartype=0: number of vertices if fillneartype=1: area in mm^2 if fillneartype=2: radius in mm operations's (on .val): op=0: average in searchlight ROIs op=1: count int IDs in ROIs op=2: get variance after subtr centID from neighID's The result is put into the (invisible) .stat field of each vertex. To make the result visible, click "S/V" swap the .stat and .val field, and then adjust $colscale, $fslope, and $fmid to view the result. The first operation is a simple boxcar average (N.B.: useful for very large kernels, but much slower than nearest neighbor smoothing for small kernels). The second and third operations were written for analyzing the local variance of unsupervised clustering of gray matter DTi data. Both expect positive, ordered, integer cluster IDs. Negative vertex data is ignored. The second operation counts the number of different cluster IDs in each surface searchlight ROI. The third operation calculates the variance of cluster IDs after first subtracting off the cluster ID of the searchlight center. This function is multi-threaded (8 threads) and takes about 9 min to finish on a standard cortical hemiphere surface on a 4-core i7 (the processor fans will increase their speed). It can be run by middle-clicking the SMOOTH button after loading data into the .val field (e.g., using "R" on either the "val:" or "label:" lines). An example tcl script for loading data, running the function, displaying and saving the results, and subtracting the results from two different data sets (using the new C/tcl function, subtr_valbak_from_val), is here: $CSURF_DIR/lib/tcl/zz-examples/searchlightdiff.tcl That script expects two full-brain labels containing positive integer cluster IDs ordered by similarity, and displays differences in cluster counts or cluster variance between two different clusterings. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Direct manipulation of surface much improved on MacOSX 10.10+ Tested csurf on macOS Sierra 10.12.2 Better README.txt instructions on dealing with Mac GateKeeper Update tcl/tk 8.5.17 -> 8.5.18 (can't enter bare '-'/minus in 8.5.19) New tksurfer funct: subtr_valbak_from_val(), result to .stat ########################################################################## UPDATE: 17 Dec 2016 ########################################################################## --lib/help/tksurfer/smooth: explain mid-clk-SMOOTH for searchlightop_val2stat --tksurfer.tcl: middle-click SMOOTH to get pop-up to run searchlightop_val2stat --csurf: add hist button help panel to all-help index --lib/help/tksurfer/hbutt,mk0{.csh}: new helpfile for "h" help button... --tksurfer.tcl: mid-clk upper-right "h" makes run print_hist (histogram) pop-up --tksurfer.c: print_hist(): adjustable smoothing, nbins --tksurfer.c: print_hist(): convert x-axis bin number to data value --dist: $CSURF_DIR/tiny/{NOTES.txt,tiny.c,tiny.tcl}: minimal C+tcltk test prog --tksurfer.c: subtr_valbak_from_val prints sign test counts --lib/tcl/zz-examples/searchlightdiff.tcl: another example script --tksurfer.c: omit OpenGL calls from thread (crash if no tk yet, tho single OK) --tksurfer.c: add/export subtr_valbak_from_val(), result to .stat --tksurfer.c: multithread searchlightop_val2stat (~8x faster => 10min) --tksurfer.c: searchlightop_val2stat: add variance after substr center operation --tksurfer.c: searchlightop_val2stat: add count-diff-IDs-in-spotlight operation --tksurfer.c: searchlight_val2stat (just avg) renamed: searchlightop_val2stat --mk0{.csh}: tcl/tk: regress to 8.5.18: just '-' in entry OK --mk0{.csh}: tcl/tk: found '-' in C-var float/int entry crashes 8.5.19 tk! --tksurfer.tcl: default S/V explain panel only one time (others still always) --lib/help/csurf/setupsphavg: document new loc FIX-POLES, fixinflatedavg script --lib/help/tksurfer/{label_corr,val_read}: update formats, calcvert HOWTO --csurf: fixinflatedavg: use $CSURF_DIR/subjects/fsaverage-ADDITIONS fixlabels --mk0{.csh}: dist/inst: fsaverage-{adds,labels} -> subjects/fsaverage-ADDITIONS --bin/noarch/fixinflatedavg: new bash script, add to mk0{.csh} dist/inst --csurf: fixinflatedavg: fixed curv/sulc not being written out for AVGSURF --update to tcl/tk 8.5.19, mk0 {tcltktix,progs,insttmp,dist} --mk0{.csh}: also include fsaverage-labels.tgz (HCP .annot) in dist --tksurfer.c: do_one_glx_event 2x in eventloop: fix slow direct manip on 10.10+ --tksurfer.tcl: explicit bind ButtonRelease-1 b/c break won't work in -command --tksurfer.tcl: block spaces in entered rgbnames: save_rgb_{checkfirst,named} --lib/help/tksurfer/{label,label_corr,label_write,fill2area,fill2num,fill2rad} --tksurfer.tcl: change write_spotlights => write_searchlights --tksurfer.c: change var/funct names "spotlight" to "searchlight" --tksurfer.c: add/export print_hist (curv/val/amp/ang/stat) --tksurfer.c: add/export spotlightavg_val2stat -> slow (need multithread) --tksurfer.tcl: create subject tmp dir if missing (For TmpTclScript.tcl) --lib/help/tksurfer/{label,label_readcut,label_write,label_stat}: update,fix --tksurfer.tcl: force: $hemi-: match hemi, no .label, dash, 1+ char infix --tksurfer.tcl: 7th label "W" (shift-ctrl-R-clk): write_val_annotedcols_vertices --tksurfer.tcl: mv 6th label "W" overload shift-ctrl-R-clk => shift-ctrl-M-clk --tksurfer.c: force: $hemi-: match hemi, no .label, dash, 1+ char infix --tksurfer.c: fix write_val_annotedcol_vertices label lines count --tksurfer.c: add/export write_val_annotedcols_vertices => all annot regions ########################################################################## UPDATE: 04 Oct 2016 ########################################################################## --lib/help/csurf/{csurf,rc-surfaces,rc-surface: update for GIFTI} --lib/help/tksurfer/{clks,surf,val}: update for GIFTI --lib/help/tksurfer/{clks,surf,val}: update for GIFTI ... ################################################################### UPDATE: 20 Mar 2017 ################################################################### Convert fsaverage annotation to single-subject 3D ROIs In order to take best advantage of surface-defined ROIs (e.g., HCP annotation) in 3D-based processing streams, the surface ROIs should be back-sampled to individual subject surfaces so individual subject, average-surface-defined, gray-matter-only 3D ROI masks can be defined. There is a new tksurfer tcl script, annot2roi.tcl, to automate this. The main steps are: 1) fsaverage surf annotation -> indiv subject annotation 2) annotation region -> 3D rawdata-aligned ROI The voxel size and orientation of the output mask ROI BRIK's is inherited from a functional BRIK, so there must be at least one functional BRIK set in the scandir. The mapping from fsaverage surface to 3D ROIs uses mri_surf2surf and the auto-generated sphere.reg file, and then the register.dat in the same scandir. If a scan session has been analyzed in csurf, these files will all be in place. In that case, simply display the surface with: File -> View Functional Data SURFACE-STATS and then when tksurfer opens: select "annot2roi.tcl" from the "tcl:" dropdown GO [adjust surface-normal search parms in pop-up] RUN SCRIPT The "orig" surface is near the gray/white matter boundary, so ROI voxels can be selected at various distance ranges (mm or fraction of cortical thickness) along the surface normal. The boundaries of the annotation regions can be eroded one layers of vertices at a time before the ROIs are determined ("erodesteps" parameter). The annot2roi.tcl script will generate individual-subject, rawdata-resolution ROI mask BRIKs, and save them in the current scandir for every annotation region (180 for the HCP parcellation), as well an all-regions-in-one mask ROI BRIK. To view these immediately, use the AFNI button on the View Functional Data panel. The mask BRIKs (datatype=short) contain the IDnum's of each annotation region, else 0. In the all-in-one BRIK, the last annotation region 'wins' in case of overlap. If the data has been analyzed *outside* of csurf, here are the minimal steps to set things up. This assumes you have already have a default surface reconstruction for this subject (recon-all) in SUBJECTS_DIR. File -> New Functional [cd into the image subdir of new functional] mkdir scan1 cp SomeFunctionalDataset+orig.BRIK scan1 cp SomeFunctionalDataset+orig.HEAD scan1 SessionTools -> Setup Align/Funct Scans Funct Scan Dir (top left) READ HEADER (top right) FUNCT=>SUBJ this pops up tkregister align funct->struct using COMPARE, TRANSLATE, ROTATE SAVE REG QuitFUNCT=> (purple button) Save/Close File -> View Functional Data click Render Stats Dir (top left) SURFACE-STATS [now continue as w/native csurf functional] select annot2roi.tcl from the "tcl:" dropdown GO [adjust search parms in pop-up] RUN SCRIPT Finally, the annot2roi.tcl script can be run from the command line, which won't open any windows: [setup scandir as above] cd $FUNCTIONALS_DIR//image//scripts cp $CSURF_DIR/lib/tcl/annot2roi.tcl . [uncomment, adjust parameters at top of script] tksurfer marty rh orig -tcl annot2roi.tcl 3D ROI masks from annotation region(s) now have IDnum Previously, if a 3D ROI was generated from one region in an annotation by: [click one annotation region] shift-left-click-D => make 3D ROI for one region or for all regions in an annotation by: ctrl-shift-left-click-D => 3D ROIs for all regions each output mask BRIK would contain 0/1. Now the mask BRIKs are rewritten to contain the annotation region IDnum(s). An all-in-one ROI BRIK is also generated (see above). New label/annot erosion function A new C/tcl function, annot_erode, can erode a single layer of vertices from one or more distinct colors in an annotation (e.g., the HCP parcellation displayed with "D") by setting the annotation of a vertex to zero if any of its neighbors have a different annotation value. This will also work on a single "D"-displayed label. Note that this does not do a FILL, so repeated applications of annot_erode may result in disconnected patches (probably what you want). To access this function through the tksurfer interface, type "annoterode" in the entry next to the SMOOTH button for 'smoothing steps'. Each press of the SMOOTH button erodes another layer of vertices from each annotation. See the help for the "W" button for how to write out ASCII label files containing currently displayed vertex data under one or more currently displayed annotation regions: ------------------------------------------- funct (shift-left-click): write_val_annotedcol_vertices ------------------------------------------- funct (shift-ctrl-left-click): write_val_annotedcols_vertices ------------------------------------------- New histogram options The histogram printing function has two new options: print_hist options: 0: curv 1: val 2: complex amplitude 3: complex angle ==> 4: complex angle w/complex amp > $fthresh ==> 5: complex angle w/stat > $sfthresh 6: stat It also respects ripflag, so re-cutting a label (with "label:" line "C") will restrict histogram report to that label. Sparse ('representative-vertex') labels w/fixed count The sparse/representative-vertex operation has been generalized across several functions and a new option has been added to the cross correlation popup panel ("X" button on the "label:" line) and searchlightop panel (middle-click on SMOOTH) to generate and use sparse/representative-vertex labels with a fixed number of vertices. Ticking "xcorruseuniqflag" (now re-named to more general "searchlightuniqflag") on the cross correlation or searchlightop panels causes the following operations to only use 'representative vertices' (vertex nearest average of vertices that sampled a 3D voxel): corr_over_label -- Pearson/circ searchlight corr fill_nearest_vertices -- ROI by count/area/rad write_searchlights -- write ASCII searchlights searchlightop_val2stat -- other searchlight ops Representative-vertex searchlights are created by removing non-representative vertices from the standard/dense searchlights defined by the count/area/radius criteria. A new tick in the cross-correlation and searchlightop popup panels, "numafteruniqflag", causes the criterion fillneartype=0 (count) to generate searchlights with the full requested count of vertices by extending the original area of the label until the full count is reached. This applies to all four functions above. Ticking "numafteruniqflag" has no effect on fillneartype=1,2 (area/radius) options, and is ignored unless "searchlightuniqflag" is ticked. Note that using "searchlightuniqflag" requires that you have first read in 3D data, done a PAINT operation using it (to define unique voxel IDs), and then did a UQ operation (to find the 'representative vertex' for each voxel). Here is how to do that interactively: left-click "val:" to change it to "val3d:" left-click "R" to read 3D BRIK to def uniqvox left-click "PAINT" to sample 3D data to surf and record uniqvox ids during sampling, which uses curr sample depth in L-click-"label:" popup middle-click-"UQ" to calculate/write uniq vertices or by using a tksurfer tcl script: ### read the 3D data setfile statpatt */scandir1/some3Ddata+orig.BRIK read_native_stat 0 ;# 0 means real ### set sampling parms set normdsampsearchflag 1 ;# turn on normal search set normdfracsamp 0.5 ;# begin search set normdfracmax 0.5 ;# endsearch ### sample 3D data to surface (get uniqvox) paint_surface 0 ### calculate uniq vertices using live uniq id's find_uniqsamp_vertices ### select uniq vertices select_uniqsamp_vertices ### write label to scandir (name: rh-UniqSampVtxs.label) write_uniqsamp_vertices ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- write_uniqsamp_vertices now respects ripflag (sparse in re-cut label) annot region IDnum (was just name) printed to log on click one movie360.tcl can use ffmpeg to make mp4 directly (if ffmpeg on $path) ########################################################################## UPDATE: 20 Mar 2017 ########################################################################## --lib/tcl/movie360.tcl: can use ffmpeg to make mp4 directly (if on $path) --lib/tcl/tksurfer/scripts: doc annot2roi.tcl --lib/tcl/annot2roi.tcl: new script: samp fsavg annot to sing sub, get 3D ROIs --tksurfer.c: single quote rm,>> args in system() calls (sure wildcard block) --lib/tcl/tksurfer/label_read: doc all-in-one ROI BRIK --tksurfer.c: insert_idnum() can accumulate merged all-in-one ROI BRIK --tksurfer.c: write_annotcols_timecourses_stats() makes all-in-one ROI BRIK --bin/noarch/fsavgannot2subj: sh one-liner to samp fsaverage annot to sing sub --lib/help/csurf/setupfield, lib/tcl/borders.tcl: better doc --tksurfer.c: write_annotcol{s}_timecourses_stats puts idnums into mask BRIKs --tksurfer.c: print annot region IDnum (not just annot name) to log on select --lib/help/tksurfer/label: update because couldn't find label->3DROI ("D") --lib/help/tksurfer/{smooth,smooth_steps}: update --tksurfer.tcl: SMOOTH steps field also takes "annoterode" -> run erode_annot() --tksurfer.c: add/export erode_annot() HCP parcellation or single disp label --lib/help/tksurfer/{label_corr,label_write,fill2num,smooth}: update docs --tksurfer.tcl: searchlightop panel: add searchlighuniqflag, numafteruniqflag --tksurfer.{c,tcl}: searchlight outfile: Spotlights.txt -> Searchlight.txt --tksurfer.tcl; "N" butt reports std/dense vs. uniq-by-rm vs. uniq-expand-to-N --tksurfer.c: searchlightuniqflag/numafteruniqflag: searchlightop_val2stat_th --tksurfer.c: searchlightuniqflag/numafteruniqflag: fill_nearest_vertices --tksurfer.c: searchlightuniqflag/numafteruniqflag: write_searchlights --tksurfer.c: searchlightuniqflag/numafteruniqflag: corr_over_label --tksurfer.tcl: xcorr: xcorruseuniq->searchlightuniqflag, add numafteruniqflag --tksurfer.c: xcorruseuniqflag -> searchlightuniqflag, export numafteruniqflag --tksurfer.c: write_uniqsamp_vertices now respects ripflag (for re-cut label) --lib/help/tksurfer/val3d_read: HEAD -> BRIK in example --csurf: add $hemi.surftmp* to surfaces dropdown (like tksurfer, tkmedit) --lib/help/tksurfer/comp_grad: doc dilate, 3D arrow heads --lib/help/tksurfer/hbutt: doc new options --tksurfer.tcl: histctrls: two new options on popup sensitive to (s)fthresh --tksurfer.c: new print_hist ops: (4)ang if amp>fthresh (5)ang if stat>sfthresh --tksurfer.c: print_hist respects ripflag --tksurfer.tcl: histctrls: preset complex ang option=3 if complexvalflag ########################################################################## UPDATE: 17 Dec 2016 ########################################################################## --lib/help/tksurfer/smooth: explain mid-clk-SMOOTH for searchlightop_val2stat --tksurfer.tcl: middle-click SMOOTH to get pop-up to run searchlightop_val2stat --csurf: add hist button help panel to all-help index --lib/help/tksurfer/hbutt,mk0{.csh}: new helpfile for "h" help button... --tksurfer.tcl: mid-clk upper-right "h" makes run print_hist (histogram) pop-up --tksurfer.c: print_hist(): adjustable smoothing, nbins --tksurfer.c: print_hist(): convert x-axis bin number to data value ... ################################################################### UPDATE: 21 Jun 2017 ################################################################### Can dump .val's just from borders of displayed labels If $annotbordflag is ON (shift-middle-click the far left tick on the "label:" line), then the functions that dump current surface data .val's from a displayed annotation (one or more single labels displayed with "D", or one or all MGH annotations also displayed with "D") will only dump the border vertices of each label: regular labels: ------------------------------------------- shift-middle-click "label:" line "W": write_val_annoted_vertices ------------------------------------------- MGH annotations: ------------------------------------------- shift-left-click "label:" line "W": write_val_annotedcol_vertices ------------------------------------------- shift-ctrl-left-click "label:" line "W": write_val_annotedcols_vertices ------------------------------------------- Count neighbors of each annotation area (tksurfer) The number of other annotation areas bordering each area in the annotation can be counted with: ------------------------------------------- ctrl-middle-click "label:" line "D" count_mgh_annot_neigh2stat ------------------------------------------- The integer result is stored vertexwise in the .stat field (overwrite warning if .stat loaded), and also written by annotation field to an ASCII table in subject's scripts dir: AnnotRegionsNeighborCounts.txt which also includes the IDnums of the neighboring areas for each area. Requires that an MGH annotation file has first been loaded. Spherical Gaussian hand normalization (tkmedit) An option was added (middle-click the tkmedit F3 panel "sph" tick) to hand normalize a spherical region around a point using a Gaussian-like curve (instead of the default linear ramp). Pixels at the center are multipled by $ffrac0, with that factor falling off to no-change at a radius of $lim0. The FWHM of the Gaussian is: 0.36198 * $ffrac0. Transfer previous wm edits to a new wm (tkmedit) In the course of a manual reconstruction, after already having edited a white matter (wm) data set, you may want to go back and make additional local hand-normalization steps in order to regenerate the wm data set (e.g., using local spherical Gaussian: "sph" tick in F3 panel), but without losing the extensive edits made so far. A new function, im2wmedits_to_im(), was added to tkmedit to do this and bound to the COMPARE button. Copy the previously edited wm.mgz file to a different name (e.g., wm-old.mgz), remake wm.mgz, load old wm-old.mgz as the second image set with the "R" button on the "im2:" entry, and finally do shift-middle-COMPARE. This will copy only previously edited pixels (pix=1, pix=255) to the wm.mgz in the editable buffer. This can then be saved in the usual fashion (SAVEIMGS button). To summarize: (0) already did many edits on wm.mgz (1) copy prev edited wm.mgz aside to wm-old.mgz (2) hand normalize, remake wm.mgz, load it (3) load wm-old.mgz into "im2:" w/"R" (4) shift-middle-COMPARE (5) SAVE IMGS Flip from CORONAL view popup (tkmedit) An new overload was added to the CORONAL button, middle-click-CORONAL. This first forces view to CORONAL, then pops up a panel that allows performing one of the 48 different possible 3D transposes on the data in the editable buffer using the C/tcl function: flip_corview_xyz. Among (many) other things, this can mirror-image the data set. New standard script: searchlightdiff.tcl (tksurfer) The script, searchlightdiff.tcl, has been added to the set of standard scripts. Running it interactively from the "tcl:" dropdown in csurf first generates a pop-up to adjust parameters. Clicking "RUN SCRIPT" first runs full-hemisphere searchlight operation on two sets of full-hemisphere, real-valued data: Searchlight operations: 0 -> average of searchlight data 1 -> count num classes (assumes integer data) 2 -> variance of searchlight data and writes out the results as two labels. These multithreaded operations take about 10 min/hemisphere on an Intel i7. Then, the first searchlight result is then subtracted from the second searchlight result and saved as a third label. The size, ${num,sqmm,mm}, of the approximately geodesic surface searchlight circles can be specified by vertex count, area, radius, or by neighbor order (1=immediate neighbors, 2=also include neighbors of neighbors, etc): Searchlight size ($fillneartype): 0 -> num vertices 1 -> area (in mm^2) 2 -> radius (in mm) 3 -> neighbor order (1-6) The first three searchlight types use the C/tcl function, searchlightop_val2stat (multi-threaded), while the fourth type uses the new C/tcl function, neighop_val2stat (similar result for similar vertex count, goes up to 6th-order neighbors, which is 127 vertices on fsaverage). Adjustable parameters can be hard-coded in the script in order to run it non-interactively from the command line as a tksurfer tcl script. ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Fix accidentally disabled PF, PFGAU buttons tkmedit (broken Apr 2016!) Fix off-edge array access on click Unknown region (white) with MGH annotation loaded fix crashing second malloc/free in searchlightop_val2stat_th() thread more info in double-middle-click annotation region pop-up fix error in GR error popups ########################################################################## UPDATE: 21 Jun 2017 ########################################################################## --tksurfer.c: count_mgh_annot_neigh2stat() also prints neigh IDnums to outfile --tkmedit.tcl: before flip, if not CORONAL, warn/force CORONAL/center --tkmedit.c: ptype errors, un-global/clean-up impt,ipt,jpt --tkmedit.c: goto_point_coords->goto_point_zcoords, unzoomed: goto_point_coords --csurf: add tkmedit CORONAL/SAGITTAL/HORIZONTAL to all help window --lib/help/tkmedit/{hbutt,coronal,sagittal,horizontal}: new help, update mk0* --tkmedit.tcl: overload "CORONAL" butt (mid-click) with flip_corview_xyz popup --tksurfer.tcl: fix GR button error popup bug, manually bind avoids dup L-*-clk --lib/help/csurf/csurf: more script help, document csurf tclenv mechanism --lib/help/tksurfer/label: update --lib/help/tksurfer/label_read: update --tksurfer.tcl: count_mgh_annot_neigh2stat: ctrl-mid-clk-D, warn no-annot/.stat --tksurfer.tcl: bind ctrl-middle-click-D to count_mgh_annot_neigh2stat --tksurfer.c: add/export count_mgh_annot_neigh2stat(), write scriptsdir file --tksurfer.c: annot2brainregionindex() (localizes above) --tksurfer.c: catch off-edge on double-middle-click popup annot region/color --tksurfer.c: do_one_glx_event: double-mid-clk also pops up D'd plain label col --lib/help/tksurfer/label: another doc of double-mid-click popup annot name/col --tksurfer.c: neighop_val2stat(): add 6th order (still useable: ~3min) --searchlightdiff.tcl: also support neighop_val2stat (fillneartype=3) --tksurfer.c: neighop_val2stat() for 1st-5th order neigh (req'd same alloc fix) --tksurfer.c: count_neigh_ids2stat() for 1st to 5th order neigh (req'd samefix) --mk0{.csh}: add searchlightdiff.tcl to standard scripts --lib/tcl/searchlightdiff.tcl: new standard lib script --tksurfer.c: fix free(hist) crash in searchlightop_val2stat_th() w/simple alloc --tksurfer.c: searchlightop_val2stat_th(): if (SLOPCNT) -> if (optype==SLOPCNT) --tksurfer.c: write_val_annoted_vertices: fix write all bug, resp annotbordflag --lib/help/tkmedit/smoothstats: update to mk alt options parallel --lib/help/tkmedit/{compare,wmtrunc,wmfilterstd,wmfiltergau}: update,mkparallel --tkmedit.tcl: overload "COMPARE" button (shift-mid-click) with im2wmedits_to_im --tkmedit.c: im2wmedits_to_im(): apply im2 WM_EDITED_OFF=1,WM_EDITED_ON=255 ->im --lib/help/tkmedit/wmtrunc: make apply trunc, tclfunct help parallel to PF{GAU} --tksurfer.c: print AnnotStruct: catch off-edge array access if Unknown region --lib/help/tksurfer/label_read2val: explain complex, funct name typo shift-mid --lib/help/tkmedit/sphnorm: doc Gaussian spherical option for $sphnormflag --tkmedit.tcl: M-clk overload "sph" tick w/$gaussnormflag autoset $sphnormflag --tkmedit.c: if gaussnormflag (and sphnormflag), linear->Gaussian profile --tkmedit.tcl: better log commands for hand normalize, regular and sphere norm --tksurfer.tcl: write_val_annoted{col,cols}_vertices: warn if $annotbordflag ON --tksurfer.c: write_val_annoted_vertices: fix write all bug, resp annotbordflag --tkmedit.tcl: fix run_wmfilter non-combo entry get (PF,PFGAU disabled Apr2016) --lib/help/tksurfer/label_write: update --tksurfer.c: write_val_annotedcol{s}_vertices respect annotbordflag ########################################################################## PREVIOUS UPDATE: 20 Mar 2017 ########################################################################## --lib/tcl/movie360.tcl: can use ffmpeg to make mp4 directly (if on $path) --lib/tcl/tksurfer/scripts: doc annot2roi.tcl --lib/tcl/annot2roi.tcl: new script: samp fsavg annot to sing sub, get 3D ROIs --tksurfer.c: single quote rm,>> args in system() calls (sure wildcard block) --lib/tcl/tksurfer/label_read: doc all-in-one ROI BRIK --tksurfer.c: insert_idnum() can accumulate merged all-in-one ROI BRIK --tksurfer.c: write_annotcols_timecourses_stats() makes all-in-one ROI BRIK --bin/noarch/fsavgannot2subj: sh one-liner to samp fsaverage annot to sing sub --lib/help/csurf/setupfield, lib/tcl/borders.tcl: better doc --tksurfer.c: write_annotcol{s}_timecourses_stats puts idnums into mask BRIKs --tksurfer.c: print annot region IDnum (not just annot name) to log on select --lib/help/tksurfer/label: update because couldn't find label->3DROI ("D") ... ################################################################### UPDATE: 18 Oct 2017 ################################################################### Fix buffer overflow w/large rawdata vals (fourier) The program, fourier, used by the csurf FOURIER button, was originally designed to read short (2-byte) data. In Apr 2014, fourier was extended to be able to read FLOAT BRIK's, but it was still reading them into a short buffer, which could result in overflows with FLOAT BRIK's containing large (>32768) raw data values. This localized problem has now been fixed. Better direct manipulate on Mac (tksurfer) The responsiveness of the direct manipulation of the surface (shift-click-drag in surface window) was greatly improved on Mac OS X 10.10+. HOWTO make AFNI utilities work on Ubuntu 16.04 Ubuntu 16.04 is missing libXp, a tiny X11 library for printing, which is required/linked by AFNI utilities included in this distribution. Since AFNI utilities (e.g., 2swap) are used in several key places, the missing libXp will disable many basic operations in csurf. The libXp shared lib isn't available in the 16.04 archives, so here is how to install the working version from Ubuntu 15. Get the .deb file from one of these places: https://launchpad.net/ubuntu/+archive/primary/+files/libxp6_1.0.2-2_amd64.deb http://www.cogsci.ucsd.edu/~sereno/.tmp/dist/csurf/libs/libxp6_1.0.2-2_amd64.deb Install it like this: sudo dpkg -i libxp6_1.0.2-2_amd64.deb At startup, csurf now checks if this critical component is missing (if Debian or Ubuntu) and explains how to install it. Fix disappearing surface on Ubuntu 14.04/16.04 On Ubuntu on some machines but not others, the cortical surface can disappear the first time you click on it. To guarantee that this doesn't happen, the csurf interface now passes -doublebufferflag 0 to tksurfer (same as: csurf -> Preferences -> unclick Double Buffer). Manipulation still appears double-buffered (no tearing). If you have this problem, when calling tksurfer from the command line, add that flag as follows: tksurfer marty rh smoothwm -doublebufferflag 0 Tested for Ubuntu 14.04 and 16.04. Open terminal in current subject or session scripts dir For quicker access to the command line in the scripts dir of the current subject or session, two new "File" menu items were added: Terminal -> Subject Scripts Terminal -> Functional Scripts Display label/annotation borders with white dots. A ctrl-shift-mid-click on the unlabeled tick next to "label:" toggles between the standard annotation borders (1-face-wide border around each region) and 1-pixel dots at border vertices, which will occlude less of the underlying data. To make the one-pixel dots less prominent, increase the resolution of the standard 600x600 pixel window with "winxy:" at the lower right. Finally, the density of the dots can be pruned with a ctrl-shift-right click on the same tickbox (C/tcl funct: prune_annotbord) after they have been displayed. Write out tksurfer surface/colors in glTF format Csurf surface geometry and current surface color can now be exported to a binary, glTF 2.0 format file ("GLB" button at top right of the fn-F3 panel). The glTF format (GL Transmission Format) is an API-neutral format for runtime delivery (loading and transmission) of 3D surface data. The goal of the format is improved intercommunication between 3D content creation programs as well as efficient loading of 3D data into WebGL browsers. The format specification can be found here: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0 It is further explained in the the R-click help for the "GLB" button on the [fn-]F3 tksurfer panel. Not yet extensively tested :-} ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- Compiled a dist for PPC Mac :-} fourier can operate on one column of ASCII rawdata data ########################################################################## UPDATE: 18 Oct 2017 ########################################################################## --tksurfer.tcl auto-append .asc/.vtk/.off/.stl/.glb: testreplace warn overwrite --lib/help/tksurfer/outsurfglb_write: update --tksurfer.c: write_glb_surface(): uses curr displayed/cached colors --tksurfer.tcl: add ctrl-shift-right-click prune_annotbord overload label tick --tksurfer.c: prune_annotbord() if neigh annotbord's >= total neighbors-1 (OK) --lib/help/tksurfer/label_toggle: update --tksurfer.tcl: add ctrl-shift-mid-click $annotborddotflag overload label tick --tksurfer.c: add annotborddotflag (add white dots on label border vertices) --mk0{.csh}: insttmp: AFNI-req'd libXp .deb in $CSURF_DIR/lib/deb for user inst --dist/precompiled/deb/{libxp6_1.0.2-2_amd64.deb,libxp6_NOTES.txt} --fourier.c: read rawdata float BRIK to floatbuff to avoid >32768 overflow --fourier.c: block non-power of 2 (until convert to fftw.c) --fourier.c: new option -1D to process 1 col in ASCII timecourse table --fourier.c: if no -freqsurr (not req'd arg!), set def hifreq -1 => Nyquist --lib/help/tksurfer/save_pnt: update help --tksurfer.c: SEND/find_orig_vertex_coordinates reports midpnt curr normsearch --csurf: add GLB (glTF output) button to all-help panel --lib/help/tksurfer/outsurfglb_write: new help file, update mk0* --tksurfer.tcl: add GLB (glTF output) output button on fn-F3 panel --tksurfer.c: add write_glb_surface(): write binary glTF (*.glb) surface --wrappers.tcl: positionpopup can now just return position --csurf: File menu items to open xterm/gnome-terminal in subj/sess scripts dir --nmovie.c: fix byte-swapped *.rgb image in 10.4 --csurf: if Ubuntu/Debian, use ldd to check of libXp missing, warn/explain fix --wrappers.tcl: def testclose (usu. overwritten) so kill win w/just wrappers.tcl --csurf: improved cmdline help, --f OK too (force start csurf from Mac Terminal) --csurf: explicit tixSelect -padx 11 (fix VBOX update def reset "Views: lat..") --FreeSurfer.csh: failed try to mk ppc bins run on x86: would req ship ppc X11 --lib/help/tksurfer/arrownorm: better doc of constant-length gradient arrows --csurf: missing env var better error: both tcsh (setenv) and bash (export) --tksurfer.c: call do_one_glx_event 10x -> much better 10.10+ responsiveness --tksurfer.c: do_one_glx_event() -> do_all_glx_events(): "if" -> "while" ########################################################################## PREVIOUS UPDATE: 21 Jun 2017 ########################################################################## --tksurfer.c: count_mgh_annot_neigh2stat() also prints neigh IDnums to outfile --tkmedit.tcl: before flip, if not CORONAL, warn/force CORONAL/center --tkmedit.c: ptype errors, un-global/clean-up impt,ipt,jpt --tkmedit.c: goto_point_coords->goto_point_zcoords, unzoomed: goto_point_coords --csurf: add tkmedit CORONAL/SAGITTAL/HORIZONTAL to all help window --lib/help/tkmedit/{hbutt,coronal,sagittal,horizontal}: new help, update mk0* --tkmedit.tcl: overload "CORONAL" butt (mid-click) with flip_corview_xyz popup --tksurfer.tcl: fix GR button error popup bug, manually bind avoids dup L-*-clk ... ################################################################### UPDATE: 25 Jan 2018 ################################################################### SHRINK, REG parameters documented 36 new tksurfer helpfiles (R-click help for bottom of tksurfer large F3 panel) were added documenting adjustable parameters for SHRINK (shrink, area_shrink, shrink_2d, etc) and REG (sphere_morph, including data/map-influenced morph). Display vertex normals in tksurfer A control-middle click on the tixbox at the bottom of the phasecontours box ("phc") toggles display of vertex normals as yellow lines with ball ends. The adjoining entry controls the normal line length (default=2.0). This turns the brain into a hairbrush :-} At initial magnification, the high density of the vertex normals will merely turn the brain yellow. You have to zoom in a lot to be able to see the individual normals. Divergent/Convergent stereo display A middle-click on the REDRAW button toggles between normal and divergent stereo viewing. The brain is drawn twice, side-by-side, for stereo viewing by divergent fixation. That means, left copy is viewed by left eye, and right copy is viewed by right eye. You can also tape a Google Daydream to the screen to make fusion easier... A shift-middle-click on REDRAW toggles convergent (cross-eyed) stereo. In this case, the right eye looks at the left copy and vice versa. Because convergent eye position normally goes with close-up focus, some people find this method of free viewing easier to achieve (not for stereo glasses). It is easiest to achieve stereo fusion when there is single high-contrast target (e.g., brain at initial magnification), but it is harder to make out details that way. If you zoom (shift-R-click drag up/down) after fusing, you won't break stereo fusion. To do that, have your left finger on the shift key *before* you fuse, since you will break fusion if you look away at the keyboard. Stereo viewing is particularly good for appreciating the orientation of the surface normal display, and for inspecting the extremely complex shape of sulci in folded view. Make exploding brain movie New tcl script, $CSURF/lib/tcl/explodemovie.tcl, to explode current surf/hemi and save tiff movie frames. This is original cortex explosion that was presented at SFN 1992 in Anaheim (yup). ----------------------------------------------- Bug fixes, small changes ----------------------------------------------- locklabelflag also affects sphere_morph() allow change arrow/normals diameter allow change stereo rotation degrees ########################################################################## UPDATE: 25 Jan 2018 ########################################################################## --lib/help/tksurfer/redraw: update --tksurfer.c: fix stereo cursor, export stereo_rot_deg --tksurfer.tcl: shift-middle-click REDRAW toggles convergent stereo --tksurfer.c: add/export convergentflag for convergent stereo --tksurfer.tcl: middle-click REDRAW toggles stereoflag --tksurfer.c: add/export stereoflag: divergent stereo by rotate 4 deg --tksurfer.tcl: Shift-Return in $arrowscale entry also sets $arrowline to val --lib/help/tksurfer/arrownorm: update --tksurfer.tcl: 3rd overload tick bott phasecontour box: toggle display normals --tksurfer.c: add/export normalsflag/arrowline, allow draw vtx normal vectors --csurf: add 36 new helpfiles to All Help Contents --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{wcrv,wsta,wcpx,wa,wbn} --tksurfer.tcl: rearrange widgets in 3 rows: self/selfd/ck3rd/ar/2d/ck3:{lo,hi} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{cthk,whitemid,graymid} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{mstrength,mslope} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{expand,explode} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{update,decay,momentum} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{ncthr,ncthr_ck} --tksurfer.c: locklabelflag also affects sphere_morph() --tksurfer.tcl: add bindings for 14 new F3 help panels --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{locklabel} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{selfd,areaflag,2dflag} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{clearself,writeself} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{ckself,ckfill,ckgr,ck3rd} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{ws,wn} --tksurfer.tcl: forcemode errors (on ) --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{forcemode,shrink_mmid} --lib/help/tksurfer, mk0{.csh}: add helpfiles: shrink_{steps,cyc,ckMRI,adj} --lib/help/csurf/spheresurface: add dist/parea/corr parameter explanations --lib/tcl/explodemovie.tcl, add to mk0{.csh} --tksurfer.c: fix explodeflag (by ripfaces), expandflag force: 0.1->$mstrength --lib/help/tksurfer/outsurf: update for new output formats --lib/help/csurf/{rc-surfaces,rc-subjects,rc-SURFACE}: help update --csurf: load non-pre-appended *.vtk, catch/warn on click SURFACE (CHROMA) ########################################################################## PREVIOUS UPDATE: 18 Oct 2017 ########################################################################## --tksurfer.tcl auto-append .asc/.vtk/.off/.stl/.glb: testreplace warn overwrite --lib/help/tksurfer/outsurfglb_write: update --tksurfer.c: write_glb_surface(): uses curr displayed/cached colors --tksurfer.tcl: add ctrl-shift-right-click prune_annotbord overload label tick --tksurfer.c: prune_annotbord() if neigh annotbord's >= total neighbors-1 (OK) --lib/help/tksurfer/label_toggle: update --tksurfer.tcl: add ctrl-shift-mid-click $annotborddotflag overload label tick --tksurfer.c: add annotborddotflag (add white dots on label border vertices) --mk0{.csh}: insttmp: AFNI-req'd libXp .deb in $CSURF_DIR/lib/deb for user inst --dist/precompiled/deb/{libxp6_1.0.2-2_amd64.deb,libxp6_NOTES.txt} --fourier.c: read rawdata float BRIK to floatbuff to avoid >32768 overflow ... ################################################################### UPDATE: 21 Jun 2018 ################################################################### Improved annot2roi.tcl script This script provides a way to gain most of the advantages of individual surface-defined areas (e.g., from the HCP parcellation), while still mostly operating in 3D. This script first resamples an fsaverage annotation (e.g., HCP-MMP1) to an individual subject surface, then makes single-subject 3D ROIs from it. The popup now has a dropdown to simplify picking an fsaverage annotation to resample, and the script is better documented in the R-click help to the "tcl:" entry. The default is now to *not* to go all the way to making single-subject AFNI 3D ROIs, but instead, only to resample the selected fsaverage annotation to the current subject. A tickbox on the pop-up enables the adjustable parameters (e.g., normal search limits) for making the AFNI 3D ROIs. Display .annot file as colored ribbon on 2D slice The SURFPAINT panel on the large [fn]-F4 interface of tkmedit can display an MGH annotation as a colored ribbon on a 2D slice. This extends the previous facilities for displaying curvature (curv, sulc) and fieldsign as a colored cortical ribbon on a 2D slice. Any .annot file in the current subject's label directory will be loaded into the "annot:" dropdown. A new "an:" entry (just right of SURFPAINT), allows displaying only one annotation region (picked by its idnum) at a time. To find the idnum of an annotation region, display all the regions on the surface in tksurfer and double-middle-click one to get a pop-up. A complete table of idnums (and their names and colors) is also printed in the tkmedit log when the annotation file is first read. The cursor will move to the average position of surface vertices in this annotation region. The default is -1, which means, show all annotation regions. Region 0 is Unknown. A too-high idnum shows all regions. De-mean and variance-normalize vtx .val data An alternate middle-click on the "R" button on the "val:" line reads vertexwise data into the .val field, (like a default left-click on "R"), but then also subtracts the mean and divides by the standard deviation using the C/tcl function: demean_varnorm_val That operation only applies to currently visible (uncut) data, so that the mean and stdev can be constrained to any surface region. A related function is: meanamp2one_valval2 which scales the average complex amplitude of displayed complex data to 1. ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- tkregister.c doesn't biff existing register.dat w/tkregister 1.mgz 2.mgz better logic for REDRAW button turn on/off stereo viewing better err/explain Mac10.11+ env problems w/tksurfer etc in Mac shell script ########################################################################## UPDATE: 21 Jun 2018 ########################################################################## --csurf: explicit -padx 11 fixes Linux extra-wide "Slice Ord" tixSelect --lib/help/csurf/tk{surfer,medit,register,strip}: Mac shellscript help --tkregister.c: check/explain/exit DYLD_LIBRARY_PATH unset,maybe Mac shellscript --tkmedit.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript --tksurfer.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript --csurf: CSURF_LIBRARY_PATH not set err before load tix (print after load fail!) --csurf: "csurf -h" err if CSURF_LIBRARY_PATH not set --lib/help/csurf/setupfour: clarify that 3D and surfcluster different --lib/help/tksurfer/script_annot2roi: new R-click help popup (cp from scripts) --lib/help/csurf/tkregister: update w/simple usage (tkregister s1.mgz s2.mgz) --tkregister.c: read (don't biff) existing register.dat: tkregister 1.mgz 2.mgz --lib/help/tksurfer/val_read: update --tksurfer.tcl: shift-middle-click-R "val:" read cpx, scale mean complex amp->1 --tksurfer.c: add meanamp2one_valval2() --lib/help/csurf/tksurfer: update update GLX window clicks in 'h' help --lib/help/tksurfer/{arrownorm,redraw}: update --tksurfer.tcl: rm REDRAW diverge/converge stereo toggles, left-click stereo off --csurf: setupscans updates scandir entry on go back and show first page --csurf: tksurfercmd: guess 1st funct for annot2roi (req's 1 SessionTools open) --csurf: tksurfercmd: fix SURFACE button crash on initially empty $iscandir --lib/tcl/annot2roi.tcl: fix bug in errcheck blocking resample surf->3D --lib/tcl/annot2roi.tcl: allow re-use existing resampled annot --lib/tcl/annot2roi.tcl: fix var cleanup in case no *.annots --lib/tcl/annot2roi.tcl: one panel only (raise existing) --csurf: SURFACE passes curr csurf iscandir tail (e.g., image/pol1) to tksurfer --lib/help/tksurfer/script: add minimal HOWTO for annot2roi.tcl register.dat --csurf: fix crash on Make Scandirs, Find Copy Raw w/invalid session --lib/tcl/annot2roi.tcl: better session/scandir/rawdata/regdat errcheck --lib/help/tksurfer/val_read: update --tksurfer.tcl: middle-click-R on "val:" line does demean,varnorm after read --tksurfer.c: add demean_varnorm_val() --lib/help/tksurfer/surf: better help for not-visible-here F3 write surface --lib/help/tksurfer/scripts: add non-interacive command line script example --lib/help/tksurfer/outsurfoff_write: add Mathematica import example --dist/patch/mpeg_play-2.3/Makefile: add: -I/usr/X11/include, -L/usr/X11/lib --lib/help/tksurfer/annot: new helpfile, add to mk0{.csh}, csurf all-in-one --tksurfer.tcl: *shift*-right-click help overload (annot summary label entry) --tksurfer.tcl: first shift-R-click help (2nd helpfile for interface item) --tkmedit.tcl: make "annot:" a live-loaded combo dropdown --tkmedit.tcl: in $oneidnum uses goto_idnum() --tkmedit.c: add/export goto_idnum() -> goto average position of a brainregion --csurf: add tkmedit surfpaint to all-help panel, and mk0{.csh} --lib/help/tksurfer/surfpaint: update --tkmedit.tcl: "an:" entry to allow draw only one annot idnum --tkmedit.c: add/export $oneidnum to draw only one annot idnum --csurf: VOLUME-STATS can open no-functs fs scandir for F4 tkmedit SURFPAINT --tkmedit.tcl: warn no surface for SURFPAINT curv/fs/annot --tkmedit.tcl: add "annot:" READ: read_mgh_annot --tkmedit.tcl: put "fm:" READ function into "fs:" READ like tksurfer --tkmedit.c: add/export read_mgh_annot(), fix flags, draw_surface() can use --tkmedit.c: add brainregion struct, vertex.annot --searchlightdiff.tcl,annot2roi.tcl: log commands (incl eval exec's) --annot2roi.tcl: load fsavg annot dropdown, better err chk, ask overwrite --dist/fsaverage-ADDITIONS.tgz: remake/upload tarfile to incl new README.txt --dist/fsaverage-ADDITIONS/scripts/README.txt: update/upload for single-sub HCP --lib/help/tksurfer/{scripts,label,label_read}: updates for single-sub HCP --annot2roi.tcl: option to return after just resamp fsavg annot to this subject --tksurfer.c: translate zoomed stereo for less nonoverlap [redist as 180125] ########################################################################## PREVIOUS UPDATE: 25 Jan 2018 ########################################################################## --lib/help/tksurfer/redraw: update --tksurfer.c: fix stereo cursor, export stereo_rot_deg --tksurfer.tcl: shift-middle-click REDRAW toggles convergent stereo --tksurfer.c: add/export convergentflag for convergent stereo --tksurfer.tcl: middle-click REDRAW toggles stereoflag --tksurfer.c: add/export stereoflag: divergent stereo by rotate 4 deg --tksurfer.tcl: Shift-Return in $arrowscale entry also sets $arrowline to val --lib/help/tksurfer/arrownorm: update --tksurfer.tcl: 3rd overload tick bott phasecontour box: toggle display normals --tksurfer.c: add/export normalsflag/arrowline, allow draw vtx normal vectors --csurf: add 36 new helpfiles to All Help Contents ... ################################################################### UPDATE: 08 Feb 2019 ################################################################### ---------------------------------------------- Illuminate inside of a surface ---------------------------------------------- The inside of a surface (backside of a flat patch), which is rarely visible, is not normally lit. To illuminate the inside of a surface, use ctrl-middle-click-REDRAW. This is now automatically done when using PLANE to cut a surface, and it useful in other rare circumstances (e.g., better view of a cut, folded cerebellar surface :-} ). ---------------------------------------------- Display MGH 3D segmentation colors in tkmedit ---------------------------------------------- The standard 6-column MGH FreeSurfer color lookup table (idnum, name, r, g, b, a) is now used in tkmedit to display MGH 3D segmentation labels (either byte or int) in their proper colors: $CSURF_DIR/lib/lut/FreeSurferColorLUT.txt The color table is read, sorted, and loaded by new C/tcl function, read_sort_mghval2rgblut. The existing csurf function, read_val2rgblut, which reads 4-column csurf color tables designed for color interpolation of overlay stats (value, r, g, b), defaults to the new function if it detects the standard name above. This all occurs automatically when an MGH segmentation file (e.g., aseg+aparc.mgz) is selected in the "im2:" entry dropdown and read using the adjoining "R". Once read, a double-middle-click on the image window displays the name, idnum, and rgb of a labeled region. The "la" tickbox toggles the visibility of the label overlay. The "tran:" entry on the large F4 tkmedit interface ([fn]-F4 in the tkmedit buttons window) controls the label transparency (default is 127, which is 50%). ---------------------------------------------- Dump timecourses using MGH 3D segmentation in tkmedit ---------------------------------------------- A new tkmedit C/tcl function: write_segid_timecourses dumps rawdata timecourses for an MGH FreeSurfer segmentation region (idum). After opening a rawdata-containing scan using VOLUME-STATS, read a segmentation file, enter the idnum of a region in the "roiup:" entry, and middle-click the "T" button. This generates an ASCII file, for example, segid-12120.raw containing the time courses of any rawdata voxels in that region. This file also includes the number of 'hits' for each voxel (since the rawdata voxels are typically larger than 1x1x1mm segmentation voxels). ---------------------------------------------- Dump all MGH 3D segmentations to BRIK ---------------------------------------------- A new tkmedit C/tcl function: write_allsegids creates an AFNI BRIK containing the int idnums from every 3D region in the currently loaded MGH FreeSurfer segmentation. This BRIK has the resolution of the underlay (typically 1x1x1mm). ---------------------------------------------- Temp fix for tksurfer going black after first click ---------------------------------------------- On a default CentOS 7 install, with onboard unaccelerated graphics libs, tksurfer goes black after the first click on the surface, afterwards only showing the selected vertices. As a tmp fix, in this case, csurf starts up tksurfer (on 3.0+ kernel Linux) in singlebuffer mode, which will still look doublebuffered :-} For tksurfer started from the command line, fix this problem by turning off doublebuffering with an option (argument is a "zero") as follows: tksurfer -doublebufferflag 0 [-opts ...] Better fix in progress! If the 'intelligence' in csurf (e.g., OK to use doublebuffer if nvidia driver found to be in use) makes the wrong choice (e.g., still black screen, or alternatively, you see the redraws when you move the brain), you can force csurf to use single- or double-buffered startup of tksurfer with: csurf -sb csurf -db ---------------------------------------------- Linux fonts fixed ---------------------------------------------- The unpleasant looking (to me!) default Linux fonts in csurf, tksurfer, tkmedit, and tkregister are now finally fixed (made the same as on Mac). The nicer looking fonts are slightly larger and easier to read than before. In the unlikely event you like the way they looked before, to go back, find the following line in your FreeSurferEnv startup script: FreeSurferEnv.sh => #skipfontsflag=1 FreeSurferEnv.csh => #set skipfontsflag = 1 and comment it in (rm the '#'). ---------------------------------------------- Display color phase contour over dark overall activation ---------------------------------------------- The original phasemovie.tcl shows a moving phase contour in white over the colored phase map. The phasemovie.tcl script popup can now invert this. Ticking colphasecontourflag on the popup (which sets $colphasecontourflag to 1) causes the phase stripe to be colored (with its usual phase color) while the remainder of the activation that is not at the (adjustable) phase range of the stripe is given the same color controlled by the variable $phasecontour_bright. This is like movie in Chen, Kreutz-Delgado, Sereno, Huang (2018). To make the moving colored phase stripe clearly visible, use a dark color for the overall activation (phasecontour_bright = 20; this is autoset when colphasecontourflag ticked). ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- add tksurfer -justheaderflag (after mris_info OS crash on read cereb) tksurfer/tkmedit upper-left "i" buttons to control interface size Patch tk raise command for Linux (raise tools win w/double-clk surf win) CentOS 5 -> was fail CentOS 6 -> was fail CentOS 7 -> was fail w/giant, empty, upper-right popup fixed FRED_TONO wraparound bug many small helpfile updates all standard tcl scripts now have R-click help from popup fix bash navigation aliases (e.g., cds => cd to subject's scripts) new function: norm_move_vertices_fracthick README.txt note: explain HOWTO shrink stupid-big Gnome window title bars README.txt note: explain HOWTO stop Gnome auto-maximize ########################################################################## UPDATE: 08 Feb 2019 ########################################################################## --lib/help/tkmedit/roiup_write: update --tkmedit.tcl: overload "W" button on "roiup:" line with write_allsegids --tkmedit.c: add write_allsegids --csurf: fix afni crash new Mac: add DYLD if exists /opt/X11/lib/flat_namespace --lib/help/tkmedit/roiup_time: update --tkmedit.tcl: overload "T" on "roiup:" line to run write_segid_timecourses --tkmedit.c: add write_segid_timecourses (first load segmentation) --csurf: block all abspath paradigmdir's in deconvcmd, rawaveragecmd (concat) --lib/help/csurf/setuprand: suggest only stim1Ds dir inside each scandir --FreeSurferEnv.{c}sh: Mac: if exists /opt/X11/lib/flat_namespace add to DYLD_ --tkregister.tcl: fix cmd typo disabling SAGMIRR! (showvisble -> showvisible) --tkmedit.c: thin gray dividers for all3views --tksurfer.tcl: "clo" button R-click help --tkmedit.c: thin gray dividers for all3views --csurf: add "clo" tickbox help to csurf allhelp panel --lib/help/tksurfer/selectdmax: new helpfile for tksurfer "clo" (near isocont) --tksurfer.c: fix accidental regressed (Nov2018) while->if in do_all_glx_events --mk0{.csh}: add patch to tk compile to fix tk "raise" cmd --README.txt: explain how to shrink stupid-big Gnome window title bars --lib/help/tk{medit,surfer}/interface: new R-click help files --tksurfer.tcl: add "i" button for toggle interface size (skip popup) --FreeSurfer.sh: (bash-only) fix bug in detect if skipfontsflag override exists --csurf: CentOS 7 back to doublebuffer if nvidia kernel module there --tksurfer.c: add -justheaderflag (after mris_info hung computer on cereb surf) --tksurfer.tcl: mid-click "N" bot left lg F3 pan: norm_move_vertices_fracthick --tksurfer.c: norm_move_vertices_fracthick --tkmedit.tcl: small "i" left of SAGITTAL to get interface size toolbar --wrappers.tcl: new buttonbar proc for no-arg command list (only one allowed) --lib/help/tkmedit/{clks,im2read,im2entry,seglabel}: update --tkmedit.c: read FreeSurferColorLUT.txt region name, dbl-mid-clk reports --tkmedit.tcl: F4 interface tick to disable double click --tkmedit.c: export blockdoubleclickflag (mid:reportseg right:winhelp) --tkmedit.c: do_one_glx_event -> do_all_glx_events (slight speedup) --tkmedit.c: double-middle-click reports seg idnum (like tksurfer) --tkmedit.c: genstrret_1k exported variable for single return string --tkmedit.tcl: auto-back to 1st buff on read MGH seg overlay to show it --tkmedit.tcl: read 2ndimg use read_sort_mghval2rgblut if FreeSurferColorLUT.txt --lib/help/tkmedit/seglabel: update --tkmedit.c: log reports mgh segmentation label number if loaded --tkmedit.c: read_sort_mghval2rgblut: conv/sort/read FreeSurferColorLut.txt --tkmedit.c: read_val2rgblut (4col) switches to above (6col) if std FS name --tkmedit.c: drawslice() uses either byte or int segid (intern:intsegidsflag) --FreeSurfer.sh: conv long-broken aliases to functs: sdir/fdir/lss/lsf/cds/cdf --csurf: sort fix{surface,patch} globlist before resort (10.6=OK->CentOS7=rand) --tkmedit.c: read_second_images now accepts int/float/short --tkmedit.tcl: add "tran" entry to control overlayalpha on large F4 interface --tksurfer.tcl: show non-standard patch types in "patch:" dropdown after std --tksurfer.tcl: "clo" tick to adj selectdmax (def=2mm, deep near vert surf=0.25) --csurf: "csurf -db" or "csurf -sb" to force start doublebuffer or singlebuffer --tksurfer.c: export selectdmax to tweak select_vertex (omit selectzwinfact) --tksurfer.tcl: PLANE button turns on light inside surfaces --tksurfer.c: set_complex_color correct draw w/vals_cart2polarflag=1 for morph --lib/help/tksurfer/redraw: update --tksurfer.tcl: ctrl-middle-click REDRAW: toggle light back/inside surfaces --tksurfer.c: lighttwosidedflag to light back/inside surfaces --tksurfer.c: req read img before clear_selfintersect (cereb: override def=256) --FreeSurfer.{c}sh: Linux uses MaxOSX 10.6 75dpi Helv fonts for Linux --mk0{.csh}: copy good MaxOSX 10.6 75dpi Helv fonts for Linux (finally same!) --csurf: tmp disable doublebuffer for CentOS 7 (3.0+ kernels) --csurf: add separated tcl script helps --lib/tcl/script_{offset/phase/movie360,flatten,explode}movie: bind helpwin's --lib/help/tksurfer/script_{offset/phase/movie360,flatten,explode}movie: new --std script help fished from lib/help/tksurfer/script to R-clk each pop-up --lib/help/tksurfer/script: document new exposed vars --phasemovie.tcl: expose dontsaveframes, {col}phasecontour{modflag,_bright} --tksurfer.c: phasecontour_bright affects phasecontourmodflag=1 (def still wht) --tksurfer.c: colphasecontourflag: col phcont on gray (req phasecontourflag) --lib/help/tksurfer/shrink: say how to save surface made with SRHINK! --lib/help/tkmedit/surf2col: say how to show 2 surfaces! --csurf: now singlebuffer also for CentOS (until I fix underlying problem) --wrappers.tcl: linux also chk /etc/*-release: fix CentOS7 giant helv14,droparr --lib/help/csurf/tksurfer: add REDRAW stereo, "Col:", LUT ticks, MGH label --tksurfer.tcl: ltw hover saves curr colscale, undo change->ltw w/no val2rgblut --tksurfer.tcl: "R" on "lut:" line warns if val2rgblut file doesn't exist --tksurfer.c: set_complex_color() catches off-edge's if fred/pha LUT maxval<1 --tksurfer.c: FRED_TONO same: immed gray->orange, gray at end (vs zero-cent) --tksurfer.c: make_color_luts() now wraps fredtonolut[] correctly (0-1) --tksurfer.c: write_val2rgblut() now writes FRED_TONO colscale=18 ########################################################################## PREVIOUS UPDATE: 21 Jun 2018 ########################################################################## --csurf: explicit -padx 11 fixes Linux extra-wide "Slice Ord" tixSelect --lib/help/csurf/tk{surfer,medit,register,strip}: Mac shellscript help --tkregister.c: check/explain/exit DYLD_LIBRARY_PATH unset,maybe Mac shellscript --tkmedit.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript --tksurfer.c: check/explain/exit DYLD_LIBRARY_PATH unset, maybe Mac shellscript --csurf: CSURF_LIBRARY_PATH not set err before load tix (print after load fail!) --csurf: "csurf -h" err if CSURF_LIBRARY_PATH not set --lib/help/csurf/setupfour: clarify that 3D and surfcluster different --lib/help/tksurfer/script_annot2roi: new R-click help popup (cp from scripts) --lib/help/csurf/tkregister: update w/simple usage (tkregister s1.mgz s2.mgz) ... ################################################################### UPDATE: 22 Jul 2019 ################################################################### ---------------------------------------------- Mask overlay using any combo of MGH annotation regions ---------------------------------------------- After an MGH surface annotation file has been read with "D" on the "label:" line, you can use it to mask currently displayed overlay data by annotation idnum's. Use an alternate shift-right-click on the "D" button, which brings up two popups. The first one lists the idnum's of all the named regions. In the second, you enter a space-separated list of idnum's to show (any not listed are masked). This is useful, for example, to see phase encoded data from annotation regions (easier than with colored annotation borders). Once an annotation has been used to mask data, the currently displayed data can optionally be written out to a single label, or to per-area label files by ticking either "extract_unmasked_flag" or "extract_overlays_flag". In the first case, this writes a single label: rh-.label while in the second case, each displayed region is written into separate labels named by region name: rh-=.label The output by default goes to the subject's label directory. Those two operations are slightly out-of-place for the label "D" button (display) as opposed to being to being attached to the label "W" button (write), but more convenient here. ---------------------------------------------- Csurf accepts inst/subj/funct paths with spaces ---------------------------------------------- After some hair-pulling, csurf/tksurfer/tkmedit et al. now all work when the directory paths for CSURF_DIR, SUBJECTS_DIR, or FUNCTIONALS_DIR contain spaces. In the process of fixing this, I noticed that the standard MGH freesurfer 5.3 setup scripts (FreeSurfer.{c}sh), and recon-all, *won't* work in this case. AFNI will work, when you add AFNI_PATH_SPACES_OK=YES to its env. The csurf compile script, mk0, won't work with spaces in the $srcdir path because the configure scripts for the external libraries (e.g., tcl/tk) won't accept path spaces. However, this doesn't affect endusers. Because this is not yet extensively tested, and because spaces disable MGH freesurfer, you have to add "force" to make csurf run when it detects spaces in the paths to CSURF_DIR, SUBJECTS_DIR, or FUNCTIONALS_DIR like so: csurf -f ---------------------------------------------- Truncphase upgrades (wrap, softer truncphase) ---------------------------------------------- The "truncph" tickbox and truncphase limits has been upgraded to allow phase wrap (for complex-valued data) -- that is, you can now use a higher(0-1) phase value in the left box. A new tickbox was also added just to the right of "truncph", labeled "sft" (soft), that turns off hard truncation (if ON) and instead ramps the visible signal down to zero over 5% of the total phase angle range beyond the set limits (adjustable with new entry below truncation limits). This reduces the contrast and therefore the distracting prominence of the (irrelevant) ragged shape of the color edges at the truncation point. ---------------------------------------------- Fix Linux cmdline use of tksurfer, tkmedit, tkregister ---------------------------------------------- Very sorry to have just noticed that I broke cmdline use of tksurfer, tkmedit, tkregister on Linux (Jun2018) by incorrectly checking for DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH. Fixed. ---------------------------------------------- Easy re-run recon-all after edit orig.mgz ---------------------------------------------- A new tickbox, "start from edited orig.mgz" was added to the panel for: MGHTools -> Run recon-all Sometimes, the standard freesurfer pipeline will fail to properly normalize all parts of an otherwise good quality structural image (e.g., due to uncorrected variations in B1 transmit). A typical problem is that the anterior temporal lobes are too dark, causing parts of them to be lost in the reconstruction. This can be quickly fixed by using spherical hand-normalization to get this region bright enough so that freesurfer can normalize it properly. Open orig.mgz for the subject in csurf tkmedit using VOLUME, use [fn-]F3 to get the hand-normalization controls, then use the "sph" tickbox for spherical normalization (left-click: linear, middle-click: Gaussian). The selected point sets the center of the normalization field, "ffrac0:" sets the scale factor at the center (e.g., 1.5), and "lim0:" and sets the radius (in pixels) where the correction falls to 1.0 (no change). Use "TEST" to run the correction (e.g., with different values) and put the result in the COMPARE buffer. To make the eventual effects more visible "TRUNC" can be used to truncate the gray matter (lower number). Use "APPLY" to apply the correction to the editable buffer, and finally "SAVEIMG" to write it back out to orig.mgz Then, to use the edited orig.mgz as a starting point for recon-all, tick "start from edited orig.mgz", select the edited subject from the "new/redo subject:" dropdown, and click RECON-ALL. This only skips step 1 (convert, conform, compute Talairach), using the new option -all-skipstep1 of the very slightly modifed recon-all script: $CSURF_DIR/bin/noarch/recon-all5.3b ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- ima2brik can append protocol name to numbered output files fixed REDRAW crasher if annotmaskflag and no annotation loaded rm check for _f in filename (do_fdr) so no err when csurf doesn't load stat fix cmdline Linux use tk{surfer,medit,register}! (chk LD_LIB.. not DYLD_LIB..) fix csurf: look for license.txt so don't block run recon-all on fs6/Centos7! more surfcombine functions exposed surfcombine read_{real,complex} swap error fixed! surfcombine also accepts/writes curv-format wfiles middle-click-W on "rgb:" line forces write transparent tiff ctrl-R-REDRAW toggles overlay multiple single-voxel timecourses fixpial script to correct big triangles at 'poles' of fsaverage surfs [not in distro since extra 11M] AVGSURF also fixes average avg pial defects at 'north/south' poles re-compiled latest code for ancient PPC :-} ########################################################################## UPDATE: 22 Jul 2019 ########################################################################## --[### end spaces-in-{CSURF,SUBJECTS,FUNCTIONALS}_DIR nightmare ###] --tkmedit.tcl: pathspaces: listcmd_{surf,ims}: set "$list $m" =>lappend list $m --csurf: refactor dyld/path spaces runafni proc for afni{cmd,allcmd,structcmd} --csurf: afnicmd: omit empty dyld for namespace fix: env cmd uses as arg not env --csurf: use AFNI_PATH_SPACES_OK=YES if detect FUNCTIONALS_DIR space (multiple) --csurf: {l}backslashspaces runacmd args/listargs that could have spaces (~135) --FreeSurfer.sh: fix lss,lsf,cds,cdf functions to accept spaces --FreeSurfer.csh: fix lss,lsf,cds,cdf aliases to accept spaces --mk0: unwind allow spaces edits to "tcltktix" (spaces break tcl configure's) --mk0: (sh) allows space in srcdir path only for option "dist" --mk0.csh: block all options if spaces in srcdir path, suggest mk0 (sh) --N.B.: 10.12 tk{surfer/medit/strip} compiles coredump on 10.6 (converse OK) --backslash-quote cat/gunzip/system args for paths w/spaces in following: => calcimg.c/fill.c/rawaverage.c/regcor.c/tkregister.c/wmfilter.c/tkstrip.c --csurf: backslash spaces in runacmd pwd report --csurf: medtestrender: backslash spaces in -real,-imag,-mask args for tkmedit --csurf: backslash-quote maybe-space-containing DYLD cmdline passed to afni --csurf: choosedir strips double-slash seen by file exists but not by tixDirTree [spaces now OK: opencmdsonlyfile,"Set {Subjects, Funct Sessions} Directory"] [spaces now OK: mknew{subject,funct},choose{subject,funct}dir,cpdir,avgsurfcmd] --csurf: choosedir: strip curly braces in path-with-space added by glob (fixed!) --csurf: MGHTools->RunRecon-all warn/cont. if space(s) in {FSURF,SUBJECTS}_DIR --tksurfer.tcl: warn/catch mris_pmake ("Dijk" geodesic) fail w/spaces in PATH --tksurfer.tcl: Dijk (mris_pmake) won't accept SUBJECTS_DIR spaces, add log/warn --tksurfer.tcl: listcmd_{tcl,label,val,rgb} work (dblquoted auto-curly-braced) --tksurfer.tcl: same fix for listcmd_{area,patch,lut}, select_{area,patch} --tksurfer.tcl: path spaces: listcmd_curv, select_curv: set "..." => lappend --tksurfer.c: [left some single-quoted system() args: OK unless change->runacmd] --csurf: backslash spaces in tcl source file args --csurf: backslash (proc) bindir/afnidir/mincdir/noarchdir spaces for runacmd sh --wrappers.tcl: new proc: backslashspaces --tksurfer.c: backslash-quote cat/gunzip/system file args for paths with spaces --tkmedit.c: backslash-quote cat/gunzip/system file args for paths with spaces --bin/noarch/mk: add quotes to it make work with spaces in install dir path --FreeSurferEnv.csh: LIB/PATH spaces now OK (use quoted lists, :q preserves q's) --FreeSurferEnv.sh: LIB/PATH spaces now OK (use set/unset IFS) --FreeSurferEnv.csh: if $path member w/space, don't touch (tmp fix, superseded) --FreeSurferEnv.sh: allow $PATH bloat if memb have spaces (tmp fix, superseded) --[### begin spaces-in-{CSURF,SUBJECTS,FUNCTIONALS}_DIR nightmare ###] --csurf: better symbolic link ex. to fix path w/space (doesn't fix tix dirtree!) --lib/help/csurf/tkmedit: rearrange, doc block double clicks, doc mask ctrls --lib/help/tkmedit/{im2entry,im2read,seglabel}: update, doc block double clks --tksurfer.tcl: do_annotmask checks overwrite if omnibus label (not multi) --lib/help/tksurfer/label_read: update --tksurfer.c: redraw crasher: set_{real,cmplx}_color didn't chk brainregion/cnt --tksurfer.tcl: add $extract_unmasked_flag tickbox: write_val_unmasked_vertices --tksurfer.c: add funct: write_val_unmasked_vertices --tksurfer.tcl: rm chk _f in filename (do_fdr) so no err when csurf noload stat --csurf: add View Functional Data tickbox for softtruncphaseflag ("Sft") --csurf: readheader (READ HEADER) init alignscanparms(brightness) 1.0 if align --ima2brik: inclprot trimleft 08's to block octal in format (fix past scan07) --csurf: add "start from edited orig.mgz" tick to Run MGH recon-all panel --bin/noarch/recon-all5.3b: copy of recon-all w/new opt: -all-skipstep1 --mk0{.csh}: insttmp/dist append tarfile date to README.txt --ima2brik: add -afniprot, -niftiprot to insert protocol names in output BRIKs --tkregister.c: fix look for DYLD_LIBRARY_PATH on Linux (broke cmdline use!) --tkmedit.c: fix look for DYLD_LIBRARY_PATH on Linux (broke cmdline use!) --tksurfer.c: fix look for DYLD_LIBRARY_PATH on Linux (broke cmdline use!) --mk0{.csh}: also include my license.txt --csurf: check CSURF_DIR for .license *or* license.txt (fs6.0 on centos7) --surfcombine.c: expose additional functs, better documentation stack ops --surfcombine.c: read_binary_values: fread -> freadFloat (!) --lib/help/tksurfer/truncphasesoft: update (re-use softtruncphase tick help) --tksurfer.tcl: add unlabaled entry next to invph tick for $softtruncwidth --tksurfer.tcl: "invphase" -> "invph" to make room (update relevant helpfiles) --tksurfer.c: add/export softtruncwidth (width of lin ramp-to-zero) --mk0{.csh}: add new helpfile: truncphasesoft --csurf: new $softtruncphase helpfile: truncphasesoft --lib/help/tksurfer/{truncphase,rgb_write,rgb_write2}: update --tksurfer.tcl: overload mid-click-WN on "rgb:" line to force write transparent --tksurfer.tcl: overload mid-click-W on "rgb:" line to force write transparent --tksurfer.tcl: add "s" tickbox for $softtruncphaseflag, "truncphase"->"truncph" --tksurfer.c: add/export softtruncphaseflag (lin ramp-to-zero beyond limits) --annot2roi.tcl: warn opposite hemisphere not yet done --surfcombine: add write_{real,complex}_cv --surfcombine: prohibit mixing orig (subset OK) with curv (full) valfiles --surfcombine.c: stacksize: 100->300 --surfcombine.c: read_binary_values() also accepts curvfiles --lib/help/tksurfer/truncphase{flag,min,max}: update --tksurfer.tcl: ticking colscale=1=heat resets truncphase{min,max} to orig def --tksurfer.tcl: truncphase{flag,max,min} allow wrapped phase limits if complex --tksurfer.c: all set_complex_color's accept wrapped truncphase limits --lib/help/tksurfer/label: update --csurf: AVGSURF also fixes fsaverage pial 'poles' (for final disp, not sample) --[don't fix less-used fsaverage surfs w/'pole' defects: orig, white] --bin/noarch/fixpial: script to fix giant triangles in fsaverage pial --lib/help/tksurfer/{label_read,label_write}: update --tksurfer.tcl: setfile label w/relative now defaults to subject (was funct!) --tksurfer.tcl: mask annot popup can write labels (not in "W" but convenient) --tksurfer.c: add funct: write_val_idnum_vertices --lib/help/tksurfer/redraw: update --tksurfer.tcl: wire toggle multitimecourseflag to ctrl-mid-REDRAW --csurf: setup align/funct page sets iscandir so AFNI button goes to right dir --lib/help/tksurfer/{label_toggle,label_read,hbutt}: update --tksurfer.tcl: annotmaskctrls opens current MGH annot ctab in helpwin --tksurfer.c: read_mgh_annot: write MGH ctab in scripts (vs. overwrite in label) --tksurfer.tcl: annotmaskctrls/do_annotmask: pick annot idnum(s) to not mask --tksurfer.tcl: bind pick annot idnum vis ctrls popup to "D" butt (shift-R-clk) --tksurfer.tcl: bind annotmaskflag to label tickbox (5th overload: shift-R-clk) --tksurfer.c: set_{real,complex}_color: if annotmaskflag use brainreg maskflag --tksurfer.c: add funct: set_idnums_visibility <0,1> => brainregion[i].maskflag --tksurfer.c: add funct: set_idnum_visibility <0,1> => .maskflag --tksurfer.c: add annotmaskflag (enable masking by annot regions) --lib/help/csurf/makenewfunct: update --lib/help/tkmedit/im2read: update ########################################################################## PREVIOUS UPDATE: 08 Feb 2019 ########################################################################## --lib/help/tkmedit/roiup_write: update --tkmedit.tcl: overload "W" button on "roiup:" line with write_allsegids --tkmedit.c: add write_allsegids --csurf: fix afni crash new Mac: add DYLD if exists /opt/X11/lib/flat_namespace --lib/help/tkmedit/roiup_time: update --tkmedit.tcl: overload "T" on "roiup:" line to run write_segid_timecourses --tkmedit.c: add write_segid_timecourses (first load segmentation) --csurf: block all abspath paradigmdir's in deconvcmd, rawaveragecmd (concat) --lib/help/csurf/setuprand: suggest only stim1Ds dir inside each scandir --FreeSurferEnv.{c}sh: Mac: if exists /opt/X11/lib/flat_namespace add to DYLD_ --tkregister.tcl: fix cmd typo disabling SAGMIRR! (showvisble -> showvisible) --tkmedit.c: thin gray dividers for all3views --tksurfer.tcl: "clo" button R-click help ... ################################################################### UPDATE: 16 Dec 2019 ################################################################### ---------------------------------------------- tksurfer 'direct paint' ---------------------------------------------- The operation of sampling data onto the surface (PAINT) usually passes through a transformation matrix, and the sampled data often has a different voxel size than the native scans used to reconstruct the surface. A new tksurfer 'direct paint' operation (C/tcl function direct_paint) was added to sample native conforming COR data (e.g., orig.mgz) directly onto the surface without a transform. Run direct_paint with the new "P" button, visible at the top left of the larger, [fn-]F3 interface (use "i" at upper left of default interface to get larger interface). This requires first loading a 3D data set using "R" button on the "im:" line. This function uses the following parameters to sample the 3D data to the current surface: normdfracflag 0=mm, 1=fraction (def=0) normdsamp dist along normal in mm (def=1.0) normdfracsamp fraction cortical thickness (def=0.4) wmgmext sampling surface (def=orig) To adjust these parameters interactively, click "label:" to get a popup. All other parameters on that pop-up besides the four above are ignored. ---------------------------------------------- sphere_morph ("REG") can use 2nd complex dataset ---------------------------------------------- The tksurfer C/tcl function, sphere_morph, can now use two complex-valued data sets in order to align retinotopic data. See the R-click help for the "REG" button (sphere_morph) and the "W" button on the "val:" line (surf2sphim). The overall procedure is: (1) open a sphere.reg surface (2) load target curvature (e.g., sulc), and/or real-valued target data and stat, and/or complex-valued data, and possibly a second complex-valued data set to surface. (3) sample target surface data to target volumes ("reverse paint" function, surf2sphim, using alternate clicks on the "val:" line "W" button) so moveable data can be loaded (click the bold "im:" label to get pop-up controls) (4) load corresponding moveable surface data (data to be morphed) onto the surface (5) run sphere_morph ("REG" button on F3 interface) ---------------------------------------------- csurf "Surface for Sampling 3D Data" orig -> white ---------------------------------------------- The FreeSurfer 5.3 "orig" and "white" (and "smoothwm") surfaces are very similar across virtually the entire brain. However, in the foot area in S-I (which I just happened to be recently mapping :-} ), the "orig" surface can billow out toward the pial surface, when compared to "white" and "smoothwm". Therefore, the default "Surface for Sampling 3D Data" in the "Calculate 3D Fourier Stats" panel and the "Import 3D Stats" panel was changed from "orig" to "white". This results in extremely subtle differences in data sampled to the surface (even in the foot area of S-I), esp. if normal search is engaged. ---------------------------------------------- tksurfer display gray-matter diffusion vecs from AFNI BRIK ---------------------------------------------- After clicking "val:" to toggle it to "val3d:", there is a new "RD" button (read rawdata and register.dat), and a new "V" (vectors) button (tcl/C function, read_vecs2surf), which allows reading 3D vectors out of an AFNI DTi eigenvector BRIK in order to sample gray-matter diffusion vectors to the surface and display them as ball-and-sticks. A new tcl/C funct, rotate_dti, rotates the diffusion vectors using the inverse of register.dat (ignores translation and scale). Here is how to perform the read_vecs2surf actions in a tcl script: if {$rawdataloaded && $registerdatloaded} { ### rawdata -> vector (dipole) display set xvectbrik 9 set scalebrik 5 set normdsampsearchflag 1 set normdfracflag 1 set normdfracsamp 0.5 set normdfracmax 0.5 swap_val_valbak ;# save overlay for {set i 0} {$i < 3} {incr i} { rawdatasubbrik_to_paintable [expr $xvectbrik + $i] paint_surface 0 push_val_dip $i ;# 0=dipx,1=dipy,2=dipz } ### optional scale length by 4th vol dataset if {$scalebrik >= 0} { rawdatasubbrik_to_paintable $scalebrik paint_surface 0 swap_stat_val scale_dipxyz_by_stat } rotate_dti swap_val_valbak ;# restore ovelay set dipolesflag 1 redrawbutton } This is equivalent to calling the combined function directly: if {$rawdataloaded && $registerdatloaded} { ### rawdata -> vector (dipole) display set xvectbrik 9 set scalebrik 5 set normdsampsearchflag 1 set normdfracflag 1 set normdfracsamp 0.5 set normdfracmax 0.5 read_vecs2surf $xvectbrik $scalebrik ;# all-in-one set dipolesflag 1 redrawbutton } ---------------------------------------------- tksurfer display vectors (e.g., GM DTi) from 3-frame .mgh ---------------------------------------------- Alternatively, if diffusion eigenvectors (or any other vectors) have already been sampled to the surface in the form of a 3-frame *.mgh file, they can be displayed directly with a shift-right-click on the "V" button on the "val:" line, using the C/tcl function, read_mgh_dipoles. First select the *.mgh file to read from the "val:" entry dropdown (the file must be in the current scandir to be loaded into the dropdown). The vector length and thickness can be controlled with the left-middle (unlabeled) unlabled entry in the "phc" box. Use Return to set vector length to the value of the entry, and Shift-Return to set both length (in mm), and line thickness (in pixels). ---------------------------------------------- Calc % overlap between annotation regions and non-zero .val ---------------------------------------------- Calculate vertex-wise percent overlap between each region in the currently loaded MGH annotation file and vertices containing non-zero .val data. Annotation regions overlapping only zero .val's are not reported. To use this, if necessary, first clear any .val data from the surface using: "CLR" on the "val:" line The load the .val field using either: select valfile (*.w or *.mgh) file "label:" dropdown click "R" (=read) on the "val:" line *or* select data-containing label from "label:" dropdown click "R" (=read) on the "label:" line Then, load an MGH annotation using: select .annot file from "label:" dropdown click "D" (=display) on the "val:" line Finally, ctrl-shift-right-click the "D" button on the "val:" line. The result is written to a pop-up, to the csurf log, and to a text file ($hemi.overlap.txt) in the subject's "scripts" directory with the following format: #calc_annots_nzval_overlap (non-zero .val's) #annot=/usr0/subjects/fsaverage/label/lh.HCP-MMP1.annot #val=/tmp/191101BC-ICA_mgh/ICA20_medial_sensorimotor_rh.mgh #IDnum Percent (Overlap/Vtxs) Structure #----------------------------------------------------------- 8 27.7% (1111/4015) L_4_ROI 9 29.9% (852/2845) L_3b_ROI 10 5.2% (43/832) L_FEF_ROI 11 6.1% (23/375) L_PEF_ROI 12 39.8% (261/656) L_55b_ROI ... ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- Sample to sphim pop-up, optional conv byte mgz for debugging surf2sphim now fills small number of remaining holes Immediately update orig area after "really_" transformations Fixed tksurfer double redraw on change surface Fixed tksurfer Dijk button Save/Goto View can add suffix to surfer.mat, list currently there middle-click upper-left "i" in tkmedit to invert contrast fix tksurfer printvtxdata off-edge im crasher if MRIloaded fix extra callbacks controls pop-up panels purple/unpurple buttons to indicate running ########################################################################## UPDATE: 16 Dec 2019 ########################################################################## --mk0{.csh}: add -viewerlin,-viewermac to make self-contained quickstart inst --tksurfer.c: rm redundant diploadedflag --tksurfer.c: add/export read_mgh_dipoles(): from $val (must be 3-frame .mgh) --tksurfer.tcl: lib/help/tksurfer/arrownorm: update --tksurfer.tcl: shift-right-clk on unlabeled arrowstick toggles dipolesflag --tksurfer.tcl: read .mgh val: check embedded *.rh/lh.* (vs. *-rh/lh.w), warn --tksurfer.tcl: wider "RD" dropdown list for rawdata BRIKs --{wrappers,tksurfer}.tcl: -selectforeground black for linux dti,regraw popups --tksurfer.c: paint_surface: if stat dims=0, subst rawdata dims, fail if both=0 --tksurfer.c: init xx0=xx1=yy0=yy1=zz0=zz1=0.0 (enable test unset, not yet done) --tksurfer.c: rename: push_val_dip() to copy_val_dip() [no history yet] --lib/tcl/zz-examples/renderoffscreen.tcl: respect previous rename --lib/tcl/{borders,eccen-,fs-make,phasemovie,polar-,twocond-*}.tcl: respect prev --tksurfer.c: rename: push_val_val2() to copy_val_val2(), push_ another synonym --tksurfer.c: if diploadedflag, printvtx reports it --tksurfer.c: calc avg len dip (for scale) --tksurfer.tcl: do_dtivec: force sample single cortical depth, update NormSamp --tksurfer.tcl: dtivecctrls: add parms for sampling surface, cortical depth --tksurfer.c: replaced accidentally deleted normals display --lib/help/tksurfer/val3d_{raw,vecs}: update --tksurfer.c: add/export scale_dipxyz_by_stat(), optional use in read_vecs2surf --tksurfer.c: rotate_dti uses normalized (rot-only) inv regdat xform --tksurfer.c: invert_regdat also makes normed upper 3x3 inv regdat for rot-only --tksurfer.c: read_rawdata: set flag from HEAD to short, not just float! --lib/help/tksurfer/val3d_raw: update --tksurfer.tcl: finish "RD" (read rawdata and regdat) popup for val3d: line --csurf: help/tksurfer/val3d_raw: add to all help --wrappers.tcl: okreplace debug msg if absfilename is dir, parent doesn't exist --wrappers.tcl: okreplace w/o altmsg checks if file exists, adjusts message --csurf: allow multiple cmdline flags --tk{surfer,medit}.tcl: macappnaphackflag can force/unforce hack --tk{surfer,medit}.c: macappnaphackflag passed thru to tk --csurf: -[no]hack opt pass -macappnaphackflag (-1,1,0) to tk{surfer,medit}cmd --csurf: -[no]hack opt pass -macappnaphackflag (-1,1,0) to {surf,med}testrender --lib/help/tksurfer/label: update for overlap calc --csurf: MacOS 10.15/kern=19 fast tk after logout/in w/o hack: add -[no]hack --FreeSurferEnv.sh: works on MacOS 10.15 zsh --tksurfer.tcl: warn overwrite $hemi.overlap.txt --tksurfer.c: also count overlap w/idnum=0,col=maxUint,name=??? --tksurfer.tcl: warn about FILL even w/visible label (was block invisible label) --tksurfer.c: lastvalfromlabelflag: to tell fname (vfname/val vs. lfname/label) --tksurfer.c: write calc_annots_nzval_overlap output to subject scripts dir --tksurfer.tcl: 8th overload "D" butt w/calc_annots_nzval_overlap (ctrl-shift-R) --tksurfer.c: calc_annots_nzval_overlap: vtxwise overlap MGH annots, non-0 .val --tksurfer.c: add RD button to val3d to read regdat/rawdata (space: PAINT=>PA) --tksurfer.tcl: fix tcl: GO button double exec (block callback from setfile) --tksurfer.tcl: fix misleading error message on NormSamp parm mismatch --csurf: "Update Subjects/Sessions" warns when subj changed to match curr sess --csurf: add selecthemi to fieldsigncmd to allow doing fieldsign for one hemi --tksurfer.tcl: do_dtivec purple/unpurple mv'd more gen wrappers.tcl controls --wrappers.tcl: add purple/unpurple main button hack to controls proc --tksurfer.tcl: fix val/val3d both visible after chng interface size w/val3d --tksurfer.tcl: do_dtivec purples/disables/renames butt, unpurples when done --tksurfer.tcl: R-clk help also pops up panel for too-much-overloaded labeltick --tksurfer.tcl: dtivecctrls pop-up to allow choose subbrik --tksurfer.c: export registerdatloaded, dtirotatedflag, diploadedflag --tksurfer.c: rotate_dti() to rotate eig in place using inverse of register.dat --tksurfer.c: invert_regdat() using MNI inverse (read_regdat always does) --tksurfer.c: rename vtx2rawdata() => xformvec() --tksurfer.c: draw_surf: flip dip vec if neg projection onto vtx normal --lib/help/tksurfer/val3d_vecs: add helpfile, add to mk0{.csh}, csurf --tksurfer.tcl: add "V" butt to "val3d:" entry to run all-in-one read_vecs2surf --tksurfer.c: read_vecs2surf() to read/paint/xyz/to-dip --tksurfer.c: swap_val_valbak() to save/restore current overlay --tksurfer.c: rawdatasubbrik_to_paintable(): copy 1 subbrik to paintable fim_2r --tksurfer.c: export dipolesflag (draw_surf()) --ima2brik: add -listboth --ima2brik: add -listprot: just list num files, protocol names for each scan --csurf: "Surface for Sampling 3D Data" orig->white: orig has bad S-I foot! --tksurfer.tcl: write sphim to mgz now optional on sphimctrls --csurf: SUBJECTSS_DIR crasher! --csurf: don't complain about xterm if not Mac! --csurf: use recon-all6.0b w/-all-skipstep1 option for fs6.0 (was just fs5.3) --csurf: add all-help: nonintecc/exptrans/direct_paint/read_im{2,3,_label}, --tksurfer.c: surf2sphim now clamps in case non-spherical surf search off edge --csurf: add im,im2,im3,im-label to all-help panel --lib/help/tksurfer/read_im_label: new helpfile for bold "im:" label --tksurfer.tcl: "im:" F3 interface makes surfdata->sphim->mgz popup: sphimctrls --tksurfer.c: change default volumes (inim{2,3} to *.mgz (was CORdir) --tksurfer.c: surf2sphim fills (the few) remaining holes, thicker rim --tksurfer.c: add/export: write_sphim2byte hack/debug/check morph tractor beams --lib/help/tksurfer/(morph,val_write,shrink_wbn}: update for wcpx2 --tksurfer.tcl: 8th overload "val:" W butt: samp valbak,val2bak: surf2sphim 4,5 --tksurfer.tcl: replace "wbn:" entry (boundary normal) with "wcpx2:" --csurf: add morph_wcpx2 to all-help --lib/help/tksurfer/morph_wcpx2: new helpfile (add to mk0{.csh}) --tksurfer.c: exported: {real,imag}im2loadedflag, surf2sphim accepts 4,5 --tksurfer.c: add second complex-valued drive to sphere_morph, sphims --lib/help/tksurfer/exptrans: new helpfile (tksurfer.tcl, mk0{.csh}) --tksurfer.c: fix printvtxdata off-edge im crasher w/MRIloaded --lib/help/tksurfer/read_{im,im2,im3}: new helpfiles, add to mk0{.csh} --tksurfer.tcl: undo prev, update help to load using std S/V "push imaginary" --tksurfer.tcl: mid-clk overload "P" button to paint to .val2 (direct_paint 1) --tksurfer.c: direct_paint stattype arg so im[][][] can go to .val or .val2 --tksurfer.c: export non-std flags: MRIloaded, MRI2loaded, MRI3loaded --lib/help/tksurfer/{nonintecc,direct_paint} new helpfiles; also mk0{.csh} --tksurfer.tcl: add "P" button (direct_paint) to "im:" entry --tksurfer.c: add/export: scale_val --tksurfer.c: add/export: direct_paint() from im[][][] using normd parms --lib/help/tkmedit/interface: update --tkmedit.tcl: middle-click "i" to toggle invert contrast ($midpt => -$midpt) --tksurfer.tcl: rm 2x reread F3 "insurf:" (touch surfext does tix callback) --tksurfer.tcl: select_surfext blocks redraw if same as last (callback overlap!) --lib/help/tksurfer/saveview: update --tksurfer.tcl: mid-clk Save/Goto view to add suff to default name, surfer.mat --tksurfer.c: {read,write}_view_matrix use exported vmfname/$viewmatrix --tksurfer.tcl: fix Dijk button (normal ret to stderr, too? when did I break?) --lib/help/csurf/flattensurface: re-flatten, better save/view steps instruction --lib/tcl/{phasemovie,offsetmovie,searchightdiff}.tcl: re-use already there --tksurfer.tcl: listbox select pops up standard tclscript controls panels w/o GO --csurf: re-flatten sets subprocessredo: avoid second confusing overwrite query --{flatten,inflate}movie.tcl: change irritating $skip to $every, raise if there --tksurfer.c: write_{view,really}_matrix: add subj/surf/date comment --tksurfer.c: read_{view,really}_matrix: allow comments, bare CR's --tksurfer.tcl: write surfer.mat into log on "Save"/"Goto" --tksurfer.c: really_scale_brain->compute_normals_areas (so immed FILL area OK) --tksurfer.tcl; strip *.3d and *.flat in case patch infix matches surflooklist --lib/help/tksurfer/{surf,patch,brainpose}: update --wrappers.tcl confirmalert opt fix height for wrap lines (already linecnt-sens) --block AFNI,AFNI-ALL buttons from cd'ing, e.g., if 3dvolreg/2swap running in bg --csurf: VOLUME butt: if vol not found, suggest found *.mgz's from volllooklist --lib/help/tksurfer/{min,max}stat: add also controls phase rect limits --csurf: AFNI_PATH_SPACES_OK=YES: avgstruct,reconall,stripinit,3dvolreg,fourier --brik2cor.c: backslash-quote system arg for abs outpath w/spaces --lib/help/csurf/csurf: update spaces-in-path advice ########################################################################## PREVIOUS UPDATE: 22 Jul 2019 ########################################################################## --[### end spaces-in-{CSURF,SUBJECTS,FUNCTIONALS}_DIR nightmare ###] --tkmedit.tcl: pathspaces: listcmd_{surf,ims}: set "$list $m" =>lappend list $m --csurf: refactor dyld/path spaces runafni proc for afni{cmd,allcmd,structcmd} --csurf: afnicmd: omit empty dyld for namespace fix: env cmd uses as arg not env --csurf: use AFNI_PATH_SPACES_OK=YES if detect FUNCTIONALS_DIR space (multiple) --csurf: {l}backslashspaces runacmd args/listargs that could have spaces (~135) --FreeSurfer.sh: fix lss,lsf,cds,cdf functions to accept spaces --FreeSurfer.csh: fix lss,lsf,cds,cdf aliases to accept spaces --mk0: unwind allow spaces edits to "tcltktix" (spaces break tcl configure's) --mk0: (sh) allows space in srcdir path only for option "dist" --mk0.csh: block all options if spaces in srcdir path, suggest mk0 (sh) --N.B.: 10.12 tk{surfer/medit/strip} compiles coredump on 10.6 (converse OK) --backslash-quote cat/gunzip/system args for paths w/spaces in following: => calcimg.c/fill.c/rawaverage.c/regcor.c/tkregister.c/wmfilter.c/tkstrip.c ... ################################################################### UPDATE: 29 Jun 2020 ################################################################### ---------------------------------------------- MacOS 10.10+ interface slowdown fix ---------------------------------------------- On recent MacOS's (e.g., 10.15), the catastrophic tk interface slowdown that began with MacOS 10.10 can be fixed simply by the following sequence: boot login, start X11 logout login, start X11 The speedup will stick until the next reboot (start csurf with 'csurf -nohack' to skip the xterm cover/uncover hack). ---------------------------------------------- FreeSurfer.zsh ---------------------------------------------- FreeSurfer.sh has been fixed to be zsh-compatible for MacOS 10.15. I added a link so both 'source FreeSurfer.sh' and 'source FreeSurfer.zsh' will work in both zsh and bash. ---------------------------------------------- new tcl script - searchlightarea.tcl ---------------------------------------------- This script estimates local area differences by resampling individual subject vertexwise area data to fsaverage, and then running a surface-based searchlight operation on the resampled data using fsaverage sphere. First, create a Cross-Subject Session (for display subject, fsaverage) with: csurf -> File -> New SphereAvg (pseudo-subject "XS" for "cross-session") Then, open the just-created empty session and select searchlightarea.tcl from the "tcl:" dropdown in at the top left of the tksurfer interface. This generates a pop-up to select a subject and adjust parameters. Clicking "RUN SCRIPT" on the pop-up resamples the area data, and then runs the searchlight operation: 4 -> sum of data in searchlight writing the result of the operation as a vertexwise curvature-format file. The multithreaded operation takes about 10 min/hemisphere on an Intel i7. The size, ${num,sqmm,mm}, of the approximately geodesic surface searchlight circles can be specified by vertex count, area, radius, or by neighbor order (1=immediate neighbors, 2=also include neighbors of neighbors, etc): Searchlight size ($fillneartype): 0 -> num vertices 1 -> area (in mm^2) 2 -> radius (in mm) 3 -> neighbor order (1-6) The first three searchlight size specifications ($fillneartype) use the C/tcl function, searchlightop_val2stat (multi-threaded), while the fourth specification uses the C/tcl function, neighop_val2stat (similar result for similar vertex count, goes up to 6th-order neighbors, which is 127 vertices). Adjustable parameters can be hard-coded in this script (see commented-out example inside) in order to run it non-interactively from the command line as a tksurfer tcl script, for example: #! /bin/sh sublist="marty sean jill sue" hemlist="rh lh" cd $SUBJECTS_DIR/fsaverage/scripts cp $CSURF_DIR/lib/tcl/searchlightarea.tcl . for sub in $sublist; do for hem in $hemlist; do export sampsubj=$sub # tcl script reads env tksurfer fsaverage $hem sphere -tcl searchlightarea.tcl done done TODO: Gaussian instead of boxcar ---------------------------------------------- tksurfer reads/writes Wavefront *.obj surface files ---------------------------------------------- Surfaces in Wavefront/Alias *.obj (ASCII) format can now be autodetected and read by tksurfer. Any optional color appended to vertices is currently ignored and normals are recalculated (rather than read out of the *.obj file). Surfaces can be exported in Wavefront/Alias format using the "OBJ" button on the "outsurf:" line at the top right of the large F3 interface (C/tcl function: write_obj_surface). Output formats are: basic surface include vertexwise colors include normals include colors + normals ---------------------------------------------- tksurfer reads colors from Wavefront *.obj surface files ---------------------------------------------- If a Wavefront *.obj (ASCII) format surface contains vertexwise colors, these can now be read as if they were an annotation (a set of patches-of-interest). That is, the vertices in each unique color will be assigned to different brain region, and can then be used to extract surface data. Any *.obj file in the surf directory will be loaded in the "label:" line dropdown and can be read with the "D" button (which uses the C/tcl function, read_obj_to_annot). ---------------------------------------------- tksurfer reads Brain Voyager *.poi files ---------------------------------------------- Any *.poi file, a Brain Voyager "Patches of Interest" annotation file (ASCII, vers=2), in the current subject's label directory will be loaded into the "label:" line dropdown and can be read with the "D" button (which uses the C/tcl function, read_obj_to_annot). The expected file format looks like this: ------------------------------------------- FileVersion: 2 FromMeshFile: "" NrOfMeshVertices: 163842 NrOfPOIs: 8 NameOfPOI: "Te10" InfoTextFile: "" ColorOfPOI: 227 26 28 LabelVertex: 0 NrOfVertices: 468 52656 52657 ... [vtxnums for every vtx in this patch] NameOfPOI: "Te11" InfoTextFile: "" ColorOfPOI: 253 191 111 LabelVertex: 0 NrOfVertices: 855 43 166 ... [vtxnums for every vtx in this patch] ... [additional patches] ------------------------------------------- The result of reading a *.poi file is the same as when reading an MGH annotation file, and the displayed labels/patches can be used in the same way to extract surface data. ---------------------------------------------- tksurfer reads Brain Voyager *.srf surface files ---------------------------------------------- Brain Voyager *.srf binary surface files can now be read into tksurfer. Vertexwise color data is currently ignored, and surface normals and neighbor lists are recalculated. N.B.: when the left-handed PIL coordinates of native Brain Voyager surfaces are read into the right-handed RAS coordinate system of freesurfer, the surface will appear mirror-imaged (a right hemisphere will look like a left hemisphere and vice versa). The surface can be mirror-imaged (see next) and then written out as a native freesurfer surface. ---------------------------------------------- tksurfer can mirror-image a surface ---------------------------------------------- The new "FlipHemi" button at the upper far right of the larger F3 interface mirror-images the currently displayed surface. N.B.: this will misalign the surface with any 3D image data that it was derived from. N.B.: there is no permanent effect until the surface is saved (see below). This operation is occasionally needed for surfaces read in from other software packages. The C/tcl functions used are: really_flip_brain_x compute_normals_areas redraw After the x-coordinate has been flipped, the order of the vertices in the entry for each face is flipped so that lighting calculations work correctly. The resulting flipped surface can be saved by entering a name in the upper-left "outsurf:" entry in the F3 interface and clicking "W". To perform the same action with a tcl script, do something like: setfile outsurf ~/surf/lh.my_flipped_RH write_binary_surface ---------------------------------------------- tkmedit FILL can append, get volume, fill 3D annotation ---------------------------------------------- The FILL button now allows appending to an existing filled ROI, measuring the total volume of current ROIs, and filling 3D annotation regions (e.g., from rh.aparc.a2009s.annot). In order of precedence, the criteria for a connected FILL volume can be: 1) current clicked 3D annotation segid 2) stat mask above current $sfthresh 3) overlay data amplitude above curr $fthresh 4) struct between $white_lolim and $white_hilim Whichever of these four are in force can be logically AND'ed with a max radius as well as any temporary edits-to-black of the struct underlay image (to constrain the FILL). ########################################################################## UPDATE: 29 Jun 2020 ########################################################################## --csurf: fix bug in -nohack option --tksurfer.tcl: SAVE/GOTO add-suffix-to-viewmatrix popups show avail suffixes --csurf: add lights,blufact to all-help --mk0: combine lib/help/tksurfer/light{1,2,3,4} -> lights --tksurfer.tcl: better help for the lights --tksurfer.tcl: bold the "View" butt (curr saved matrix popup), report saved dir --lib/help/tksurfer/script_searchligharea: update --FreeSurfer.sh: fix zsh path parsing --tksurfer.tcl: force load example-res mgz file before FILL3d, write_fill_images --tksurfer.tcl: also load subjectdir *.mgh files into "val:" dropdown (areas) --tksurfer.tcl: 6th overload S/V with swap_origarea_val --tksurfer.c: add swap_origarea_val() -> .origarea loaded at start w/areafile --tksurfer.c: add copy_area_curv() (fix so-far-unused copy_area_val() bug) --tksurfer.c: export threadcnt (def=8), incl opt/env --tksurfer.tcl: blk reabbrev callbacks curv/area in sessdir (was just subjdir) --searchlightarea.tcl/mk0: new script --calcvert.c: 1D MGH outp opt for area (rename vars: vnum*->vcnt*, fnum*->fcnt*) --tksurfer.tcl: fix mid-clk SMOOTH logic (searchlightop_val2stat does neighfill) --tksurfer.c: searchlightop_val2stat calls neighop_val2stat if filltype=NEIFILL --tksurfer.c: add SLOPSUM searchlight operation to neighop_val2stat --tksurfer.c: add copy_area_val() --tkmedit.c: fill_roi, vol_rois put return in $genstrret_1k for tcl scripts --tkmedit.c: print 3D brainregion2 name to log (was only double-mid-click) --tkmedit.c: shift-middle-TRUNC voxel count now pops-up result --lib/help/tkmedit/roi_fill: update --tkmedit.tcl: shift-left-click overload FILL button: vol_rois --tkmedit.tcl: middle-click overload FILL button: clear_rois --tkmedit.c: vol_rois() to measure current total ROI volume (vox=64) --tkmedit.c: fill_roi() has option to append to existing region --tkmedit.c: fill_roi() now has option to fill annotation region --tkmedit.c: add clear_rois() (was roi_fill auto-cleared each time) --lib/help/csurf/rc-surfaces,lib/help/tksurfer/surf: FlipHemi update --csurf/tksurfer.tcl: chklefthandedsurf: change subj re-arms chk left-handed --csurf: warn read *.srf (but not *.obj), kill popup after 8sec, twice only --tksurfer.tcl: warn read *.srf possibly left-handed (but not *.obj) --tksurfer.c: back to not-flipping BV coords (force use F3 interface FlipHemi) --tksurfer.tcl: rm "surf:" dropdown dups (rh.surftmp match, strip, *.obj re-add) --tksurfer.c: bail on read BV cols (color indices + RGB, req's POI file anyway!) --tksurfer.c: make_filenames: *obj,*srf leave hemi on fpref for stdfmt curv etc --tksurfer.tcl: select_surf try pre-append *.obj/*.srf if non-preappend missing --csurf: tksurfercmd: special case for non-freesurfer-style *.obj,*.srf names --csurf: =>w/no surfext prefix, can't tell if intended file is ?h.*.obj, *.obj --csurf: =>parallel to tksurfer:make_filenames() -> not found, try no preappend --csurf: fixsurfaces: only strip hemi from globbed surf tail if present! --csurf: fixsurfaces (fix "surface:" dropdown if newsubj): load all *.obj,*.srf --tksurfer.c: make_filenames: *.obj/*.srf, also chk surffile no hemi preappend --lib/help/tksurfer/outsurfobj_write: new helpfile, add to mk0 --tksurfer.tcl: add OBJ to F3 panel for write_obj_surface --tksurfer.c: write_obj_surface(): basic, colors, normals, colors+normals --tksurfer.c: order_all_faces(): arr faces around vtxs: unordered->same winding --tksurfer.tcl: load all *.srf regardless of hemi to "surf:" dropdown --csurf: load all *.srf regardless of hemi to "surface:" dropdown, fixsurfaces --tksurfer.c: make_filenames accepts no-hemi-prefix *.srf --tksurfer.c: read_binary_surface(): tri BrainVoyager .srf surf fmt (flip x!) --tksurfer.c: fish out find_annot_borders() --csurf: add Flip (FlipHemi) to all help panel --lib/help/tksurfer/fliphemi: new help file, add to mk0{.csh} --tksurfer.tcl: add "FlipHemi" button to REDRAW row on F3 interface --tksurfer.c: flip_faces(): used by really_flip_brain functions --tksurfer.c: fix read_binary_surface reading of *.off surfaces (export was OK) --tksurfer.tcl: "D" button uses read_obj_to_annot if *.obj suffix --tksurfer.tcl: also load $subject/surf/*.obj file to "label:" dropdown --tksurfer.c: read_obj_to_annot(): read just colors out of *.obj surf to annot --tksurfer.tcl: "D" button uses read_poi_annot if *.poi suffix --tksurfer.tcl: also load $subject/label/*.poi file to "label:" dropdown --tksurfer.c: read_poi_annot(): load poi file into mghannot/brainregion --lib/help/csurf/csurf, lib/help/tksurfer/surf, add .obj format --tksurfer.c: flip_normals() --csurf: load all *.obj regardless of hemi to "surface:" dropdown, fixsurfaces --tksurfer.tcl: load all *LH/RH*.obj to "surf:" dropdown --tksurfer.c: make_filenames accept any *.obj surf, detect maybe fixes hemi --tksurfer.c: read_binary_surface() accepts tri Wavefront .obj surface format --tksurfer.c: rename vertex struct members: vnum->vcnt, num->fcnt --tksurfer.c: really_flip_brain --tksurfer.tcl: also look-for/dropdown-load oldstyle valfiles in $subject/surf --mkrandlut(.tcl): new lib/tcl script (add to mk0) --tksurfer.c: add SLOPPAT=3 to neighop_val2stat->color patches w/stat int id's --tksurfer.c: neighop_val2stat SLOPPAT=3: non-overlap colpatches w/stat intid's --tksurfer.tcl: jam unlabeled $insidesurffact entry next to offset on F3 panel --csurf: add insidesurffact to all help --lib/help/tksurfer/insidesurffact: new helpfile, add to mk0 --tksurfer.c: insidesurffact to control relative brightness inside surface --csurf: also load surface dropdown with $inflatedext? $pialext? --csurf: accepts subject or session dir as arg --csurf: change default startup volume to orig (was T1) ########################################################################## PREVIOUS UPDATE: 16 Dec 2019 ########################################################################## --mk0{.csh}: add -viewerlin,-viewermac to make self-contained quickstart inst --tksurfer.c: rm redundant diploadedflag --tksurfer.c: add/export read_mgh_dipoles(): from $val (must be 3-frame .mgh) --tksurfer.tcl: lib/help/tksurfer/arrownorm: update --tksurfer.tcl: shift-right-clk on unlabeled arrowstick toggles dipolesflag --tksurfer.tcl: read .mgh val: check embedded *.rh/lh.* (vs. *-rh/lh.w), warn --tksurfer.tcl: wider "RD" dropdown list for rawdata BRIKs --{wrappers,tksurfer}.tcl: -selectforeground black for linux dti,regraw popups --tksurfer.c: paint_surface: if stat dims=0, subst rawdata dims, fail if both=0 --tksurfer.c: init xx0=xx1=yy0=yy1=zz0=zz1=0.0 (enable test unset, not yet done) --tksurfer.c: rename: push_val_dip() to copy_val_dip() [no history yet] --lib/tcl/zz-examples/renderoffscreen.tcl: respect previous rename --lib/tcl/{borders,eccen-,fs-make,phasemovie,polar-,twocond-*}.tcl: respect prev --tksurfer.c: rename: push_val_val2() to copy_val_val2(), push_ another synonym --tksurfer.c: if diploadedflag, printvtx reports it --tksurfer.c: calc avg len dip (for scale) --tksurfer.tcl: do_dtivec: force sample single cortical depth, update NormSamp --tksurfer.tcl: dtivecctrls: add parms for sampling surface, cortical depth ... ################################################################### UPDATE: 18 Jun 2021 ################################################################### ---------------------------------------------- Basic tests on new Mac processor ---------------------------------------------- To run this MacOS 10-compiled binary on Mac0S 11, you have to install Rosetta. Some basic tests suggests it works OK. Once I get an M1 machine, I will work on a native compile. ---------------------------------------------- Display data in subset of MGH annotation regions ---------------------------------------------- Once an MGH annotation has been loaded (with left-click "D" on the "label:" line), a second, alternate shift-R-click of the same "D" button will generate a context-sensitive popup. If no data overlay is present, the popup allows picking a subset of annotation regions to display (by idnum), for example, to show which region subset you may be using for an analysis. If a data overlay has been loaded, the requested subset of areas will mask the data (i.e., will only show data in listed areas). This is useful, for example, to see phase encoded data from annotation regions (easier than when using colored annotation borders, which partially overlap the data) ---------------------------------------------- Extract single MGH annotation region to label ---------------------------------------------- A new function can extract a single MGH annotation region along with any overlaid data to a label (e.g., to edit it): write_annotcol_to_label Once an MGH annotation has been loaded (using the "D" button), a shift-ctrl-R-click on the "label:" line "W" button generates a single ASCII label file from the currently clicked annotation region. To pick which region to extract, first click it, which loads its r,g,b values (into r,g,b fields right of "MESH" button). This also saves any displayed data currently in the .val(.val2) into the label (else zero if none displayed). The label file is auto-named using the current annotation region name, and is written into the subject's label directory, for example: ~/label/rh-R_a9-46v_ROI.label ---------------------------------------------- New tksurfer entry to adj red in red/green curv ---------------------------------------------- A new (unlabeled, right) entry on the "cmid:" line adjusts the brightness of the red in the red/green curvature display. For example, changing the default (=1.0) to 0.80 will dim the red (sulcus), which provides better luminance contrast for full color illustrations, better conversion to B/W, and better visibility for red-green colorblind. ---------------------------------------------- Better popup panel, functions for write_mgh_annot ---------------------------------------------- The pop-up panel for generating MGH annotation files from an MGH-style color lookup table, and a group of correspondingly-named individual-area labels has been improved. Here is an example of the format of the MGH-style color lookup table: #id region(=labelinfix) R G B A #-------------------------------------------- 0 0 Unknown 0 0 0 0 1 V1_lower 150 0 100 0 2 V1_upper 150 0 120 0 3 V2_lower 240 0 200 0 4 V2_upper 240 0 220 0 #-------------------------------------------- This is a small portion of the default LUT file: $CSURF_DIR/lib/lut/CsurfColorLUT.txt The corresponding label files to be assembled have to use the dash convention after the hemisphere, and would look like this for the right hemisphere (the same LUT file can be used for both hemispheres): $SUBJECTS_DIR/fsaverage/label/rh-V1_lower.label $SUBJECTS_DIR/fsaverage/label/rh-V1_upper.label $SUBJECTS_DIR/fsaverage/label/rh-V3_lower.label $SUBJECTS_DIR/fsaverage/label/rh-VP_upper.label You get the popup panel by ctrl-mid-clicking the "W" on the "label:" line. The new panel shows the the input ColorLUT file (all *.txt files in $CSURF_DIR/lib/lut are loaded into dropdown) and the output *.annot file (all existing *.annot files in $SUBJECTS_DIR/$subject/label are loaded into the dropdown). The default output *.annot name was changed to: $hemi.MY_ANNOT.annot to avoid accidentally overwriting the label file currently selected in the "label:" dropdown. The function read_mgh_colorlut() now catches and blocks duplicate annotation region id numbers or duplicate region colors. The function write_mgh_annot() now ignores missing individual label files, omitting them from the output annotation (the interface reports any missing). ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- default NormSearch in Setup Funct panel now "frac" (80%) alt mid-click-GOTO finds equivalent opposite hemi point (best for fsaverage) "D" (display) MGH annotation generates name/regid/LUT-colors popup ima2brik uses to3d EPI -tpattern => FROM_IMAGE, also ignores scans 101-109 input patch/surf names visible before start sphere/flatten movies tcl scripts now interruptable L-Shift select "patch:" to block auto-load (for using patch as surf mask) script control of meshline thickness (for hi-res offline render) xterm cover/uncover hack works less well, now used if Yosemite->HighSierra (can still force w/csurf -hack) added hacked recon-all for 7.1.1 to allow restart w/edited orig.mgz new popup panel arrows/gradients control (R-click tick at bottom of "phc") report/allow missing label files for MGH color LUT used by write_mgh_annot ########################################################################## UPDATE: 18 Jun 2021 ########################################################################## --lib/help/tksurfer/{label_write,label_write_annot} --tksurfer.tcl: write_mgh_annot: allow mk annot w/label files missing (C now OK) --tksurfer.c: write_mgh_annot: report/ignore missing label files --csurf: fix wasn't passing -softtruncphaseflag to tksurfer in Render panel --tksurfer.tcl: fix stale hard/soft truncphase message --tksurfer.c: read_mgh_colorlut bail on duplicated color --tksurfer.tcl: alt mid-click-GOTO finds opposite hemi point --tksurfer.c: select_opphemi_vertex_coordinates: find fsaverage pnt other hemi --tksurfer.c: add intern flag (norm/opp) to select_orig_vertex_coordinates --tksurfer.c: write_mgh_annot: cnt vtxs for region popups (like read_mgh_annot) --tksurfer.tcl: write_mgh_annot: gather/report all missing label files --tksurfer.tcl: searchlight correlation popup tells label vs. annot region --tksurfer.tcl: write_mgh_annot: also chk dup cols --csurf: NormSearch def now frac=0.8 (paint/paintmulti chk for thickness file) --wrappers.tcl: okreplace allows alt "REPLACE" box text (e.g., PROCEED) --tksurfer.tcl: "label:" line "C" overloads warn missing file, allow cancel --tksurfer.tcl: "label:" line plain "D" warns missing file (vs. just log) --tksurfer.c: write_mgh_annot: overlap->.pval (vs. .stat), swap cmplx, find bord --tksurfer.tcl: write_mgh_annot: chk dup reg ids (else silent Cfucnt log fail) --lib/help/tksurfer/{fmid,sfmid,fslope,sfslope}: update w/e.g. raw Fourier --tksurfer.tcl: normal move "N" on F3 panel does compute_normals_areas --csurf/tksurfer.tcl/tkmedit.tcl: make proc editfile more parallel --tksurfer.c: read_mgh_colorlut bail on duplicated region idnum --tksurfer.tcl: write_mgh_annot: check files for each LUT region exist --lib/help/tksurfer/{label_write,mesh,arrownorm,complexval}: update --tksurfer.tcl: "cpx" tick catches/fixes blank disp w/inconsistent real/cpx --tksurfer.tcl: new arrownorm tick/entry controls pop-up on R-click help --tksurfer.tcl: make_mgh_annot: allow skip show overlap, alpha=255 --wrappers.tcl: okreplace allows alt "Cancel" button text --tksurfer.tcl: make MGH annot popup now has full paths and loaded dropdowns --csurf: subject/sessions auto select if only one pattern match --dist/patch/Tix8.4.3/DirList.tcl: strip vpath/npath double-slash crasher --csurf: chk editor: /System/Applications/TextEdit.app/Contents/MacOS/TextEdit --lib/help/tksurfer/{cmid,dimredcurvfact}: update --tksurfer.tcl: jam dimredcurvfact next to cmid --tksurfer.c: add/export dimredcurvfact for set_curv_color() better contrast --lib/help/tksurfer/{label,label_write}: update --tksurfer.tcl: 8th overload "W" butt to extract 1 MGH annot region to label --tksurfer.c: add write_annotcol_to_label() to extract data from 1 MGH annot --tksurfer.c: add internal: annotcol2brainregionindex() --tksurfer.tcl: display "D" annotation pops up areas def color table --tksurfer.c: timeout annotation region report popup (2.5 sec) --tksurfer.tcl: fix report wrote transparent after cancel --wrappers.tcl; helpwin: chk exists again for period subst'd out win name --lib/help/tksurfer/{label_read,label}: update --tksurfer.tcl: fork shift-right-D popup: if !valloaded -> show annot subset --tksurfer.c; annot display respects brainregion[].maskflag (prev:just maskval) --csurf: reconall req freesurf buildstamp sub-sub-vers for safety (e.g., 7.1.1) --mk0{.csh},lib/help/csurf/reconall: add recon-all7.1b --csurf: recon-all start w/edited orig.mgz works MGH FreeSurfer7.1 (was 5.3/6.0) --add: bin/noarch/recon-all7.1b --movie360.tcl/inflatemovie.tcl/flattenmovie.tcl: interruptable --wrappers.tcl: click RUNNING in .controls sets new global purplekillcontrols --fix FreeSurfer.sh permisions (chmod go+r): was break /usr/local install --lib/help/tksurfer/scripts_*: notes on how to kill (not "RUNNING" button) --csurf: bgsequencewin optional title, use to show Flatten,Sphere/Register inps --mk: more informative error messages (e.g., try run immed after untar) --tksurfer.tcl: fix fail restore patch view on reload *same* patch over 3d --tksurfer.tcl: fix fail load *same* 3d surf after displaying a flat patch --csurf: use -listcmd to live update patches dropdown (e.g. tksurfer wrote new) --tksurfer.tcl: fix stuck shiftkeypressed for R/W patch (how does this happen?) --lib/help/tksurfer/script_movie360 update --tksurfer.c add really_center_patch() for rotate movie, offcent cereb patches --tksurfer.tcl: select_curv sets surfcolor=1 to display curvature in case gray --tksurfer.c: write_binary_surface unsets surfeditedflag --lib/help/tkmedit/coronal: help on flip/align surface to flipped 3D dataset --csurf,tksurfer.tcl,tkmedit.tcl: uncov xterm fails: use: Yosem=14 to HighSi=17 --tksurfer.tcl: select patch for mask/cut: Shift stops "patch:" dropdn autoload --lib/help/tksurfer/{mesh,saveview,cutplane}: updates --tksurfer.c: cut_plane OK w/>4 marked -> use last 4 --tksurfer.tcl: PLANE complains in pop-up (vs. just invisible csurf log) --tksurfer.c: export meshline (script only) ########################################################################## PREVIOUS UPDATE: 28 Jun 2020 ########################################################################## --csurf: fix bug in -nohack option --tksurfer.tcl: SAVE/GOTO add-suffix-to-viewmatrix popups show avail suffixes --csurf: add lights,blufact to all-help --mk0: combine lib/help/tksurfer/light{1,2,3,4} -> lights --tksurfer.tcl: better help for the lights --tksurfer.tcl: bold the "View" butt (curr saved matrix popup), report saved dir --lib/help/tksurfer/script_searchligharea: update --FreeSurfer.sh: fix zsh path parsing --tksurfer.tcl: force load example-res mgz file before FILL3d, write_fill_images --tksurfer.tcl: also load subjectdir *.mgh files into "val:" dropdown (areas) --tksurfer.tcl: 6th overload S/V with swap_origarea_val --tksurfer.c: add swap_origarea_val() -> .origarea loaded at start w/areafile --tksurfer.c: add copy_area_curv() (fix so-far-unused copy_area_val() bug) --tksurfer.c: export threadcnt (def=8), incl opt/env --tksurfer.tcl: blk reabbrev callbacks curv/area in sessdir (was just subjdir) --searchlightarea.tcl/mk0: new script ... ################################################################### UPDATE: 24 Mar 2022 ################################################################### ---------------------------------------------- New visual/auditory/somato fsaverage parcellation ---------------------------------------------- A new csurf parcellation (from Sereno, Sood, and Huang, 2022) is included in this distribution: $CSURF_DIR/subjects/fsaverage-ADDITIONS/rh-CsurfMaps1.annot $CSURF_DIR/subjects/fsaverage-ADDITIONS/lh-CsurfMaps1.annot It has also been converted to a GIFTI label file: $CSURF_DIR/subjects/fsaverage-ADDITIONS/rh-CsurfMaps1.label.gii $CSURF_DIR/subjects/fsaverage-ADDITIONS/lh-CsurfMaps1.label.gii Both file types are compatible with csurf and MGH FreeSurfer (and GIFTI with HCP utilities). The parcellation contains 117 areas in each hemisphere, which accounts for about 47% of the total neocortical surface area. For details, see Sereno, Sood, and Huang (2022), Frontiers in Neuroscience (in press). ---------------------------------------------- Script example vertex cols assembly, render hi-res ---------------------------------------------- A new example tcl script shows how to assemble vertex color files from different modalities (different color scales on same image), and how to render higher-than-screen-resolution images off-screen: $CSURF_DIR/lib/tcl/zz-examples/assemble-render-maps.tcl ---------------------------------------------- Pop-ups for overloaded buttons and tickboxes ---------------------------------------------- Most of the buttons on the "label:" and "val:" lines have acquired waaay too many overloads (click plus key(s) combinations) for alternate actions. A R-click help on eight of these now also makes a pop-up with verbosely labelled buttons to individually control all the alternate actions. These include the "D", "C", "CLR", "R", and "W" buttons on the "label:" line, the "S/V" and "W" buttons on the "val:" line, and the "GR" button on the "fs:" line (for displaying gradient arrows). A R-click help on the leftmost tickbox on the "label:" line already puts up a popup to control multiple label flags more conveniently. Similar popups have been added to the R-click help for the the tickbox to the left of the "fs:" line (for controlling gradients display), and the tick at the bottom of the middle left "phc" box (for controlling arrows, normals, and points display). ---------------------------------------------- tksurfer write_mgh_annot output more compatible ---------------------------------------------- Csurf tksurfer write_mgh_annot originally followed the spec for annot file format here: https://surfer.nmr.mgh.harvard.edu/fswiki/LabelsClutsAnnotationFiles Although csurf tksurfer read_mgh_annot can accept an *.annot file containing non-sequential region idnums, these files will crash mris_convert and may not be read properly by freeview, which use similar utils/colortable.c functions. Therefore, the idnums in the *.annot output files now generated by tksurfer write_mgh_annot are re-numbered sequentially. A second workaround to avoid mris_convert crashes and freeview fail-to-reads is that the maximum region idnum field in the output *.annot is incremented by 1 over the actual value (tksurfer read_mgh_annot accepts either incremented or actual max idnum). This makes it possible to convert csurf-generated annotation files to GIFTI with mris_convert, and to display them in freeview. Sorry for not doing more thorough compatibility testing earlier. ---------------------------------------------- read_gifti_to_annot ---------------------------------------------- A new C/tcl function, read_gifti_to_annot, was added to read GIFTI files that contain a FreeSurfer annotation. These xml files contain a FreeSurfer color table followed by a region number for each vertex. Any available *.gii files are now loaded into the "label:" line entry dropdown, and "D" will automatically display them. So far, only tested on the *.gii output of mris_convert. ---------------------------------------------- labeled_cut_clearvals <0=label,1=hole> ------------------------------------------- A new C/tcl function, labeled_cut_clearval works like the existing read_label_cut_clearval, but uses currently displayed label(s) to cut a label (or cut a hole out) instead of reading a label file to do these things. This can be used, for example, to mask activations in preparation for making a vertex color label. ------------------------------------------- currcol_to_vtxcol ------------------------------------------- Copy the current color at each visible vertex (as controlled by current settings of colscale, etc) to the fixed vertex color "paint" fields (.vr/.vg/.vb). This can be used to assemble illustrations containing data that uses different color scales. To save the vertex colors as a file, use ctrl-R-click W on the "label:" line (tcl/C function: write_vtxcol_label). Be sure to start with a clean vtxcol slate by middle-click-CLR on the "label:" line, else any previously copied vtxcols will be included in final .cols file. Also, if you want to assemble multiple vtxcol's, be sure a label has been re-cut so the whole surface won't be saved to the vtxcol label. This can also be done in one step by converting a standard label directly to a vertex color label using middle-click W on "label:" line (tcl/C function: label_to_vtxcol_label). ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- re-cut label now clears vertex marks (fix stray add/cut with PTS) popups for overloaded buttons now left of main panel, help above various vtxcol ("paint") upgrades mid-clk-R on "rgb:" line displays all saved tiffs recognize arm64, tmp classify as x86_64 new ROI fill types: stat AND real/hypot compute_gradient/compute_surfgrad -> also respects sfthresh if statmask fixed truncated ic6.tri allow back out of more operations on "label:" and "val:" lines ROI can do AND of stat and complexamp restored/fixed mac_appnap_hack for 10.14, 10.15 non-eroding fill for adjacent 1 vertex overlap popup to control pointsize new popups for too-overloaded buttons better bail-out for write buttons don't mess with env var LANG! (borks xterm from xterm on some mac 10.15) fix transparent mpeg_play on CentOS 7 ########################################################################## UPDATE: 24 Mar 2022 ########################################################################## --csurf: list other brik2cor options on setup struct panel --csurf: setup structs: 3-way opt (cancel, use, don't use) if no -zeropixwidth --csurf: double-clk setupscans upper-left "Session:" label for current location --csurf: block check scandir callback from set iscandir if aspect equals struct --csurf: double-clk setupscan panel raises csurf only from bottom buttons frame --csurf: Setup Structural Scans auto-converts *.nii (AFNI 3dcopy) --lib/help/tksurfer/read_im{2,3}: example set infile names --lib/help/tksurfer/col1col2: new helpfile, add to mk0{.csh} --tksurfer.tcl: helpwins for F3 panel col1,col2 for "bi" scale --lib/help/tksurfer/val2rgb_{read,write}: explicit example set in/out filename --wrappers.tcl: controls,buttonbar: mv panel right of tk b/c far left tkmedit --wrappers.tcl: controls,buttonbar: mv panel below GL if F3 b/c tksurfer F3 top --lib/help/tksurfer/outsurf{NULL,asc,glb,obj,off,stl,vtk}_write: update --wrappers.tcl: helpwin: mv less right for narrow tksurfer F3, small tkmedit GL --csurf: all-help panel: separate read/write (SurfaceR,SurfaceW), c2lab to Label --tksurfer.tcl,mk0: rename helpfile: hemisurf->insurf_read, bind F3 insurf "R" --tkmedit.c: nudge startup GLX glxwinx0 back to right (for left Mac dock) --tkmedit.tcl: SAVEIMGS ignores post-startup $inoutim change (write 1st read-in) --lib/help/tksurfer/{patch,curv,area}_{read,write,mask,cut}: explicit set file [tmprelease: 220220] --tksurfer.c: rm unused fname arg from corr_over_annotcol --lib/help/tksurfer/label_{read,readcut,clear,write,timecourses,stat,corr}: e.g. --lib/help/tksurfer/val_{read,clust,write}: explicit example set in/out filename --lib/help/tksurfer/script_phasemovie: document how to deal with wrap --csurf: movie panel plays mpgdir mp4/m4v's w/QuickTimePlayer (mac), vlc (lnx) --tksurfer.tcl: 2D/3D gradient arrows respect annotmaskflag just show unmasked --tksurfer.tcl: ctrl-right-R,W bind update vclabel so confirm msg not stale --tksurfer.tcl: ctrl-right-R,W bind: fix forgot to read curr entry to label! --lib/help/tksurfer/label: update with *.cols, *.cols format [tmprelease: 220115] --lib/help/tksurfer/{label,label_read,annot}: update --add to dist: dist/fsaverage-ADDITIONS/surf/?h.cortex2a.patch.flat, mk tarfile --add to dist: dist/fsaverage-ADDITIONS/surf/?h.cortex2a.patch.flat, mk tarfile --mris_convert --annot ../label/{rh,lh}-CsurfMaps1.annot ../surf/{rh,lh}.white \ ../label/{rh,lh}-CsurfMaps1.gii (FreeSurfer5.3) => dist/fsaverage-ADDITIONS --tksurfer.c: skip do all glx events if offscreen: resizes win to max onscreen! --lib/help/tksurfer/label_read: update --tksurfer.tcl: final overload of D button: currcol_to_vtxcol --tksurfer.c: add/export currcol_to_vtxcol(): only visible vertices are copied --tksurfer.tcl: writevtxcols checks no vtxcols loaded, wrong suff --csurf: double-click on render panel raises small main (no way from tksurfer..) --tksurfer.c: clear_annot() also clears .annotbord --tksurfer.c: add arg: clear_vertex_marks_list(reportlog=1): no log intern use --csurf: showlogs raises main csurf window (helps w/many csurf's) --tksurfer.c: select_vertex miss selected to -1; all selected users now check --tksurfer.c: read_label_cut_clearvals -> clear_vertex_marks_list: fix weird PTS --tksurfer.tcl: bind cmd/alt-z to UNDO cut butt, R-click help on 2 more popups --wrappers.tcl: add thin space for buttonbar, helpwin lower --tksurfer.tcl: fix auto-run default scripts (after cmd->bind so can use break) [tmprelease: 211229] --csurf: add appnap startup hack b/c ugly startup --tkmedit.tcl: increase appnap hack to 2000 msec --lib/help/tksurfer/label_readcut: update --tksurfer.tcl: allow bail on re-run startup script --tksurfer.tcl: add labeled_cut_clearval to "label:" line "C", buttonbar popup --tksurfer.c: add/export labeled_cut_clearvals(), cf. read_label_cut_clearvals --tksurfer.tcl: remove buttonbar popup delay (wrappers.tcl now moves it aside) --wrappers.tcl: position buttonbar,controls left of tk, helpwin up/right on GLX [tmprelease: 211220] --lib/help/tksurfer/label_read: update --tksurfer.tcl: 3rd vers DISPLAY SUBSET/MASK OVERLAY popup for vtxcol subset --tksurfer.c: pick idnums/annotmaskflag works w/vtxcol overlays (was:annot,val) --lib/help/tksurfer/{label,label_read}: update --tksurfer.tcl: "label:" entry/dropdown also loads *.gii's, "D" displays --tksurfer.c: add/export read_gifti_to_annot() (only test: mris_convert output) [tmprelease: 211202] --tksurfer.tcl: accept $hemi-.label format for csurf annot files --tksurfer.tcl: lut2annotcrtsl/do_lut2annot: global combovar update hacked cbx's [tmprelease 211120] --tksurfer.c: read_mgh_annot(): more err check --tksurfer.c: write_mgh_annot(): workaround mris_convert crash: idmax++,renumber --tksurfer.tcl: buttonbars pop/re-create corresponding help, shortcuts incl butt --wrappers.tcl: optional arg to buttonbar to bind helpfile [tmprelease 210923] --tk{surfer,medit}.tcl: increase Mac uncover redraw hack delay to 2000 msec --tksurfer.tcl: {read,write}vtxcols,labeltovtxcol cleanup, better vtxcol warn --tksurfer.tcl: readvtxcols accepts *.col in addition to autoconverted *.label --lib/help/tksurfer/{label_write,angle_offset,rgb_write,rgb_write2}: updated --tksurfer.tcl: final overload for "label:" line "W": write_vtxcol_label --tksurfer.c: add/export write_vtxcol_label: curr vtxcols AND visible --tksurfer.tcl: dup write_mgh_annot comment-in/out: {exclude,include}_following --tksurfer.tcl: fix nagging vtxcolflag=ON popup -> once only per new read --tksurfer.tcl: fix logging for vtxcol labels --tksurfer.c: add/export read_label_to_setvalval2 --tksurfer.c: read_label_cut_clearvals(CUTNOCLR):fix recursive non-eroding hack --tksurfer.tcl: warn hidden label for ROI button (similar to FILL) --tksurfer.tcl: remaining file not found popups for "label:" line "D" and "R" --tksurfer.c: label_to_vtxcol_label: use curr loaded stat (1.0 was desaturated) [tmprelease 210911] --getonearch{.csh}: recognize proc=arm64, tmp classify as x86_64 --tksurfer.tcl: buttonbar for "label:" line "R" button R-click help --tksurfer.tcl: buttonbar for "label:" line "CLR" button R-click help --lib/help/tksurfer/comp_grad: update --tksurfer.c: compute_gradient/compute_surfgrad: mask arrs w/sfthresh if statmsk --tksurfer.tcl: dup arrowscale/arrowline in gradient popup (unlabeld fs tick) --tksurfer.c: inplane rot: ctrl-arr -> shift-ctrl-arr b/c 10.15 ctrl-arr=maxmize --tksurfer.tcl: write_mgh_annot: reverse Skip/ShowOverlap, so skips --lib/help/tksurfer/{label_clear,label_write}: updated --tksurfer.c: read_mgh_colorlut() respects "### {include,exclude}_following" --tksurfer.tcl: ctrl-middle-click on CLR does clear_annot_with_col mesh rgb --tksurfer.c: add/export clear_annot_with_col(r,g,b) --tksurfer.c: restore_ripflags SWAP_CURR_OLD, SAVCURR_MKORIG now don't unmark --lib/help/tksurfer/{roi,statmaskamp}: update --tksurfer.tcl: ROI: ctrl-mid-clk overload statANDrealflag mask tick (radio-ize) --tksurfer.tcl: ROI: if real+stat, force choice between stat vs. stat AND real --tksurfer.tcl: ROI: if cmplx+stat, force choice between stat vs. stat AND hypot --tksurfer.c: new filltype=STREFILL: real>fthresh AND stat>sfthresh --tksurfer.tcl: hack: fix Return in arrowscale in popup bound to arr->col butt! [tmprelease] --tksurfer.tcl: CLR single label now reads current combo entry, not found err --lib/help/tksurfer/{roi,statmaskamp}: fix confusing typos! --ima2brik: better checking for -di2sub option [tmprelease] --stripairPD.tcl: new standard lib/tcl script, add to mk0{.csh} dist --tkstrip.c: def outim tmp->tmp.mgz, action5,6 set dfrac before init_surf_to_im --tkstrip.c: add action=6: shrink on inim, read/peel orig.mgz, outim tmp.mgz [tmprelease 210731] --lib/bem/ic6.tri: fix truncated file --tkstrip.c: read_geometry crash from reading truncated *.tri file --tkmedit.tcl: increase appnap xterm 300->800 msec (same as tksurfer.tcl) --csurf: procs using mri_surf2surf, check/blk '#' in {FUNCTIONALS,SUBJECTS}_DIR [tmprelease 210722] --tksurfer.tcl: middle-click-R on "rgb:" line shows all tiffs in nmovie --tksurfer.tcl: FILL warn eroding/non-eroding fill --tksurfer.c: !erodingfillflag retains FILL-like 1-vtx overlap label hole/add --csurf: reinstate macos 10.{14,15) mac_appnap_hack=1 --tksurfer.tcl: inc appnap_hack delay 500->800 msec (works 10.15) --lib/help/tksurfer/{roi,statmaskamp}: update --tksurfer.tcl: middle-click overload statANDhypotflag to mask tick --tksurfer.tcl: fix weird bug by always destroy/remake labeltickctrlswin --tksurfer.c: new filltype=STHYFILL: hypot>fthresh AND stat>sfthresh --tksurfer.tcl: allow back out of "label:" line CLR's --tksurfer.tcl: redrawbutton warns vtxcolflag on --lib/help/tksurfer/angle_cycles: ref linrampphase2vtxcol doc angle_offset --tksurfer.tcl: allow back out of "val:" line CLR's --lib/help/tksurfer/label_clear: update --tksurfer.tcl: overload for "label:" line "CLR": read_label_to_clear_annot --tksurfer.c: add/export read_label_to_clear_annot() --tksurfer.tcl: add pointsize, mesh/rgb to labeltick controls win --tksurfer.tcl: extra labeltick ctrlswin button RESTORE ANNOT BORD undo PRUNE --tksurfer.c: annotborddotflag uses pointsize/meshrgb to adj annot dot bord --tksurfer.c: export find_annot_borders() [tmprelease 210708] --tksurfer.tcl: buttonbar for "label:" line "D" R-clk help (disp,conv3d,mak,etc) --tksurfer.tcl: allow escape from all S/V button actions --tksurfer.tcl: buttonbar for "val:" line "S/V" butt R-clk help (various swaps) --tksurfer{.c,.tcl}: confirm toggle bigcursorflag GLX and tk --tksurfer.c: bigcursorflag makes write_selected_list_to_label save neighbors --csurf: Preferences -> Cover/Uncover Speedup Hack (mac_appnap_hack) if Mac --tksurfer.tcl: controls for 4-overloaded unlabeled "fs:" tickbox (grad arrows) --tksurfer.tcl: buttonbar "fs:" "GR" button Rclk-help (calc gradient arrows) [tmprelease 210627] --mk0{.csh}: distinct inst date (README.txt, csurf help), dist date (src file) --dist/patch/mpeg_play-2.3/util32.c: linux maxdepth -> 24bit to fix transparent --FreeSurferEnv.{sh,csh}: rm change LANG (broke start xterm from xterm mac10.15) --tksurfer.c,tcl: rename write_annotcol_to_label -> write_annotedcol_autoname --tksurfer.tcl: allow bail from all "label:" line writes --tksurfer.tcl: allow bail from all "val:" line writes --tksurfer.tcl: buttonbar "val:" "W" butt Rclk-help (vals,FT2amp,sphims) --tksurfer.tcl: buttonbar "label:" "W" butt Rclk-help (label,vtxcol,annot,etc) --tksurfer.tcl: write_mgh_annot: restore overlay if skip count overlap --wrappers.tcl: allow mult buttonbar's uniq'ed by 1st cmd proc (raise existing) --lib/help/tksurfer/arrownorm: update --tksurfer.tcl: add pointsize, pointsflag to ARROWS/NORMALS/POINTS controls --tksurfer.c: export pointsize --tksurfer.tcl: buttonbar "label:" "C" butt Rclk-help (recut,hole,add,recutuniq) --wrappers.tcl: optional title for buttonbar --csurf: Setup Sphavg help: open correct help rather than just warn ########################################################################## UPDATE: 14 Jun 2021 ########################################################################## --lib/help/tksurfer/{label_write,label_write_annot} --tksurfer.tcl: write_mgh_annot: allow mk annot w/label files missing (C now OK) --tksurfer.c: write_mgh_annot: report/ignore missing label files --csurf: fix wasn't passing -softtruncphaseflag to tksurfer in Render panel --tksurfer.tcl: fix stale hard/soft truncphase message --tksurfer.c: read_mgh_colorlut bail on duplicated color --tksurfer.tcl: alt mid-click-GOTO finds opposite hemi point --tksurfer.c: select_opphemi_vertex_coordinates: find fsaverage pnt other hemi --tksurfer.c: add intern flag (norm/opp) to select_orig_vertex_coordinates --tksurfer.c: write_mgh_annot: cnt vtxs for region popups (like read_mgh_annot) --tksurfer.tcl: write_mgh_annot: gather/report all missing label files --tksurfer.tcl: searchlight correlation popup tells label vs. annot region --tksurfer.tcl: write_mgh_annot: also chk dup cols --csurf: NormSearch def now frac=0.8 (paint/paintmulti chk for thickness file) ... ################################################################### UPDATE: 02 Oct 2022 ################################################################### ---------------------------------------------- New function: write_adjphase_vertices ---------------------------------------------- Prompted by a request from Sam Schwarzkopf, I added a new function to tksurfer available by a shift-right-click on the "label:" line "W" button (or more conveniently from the R-click pop-up button menu): write_adjphase_vertices During normal operation, the complex-valued phase in Fourier analyzed data is processed on the fly to generate an interactively tweakable color map. But the underlying phase data - which contains offsets due to hemodynamic delays as well as the starting stimulus position, as well as phase reversals for opposite hemispheres - is never modified by csurf. This function provides a way to generate a complex-valued label with estimated polar angle that removes those offsets and reversals. It requires that the original complex-valued Fourier analyzed polar angle data has been loaded, and that $angle_cycles is set to a non-integral value (like 1.0001, to trigger a polar angle color scale). This function takes account of the settings of $angle_cycles, $angle_offset, $revphaseflag, and $invphaseflag to write out an adjusted phase. To obtain a label file containing polar angles approximately between -pi/2 and pi/2 (positive for the upper field, and negative for the lower field, same for either hemisphere) given a standard 64-sec cycle mapper stimulus starting at zero degrees (right horizontal meridian) and progressing in a counterclockwise direction, adjust those parameters for each hemisphere approximately as follows, before calling write_adjphase_vertices: ### right hemisphere set angle_cycles 1.001 set angle_offset 0.96 set revphaseflag 1 ### left hemisphere set angle_cycles 1.001 set angle_offset 0.46 set revphaseflag 0 The phases are written out as a 6-arg, ASCII label file containing amplitude 1 complex numbers. Increasing $angle_cycles will linearly expand the range of polar angles in the output file. This can be useful for data averaged across subjects, where there will be a reduced range of polar angles due to slight intersubject spatial offsets, especially in the case of small visual areas. This causes a 'regression to the horizontal meridian' in cross-subject average data (too much blue). To interactively check what the output will be, click a vertex and check the value of "adja" in the csurf log (final value on the first log line output from a click on a vertex). Ignore the displayed colors (which will be reversed from the 'standard' polar angle scale, which is lower/horiz/upper -> green/blue/red). If the resulting adjusted phase label file is read back in, to verify that the polar angles in it are correct, click a vertex and look at the val/val2 phase angle on the third log line output from a click on a vertex, *not* the value of "adja", which will now, confusingly, be re-adjusted. To see the standard colors for the adjusted data, set parameters as follows (N.B.: same for both hemispheres, since always right hemifield): set angle_cycles 1.6 set angle_offset 0.5 set revphaseflag 1 ---------------------------------------------- New update script: update-csurf ---------------------------------------------- A new script, update-csurf (sh), downloads the latest csurf and automatically installs it in the current directory (currently working for 64-bit mac and linux). If there is already a csurf installed in the current directory, it is first moved aside/renamed with its release date suffix (e.g., csurf-220912). The newly installed csurf will be just 'csurf'. N.B.: On Mac, if you download the csurf tarfile using a browser and click it to unpack it, it will be marked with the quarantine metadata flag. You can remove this from the command line with: sudo xattr -r -d com.apple.quarantine csurf The update-csurf script uses curl (on Mac) to download the tarfile and tar to unpack it, which *won't* mark the result as quarantined. ---------------------------------------------- New update script: update-fsaverage ---------------------------------------------- The second new script, update-fsaverage (sh), can be used after csurf has been installed. It updates the subject 'fsaverage' in the current SUBJECTS_DIR with the new CsurfMaps1 parcellation (annotation gii files) from Sereno, Sood, and Huang (2022), along with the fixed surfaces and flattenings used there. These files are copied from $CSURF_DIR/subjects/fsaverage-ADDITIONS. The 'fsaverage' subject in SUBJECTS_DIR must be writable (e.g., a copy of the 'fsaverage' in the FreeSurfer distribution). The files installed include: (1) annotation/parcellation files lh-CsurfMaps1.annot lh-CsurfMaps1.label.gii rh-CsurfMaps1.annot rh-CsurfMaps1.label.gii (2) updated fsaverage inflated_avg surfaces The artifactual large triangles at the 'poles' of the inflated_avg surface in the standard FreeSurfer distribution are fixed and the original files moved aside. (3) more verdical average .area files These are made from inflated_avg, the average of inflated surfaces instead of the average of smoothwm/white. Surface-averaging folded surfaces (e.g., smoothwm) removes idiosyncratic sulcal 'crinkles', reducing overall average surface area in the sulci by almost one-third. The inflated_avg surface avoids this anisotropic shrinkage by first inflating, then averaging. Original .area files are first moved aside with an ORIG suffix for easy revert. (4) True-area flattenings made from fixed inflate_avg The flattenings in the standard FreeSurfer distribution are made from the 'inflated' surface, which has been made by inflating the anisotropically shrunken average 'smoothwm' surface. New un-shrunken flattenings were made from the inflated_avg surfaces: {lh,rh}.cortex2.patch.3d {lh,rh}.cortex2.patch.flat {lh,rh}.cortex2a.patch.flat The relaxation cuts are not extremely deep, so the surface can't relax to its full original surface area. The curr surface area of the two flattenings are 73% of the surface area of the original cut 3d inflated_avg surface. To correct for this in a final image (e.g., to show inflated and flattened at same scale), scale up the flat bitmaps 1.17x (relative to the 1 cm scale bar on the image): 1.17 = sqrt(1/0.73) Or, alternatively, you can just shrink the scale bar by: 0.854 = sqrt(0.73/1) The square root is because scale factors are 1D linear, not area. (5) Figure images This are accessible from csurf -> SubjectTools -> View Saved Subj Bitmaps (saved as tiffs in $SUBJECTS_DIR/fsaverage/rgb). ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- fixed swapped fthresh/sfthresh mask in mask in compute_surfgrad (grad arrows) fixed IRIX and PPC compiles :-} csurf title bar shows tarfile date on startup or Help -> Csurf better kill for multiple instances of Tools -> View Saved Bitmaps ########################################################################## UPDATE: 02 Oct 2022 ########################################################################## --fsaverage-ADDITIONS: update README.txt's, add update-csurf/fsaverage --mk0: insttmp asks OK rm /tmp/csurf, /tmp/Csurf.app --lib/help/tksurfer/label,label_{readcut,clear,read2val,write}: update --csurf: print README.txt tarfile date (if there!) into csurf title bar --bin/noarch/update-csurf: new sh script, added to mk0 --bin/noarch/update-fsaverage: new sh script, added to mk0, fsaverage-ADDITIONS --tksurfer.c: add strcpyrmhemi() to avoid strcpy restrict violations (4 places) --tksurfer.c: read_mgh_annot now runs set_annot_alpha(255) (also obj,poi,gii) --tksurfer.c: restrict: (1) if obj mod thru ptr (2) r/w only allowed by that ptr --tksurfer.c: no strcpy to origvar: restrict'd arg: 2 ptrs can't access 1 thing --tksurfer.c: 10.6-compiled is fine, restrict crash appeared w/10.15 compile --tksurfer.c: alfname/$annot def: CsurfMaps1, read_mgh_annot autoresets alphs --fourier.c: strsep -> strtok for IRIX --{tksurfer,tkmedit}.tcl: recognize IRIX64 so libTix8.4.3.so loads on sgi --tk{surfer,medit,register}.c: incl zsh explanation in warning unset env var --tkregister.c: IRIX: re-add CWBorderPixel, rgbabuftoscreen ifdef glDrawPixels --tkmedit.c: IRIX: add CWBorderPixel attr, drawslice{2} IRIX ifdef glDrawPixels --tksurfer.c: fix IRIX: rm #if 0'd singlequotes, re-add CWBorderPixel attr --csurf: recognize IRIX64 so libTix8.4.3.so loads on sgi --mk0: fix IRIX libezxml compile, tgz's, add rmcm, rm now stale mk0.csh --tksurfer.c: write src annot/gii file comment in subj/sess scripts/.ctab --tksurfer.c: printvtxdata dumps adjusted colorscale angle (adja), baks only !0 --lib/help/tksurfer/label_{read,write}: update --tksurfer.c: linrampphase2vtxcol: min redraw not working yet, commented out --tksurfer.c: linrampphase2vtxcol comment out redraw to avoid redo set_color --tksurfer.tcl: checklabelfile: warn read cmplx label as if real and vice versa --tksurfer.tcl: 11th overload Shift-R-clk-"W" "label:": write_adjphase_vertices --tksurfer.c: write_adjphase_vertices(): adjusted non-integer angle_cycles phase --tksurfer.tcl: RESTORE rot subj w/"cereb" in name to posterior (vs. side) view --csurf: rotate any subj with "cereb" in name to posterior (vs. side) view --csurf: fix SubjectTools -> Inflate Surface Patch (was calling mkfinalsurfaces) --csurf: repeat Help ExpertPref: RmSkull,FilterWM,FillWM,InflateP,Flatten,Sphere --help/csurf/fillhires: update w/fill arbitrary volume example --csurf: getcmdpidnam: add'l cmdpid's for better kill w/multiple bitmaps wins --tkmedit.c: in all3views, click in subfield changes plane (duh!) for arr butt --dist/fsaverage-ADDITIONS: updated rgb/mpg --tksurfer.c -- fixed swapped fthresh/sfthresh mask in compute_surfgrad ########################################################################## UPDATE: 24 Mar 2022 ########################################################################## --csurf: list other brik2cor options on setup struct panel --csurf: setup structs: 3-way opt (cancel, use, don't use) if no -zeropixwidth --csurf: double-clk setupscans upper-left "Session:" label for current location --csurf: block check scandir callback from set iscandir if aspect equals struct --csurf: double-clk setupscan panel raises csurf only from bottom buttons frame --csurf: Setup Structural Scans auto-converts *.nii (AFNI 3dcopy) --lib/help/tksurfer/read_im{2,3}: example set infile names --lib/help/tksurfer/col1col2: new helpfile, add to mk0{.csh} --tksurfer.tcl: helpwins for F3 panel col1,col2 for "bi" scale --lib/help/tksurfer/val2rgb_{read,write}: explicit example set in/out filename --wrappers.tcl: controls,buttonbar: mv panel right of tk b/c far left tkmedit --wrappers.tcl: controls,buttonbar: mv panel below GL if F3 b/c tksurfer F3 top --lib/help/tksurfer/outsurf{NULL,asc,glb,obj,off,stl,vtk}_write: update --wrappers.tcl: helpwin: mv less right for narrow tksurfer F3, small tkmedit GL --csurf: all-help panel: separate read/write (SurfaceR,SurfaceW), c2lab to Label --tksurfer.tcl,mk0: rename helpfile: hemisurf->insurf_read, bind F3 insurf "R" --tkmedit.c: nudge startup GLX glxwinx0 back to right (for left Mac dock) --tkmedit.tcl: SAVEIMGS ignores post-startup $inoutim change (write 1st read-in) --lib/help/tksurfer/{patch,curv,area}_{read,write,mask,cut}: explicit set file ... ################################################################### UPDATE: 25 Sep 2023 ################################################################### ---------------------------------------------- tksurfer displays/prints region areas from labels/annotations ---------------------------------------------- When a surface is read, two distinct measurements of vertexwise area are loaded into the surface data structure (the vertexwise area is the sum of 1/3 of the area of each of the 3-10 triangles surrounding each vertex). The first measurement, "orig area", is read from the {rh/lh}.area files, which are typically generated during standard surface reconstruction from the {rh/lh}.white surfaces. The second areal measurement ("curr area") is calculated from the current surface (e.g., inflated), which will typically differ moderately from the "white" surface. Flattenings will typically have larger deviations from "original area" because they are inherently more distorted. This information is now made more accessible when reading single-area *.label file and annotations (*.annot, *.gifti, etc.), as follows: (1) When a single-area label is read, the "orig area" and the "curr area" of the label is printed on the pop-up displayed after displaying the label. (2) When an annotation is read, the area of each region is now printed to the csurf log, and also written to a file in the scripts directory in either the SUBJECTS_DIR or FUNCTIONALS_DIR (depending on whether you started tksurfer from the SURFACE button or the SURFACE-STATS button): $SUBJECTS_DIR/$subject/scripts/.ctab.area $FUNCTIONALS_DIR/$session/image/scripts/.ctab.area (3) The pop-up generated by a double-middle click on a region in a displayed annotation now also includes the "orig area". N.B.: if you have installed the fixed surfaces and area files in fsaverage-ADDITIONS.tgz (or have used update-fsverage, or have installed the fixed fsaverage.tgz -- all equivalent effect, doing any one of those highly recommended!), the "original area" will have been calculated from fsaverage $hemi.inflated_avg surfaces rather than from the fsaverage $hemi.white surfaces. This is because when the surface coordinates of individual surfaces are surface-averaged to generate the fsaverage smoothwm/white surfaces, the surface area of the average is substantially reduced (because idiosyncratic sulcal 'crinkles' are removed). By contrast, by first inflating each individual surface and then surface-averaging the individual inflated surfaces (fsaverage inflate_avg), the original surface area is preserved. ---------------------------------------------- labelcol_to_vtxcol ---------------------------------------------- A new tcl/C function, labelcol_to_vtxcol, copies currently displayed label colors to the vertex color "paint" field of each vertex. This is parallel to currcol_to_vtxcol which does the same thing for the the current data color. In both cases, the vertex color "paint" field can be saved into a vertex color (*.cols) file with write_vtxcol_label. This was done for blink-comparing annotations by turning one into a vtxcol file. The labels are above the data/curv/vtxcol layer. No interface button yet. ---------------------------------------------- tksurfer "val:" line can display 1D bfloat's ---------------------------------------------- The surface resampling program, mri_surf2surf, can generate vertex list files in 1D bfloat output format. These are generated in csurf, for example, during cross subject averaging using the panel made by csurf -> CrossSessTools -> Cross Sess SphereAvg. The "val:" entry dropdown in tksurfer now loads any *_000.bfloat files in the current scandir and can display them with "R". If the selected file is part of a complex-valued pair, the other file (real or imaginary) will also be autoloaded. ---------------------------------------------- fourier.c phase-corrections use AFNI TAXIS_OFFSETS ---------------------------------------------- Sub-TR time axis offsets (AFNI TAXIS_OFFSETS) are now automatically read by READ HEADER in the Setup Functional Scan panel, and then passed to fourier.c if the "UseTAXIS" tickbox is ticked in the Setup Fourier panel (new fourier.c option -taxisoffsets), and are used to make sub-TR phase corrections for multiband and other more complex slice orders. Arbitrary slice time offsets can also be manually pasted into the "Slice Time Offsets List:" field in the Setup Functional Scan panel. N.B.: The AFNI TAXIS_OFFSETS field in the AFNI HEAD file will only be correct if the BRIK has been generated from the IMA (Siemens DICOM) file by AFNI to3d using tpattern equals "FROM_IMAGE". Using, e.g., tpattern "seq+z", "alt+z", etc., will NOT generate correct TAXIS_OFFSETS for a multiband scan. Versions of ima2brik >= 0.4b work correctly. Since the slice time (fourier phase) corrections (for non-sparse scans) will, on average, retard the output phase by 1/2 the duration of TR, after the corrections are applied, all phases are advanced by the same amount (TR/2). This allows direct blink comparison between corrected and uncorrected scans. The effects of this correction are quite subtle for phase-encoded mapping experiments using standard short-TR multiband acquisitions. ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- add full fsaverage subj w/updated surfs to https://pages.ucsd.edu/~msereno/csurf tksurfer -- R-click "surf:" to see current surface header in pop-up pick annot regions to show now works with borders-only, too also load csurf-style (dash after hemi) annot into annot2roi.tcl combo (!) fix truncated csurf helpfile on Linux fix small bug in read_gifti_to_annot (was append line of junk to ctab file) ########################################################################## UPDATE: 25 Sep 2023 ########################################################################## --lib/help/tksurfer/{label,label_read}: update --tksurfer.c: print_annot_to_log_ctab also prints $ctabfname.area w/area append --tksurfer.tcl: count_mgh_annot_neigh2stat->areaneigh2stat,fix R-clk "D" menubar --tksurfer.c: read_{mgh,gifti,poi,obj}_annot now always count_mgh_annot_neigh --tksurfer.c: count_mgh_annot_neigh2stat -> count_mgh_annot_neigh+areaneigh2stat --tksurfer.c: fix read_gifti_to_annot off-by-1 bug (extra junk entry in ctab) --tksurfer.c: use print_annot_to_log_ctab() for read_gifti_to_annot --tksurfer.c: count_vtxs_per_brainregion: ignore alpha at compare annot,mghannot --tksurfer.c: rename: read_poi_annot -> read_poi_to_annot --tksurfer.c: hack fix 0vtx cnt by set_annot_alpha *after* count (fixed above) [tmprelease 230923] --tksurferc: functify print_annot_to_log_ctab() for read_mgh_annot --tksurfer.c: read_mgh_annot:print_annot_to_log_ctab writes areas to csurf log --tksurfer.tcl: fix "D" read-1-label popup: borders (new def), incl area, help --tksurfer.c: double-mid click also prints brainregion area --tksurfer.c: fix read_{gifti,poi,obj}_to_annot() as below --tksurfer.c: read_mgh_annot() uses 2 functs below --tksurfer.c: functify: count_vtxs_per_brainregion, calc_area_per_brainregion --tksurfer.c: read_label_to_annot_using_col() updates filled_{origarea,currarea} [tmprelease: 230721] --ima2brik: don't check for missing 3dAFNItoANALYZE, fix parse "which" output --src/afni/bin/zz-Darwin-test: 10.7to3d,lib{bz2.1,fontconfig.1,freetype.6}.dylib [tmprelease: 230423] --lib/help/csurf/{setupfunct,setupfour}: better slice timing documentation --csurf: fouriercmd: can use fourier ... -taxisoffsets .. --fourier.c: new opt: -taxisoffsets inp AFNI TAXIS_OFFSETS to slicetime correct --fourier.c: document half-cycle phase correct for direct comp to SIMUL --csurf: addfourscan: UseTAXIS vs. UseSliceOrd, check/warn parms --csurf: READ HEADER ask biff already-read TAXIS_OFFSETS (b/c 3dvolreg non-prop) --csurf: Setup Align/Funct: add Multiband Accel Factor, Slice Time Offsets List --csurf: new saved functscanlists parms: mbaccel, taxisoffsets --csurf: new procs: getafnitaxisoffsets, getafnimbaccel --tksurfer.tcl: readtemplateframe leave popup, select_curv remake if diff frmcnt [tmprelease: 230129] --tksurfer.c: if annotmaskflag, don't leave padded border of masked annots --tksurfer.c: make annotmaskflag also work when just borders (annotbordflag) --tksurfer.tcl: default left-click "R" now req's *.label (was allowing *.annot) --tksurfer.tcl: R-click "surf:" read_binary_surface printheaderflag -> surfhdr --tksurfer.c: export new printheaderflag that doesn't exit (justheaderflag does) --tksurfer.c: new func printf1k: like printf but also appends to genstrret_1k [tmprelease: 221227] --tksurfer.tcl: R-click on upper right "surf:" label lists vertexcnt,facecnt --lib/help/csurf/{csurf,setuprawavg,setupimport}: bshort update --lib/help/tksurfer/{val,val_read}: bfloat update --tksurfer.tcl: read_real_or_complex_binary_values: std fmt cmplx bfloat's OK --tksurfer.tcl: "val:" entry loads scandir *_000.bfloat's --tksurfer.tcl: "val:" entry accepts *_000.bfloat, checks corresponding *.hdr --tksurfer.c: export vertexcnt,facecnt to tcl for err check --tksurfer.c: read_binary_values accepts mri_surf2surf *_000.bfloat's [tmprelease: 221217] --mk0: fix onearch! (dir check was using csurf, not csurfsrc!) --mk0: change 'tail +N' to 'tail -n +N' fix Linux fail on lib/help/csurf/csurf --ima2brik: fix crash on partial transfer --mri2mpg: convert from csh to sh, chk for ffmpeg, always clear zzMPG --mk0: rm ._ junk from Mac tarfile (COPYFILE_DISABLE), quit if pwd!=csurf [tmprelease: 221025] --add labelcol_to_vtxcol() to get label "paint" for other label compare --make a complete CsurfMps1-updated fs5.3 fsaverage --update-fsaverage: also copy HCP annot, mapping data labels,cols --dist/fsaverage-ADDITIONS: update README.txt's --{README.txt,UPDATES.txt}: incl update-{csurf,fsaverage} [tmprelease: 221017] --annot2roi.tcl: load csurf-dash-style CsurfMaps1 annots in dropdown, mk it def ########################################################################## UPDATE: 02 Oct 2022 ########################################################################## --fsaverage-ADDITIONS: update README.txt's, add update-csurf/fsaverage --mk0: insttmp asks OK rm /tmp/csurf, /tmp/Csurf.app --lib/help/tksurfer/label,label_{readcut,clear,read2val,write}: update --csurf: print README.txt tarfile date (if there!) into csurf title bar --bin/noarch/update-csurf: new sh script, added to mk0 --bin/noarch/update-fsaverage: new sh script, added to mk0, fsaverage-ADDITIONS --tksurfer.c: add strcpyrmhemi() to avoid strcpy restrict violations (4 places) --tksurfer.c: read_mgh_annot now runs set_annot_alpha(255) (also obj,poi,gii) --tksurfer.c: restrict: (1) if obj mod thru ptr (2) r/w only allowed by that ptr --tksurfer.c: no strcpy to origvar: restrict'd arg: 2 ptrs can't access 1 thing --tksurfer.c: 10.6-compiled is fine, restrict crash appeared w/10.15 compile --tksurfer.c: alfname/$annot def: CsurfMaps1, read_mgh_annot autoresets alphs ... ################################################################### UPDATE: 26 Apr 2024 ################################################################### Summary: (1) 4-step undo edit in tkmedit (one-step redo) (2) tksurfer gradient arrows pruning function (3) tkmedit range and 2nd image range edit functs (mouse,do-all) (4) tkmedit brightness-centerable distance-dep contrast ramp (5) new filled gradient arrowheads (6) new funct to distance sort single-vertex-wide label paths (7) new R-clk buttonbars (label S/T/X, val R/CLR/CS, SMOOTH, area D) ------------------------------------------- 4-step undo, 1-step redo in tkmedit ------------------------------------------- There is now (finally!) a basic undo/redo edit function in tkmedit. It is a 4-step undo, which means it can undo up to four sequential right-clicks or right-click-drags (to black) or middle-clicks or middle-click-drags (to white), and a 1-step redo (undo the most recent undo). To undo, use alt/cmd-z (small 'z') in the image or tools window. To redo one previously undone edit, use alt/cmd-Z (shift/capital 'Z'). Alternate undo/redo clicks in the image window are ctrl-left-click (undo) and shift-ctrl-left-click (redo). The undo and redo functions also work with any tkmedit operations that affect the editable buffer (im) such as: TRUNC (options that affect im, not im2) PF/PFGAU (options that affect im, not im2) SMOOTHSTRUCT COMPARE (shift-left-click-COMPARE for visible_to_im) APPLY (F3 panel linear/gaussian ramps, applied to im) OP (edit im using color ellipse from im,im2) Enabling undo very slightly slows editing on 512^3 data sets. It can be disabled with the "un" tickbox next to the CORONAL button (to see the small difference). ------------------------------------------- New filled arrowheads option ------------------------------------------- The default arrowhead for display of vector data (e.g., gradients) were line arrows (line for stem, two lines for arrow barbs). These are well adapted to dense arrow displays. However, now that there is way to prune vector fields (see next), a new arrow type with a filled arrowhead has been added. The filled arrowheads are made of four adjustable triangles: two for the arrow barbs, and two forming a diamond for the point. Here are the parameters for fine-tuning the arrow display for the two types: line arrows $arrownormflag -- normalize all arrows to same length $arrowscale -- adjust all arrows lengths $arrowline -- adjust thickness of arrow line $arrowheadfracauto -- scale arrowhead to stem length $set arrowheadmin -- minimum size of scaled arrow $line_arrowbarbangle -- angle between barb and stem Filled Arrows $arrownormflag -- normalize all arrows to same length $arrowscale -- adjust all arrows lengths $arrowline -- adjust thickness of arrow stem $arrowheadfracauto -- scale arrowhead to stem length $set arrowheadmin -- minimum size of scaled arrow $filled_arrowtipangle -- tip/stem angle $filled_arrowbarbangle -- back of barb/stem angle ------------------------------------------- Pruning gradient vectors ------------------------------------------- Gradient calculations result in a very large number of gradient arrows (one per vertex), which will look cluttered (unless the surface is strongly zoomed). A R-click on the unlabeled tickbox to the left of "fs:" (middle left), brings up a popup for controlling gradient (and fieldsign) arrows. There is a PRUNE ARROWS button at the bottom of the popup. The density of arrows is set by the $gridsize parameter (in mm) on the popup. The "prunearrowsflag" toggles between pruning and no pruning. N.B.: click PRUNE ARROWS again to see the effect of adjusting $gridsize. The pruning works by only showing one arrow for each specified-size grid cell. Since the actual vertex location of the arrow is used, the grid will be slightly irregular. Also remember that *.val (or *.stat) thresholds can be used to prune 'noise' arrows by setting $fthresh (or $sfthresh if "mask" is ticked), and then recalculating the gradient arrows. ---------------------------------------------- New tkmedit funct: crop_im_using_im2cols ---------------------------------------------- This can crop an edtabale image using another imageset. This requires that a second image has been loaded using "R" on the bottom middle "im2:" line. A control-mid-click on the TRUNC button truncates the editable buffer (im) using locations in the second buffer (im2) that have colors within/including $while_lolim to $white_hilim (entries immediately right of TRUNC button) to a new color, $gray_hilim (entry to right of PF button): for im2 range: lo: $white_lolim hi: $white_hilim im new: $gray_hilim The editable buffer can then be saved with SAVE IMGS (overwrites editable image), or "W" on "im:" line (F1 interface) if you want to SaveAs/rename the result. To duplicate the result of a hand-edit to black, use target color 1 (EDITED_TO_OFF). This can be used, for example, to crop the background of the editable image set using a different (already processed) image set. ---------------------------------------------- New tkmedit funct: crop_im_using_im2cols_save ---------------------------------------------- Similar to crop_im_using_im2cols above, but only edits image if im (editable image) is outside the range of: lo: $edit_lolim2 hi: $edit_hilim2 This second pair of limits allows saving more structure in the editable image. For a mouse-driven version of the same thing, use shift-left-click in the image window. First do R-click on the entries to the right of the TRUNC button to get a popup to control $edit_lolim2 and $edit_hilim2. ------------------------------------------- New tkmedit funct: cp_im_to_im2_replacing_cols ------------------------------------------- This can edit a range of colors in an editable image to a single color. A shift-right-click copies the entire contents of the editable buffer to im2, replacing a range of colors (including range limit values) in the editable buffer with a single im2 color. shift-right-click TRUNC. The im color range to replace is specified by the values in the 2 entries to the right of the TRUNC button, and the new/replaced im2 color by the entry to the right of the PF button: for im range: lo: $white_lolim hi: $white_hilim im2 new: if within range: $gray_hilim else: same as im To save the color-replaced im2 buffer, first swap it to editable buffer: middle-click-COMPARE SAVE IMGS *or* "W" on "im:" line In contrast to the in-place operation above, crop_im_using_im2cols, this allows a blink comparison using the COMPARE button, because only one image is initially loaded. To duplicate the result of a hand-edit to black, use target color 1 (EDITED_TO_OFF). This can be used, for example, to edit bright fluid to black in place. ------------------------------------------- New image window mouse editing options ------------------------------------------- In parallel with the three functions above, bounds-dependent editing also works with interactive mouse-driven edits in the image window, using a shift-left-click. First, do a R-click on the entries to the right of WMTRUNC to get a popup with all controlling parameters. (1) Bounds-dependent mouse edit on im Edit pixels in the editable image (im) within currently specified bounds (2 entries to right of TRUNC button, also in popup) to a target value (entry to right of PF button, also in popup). (2) Bounds-dependent mouse edit on im using im2 If $im2boundsflag is 1 (middle click "la" tickbox to toggle), edit pixels in the editable image, but test whether pixels in im2 are within the requested bounds (N.B.: edits still go to the editable im). To preserve structure of the editable image, use $edit_lolim2 and $edit_hilim2 to block edits if editable pix is within these bounds (see popup). This can save structure in the editable image. ------------------------------------------- New tkmedit funct: visible_to_im ------------------------------------------- A third alternate shift-middle-click of the COMPARE button copies the contrast-adjusted visible pixel values (N.B.: currently in the editable buffer) to the editable buffer, overwriting its current contents. N.B.: the contrast-adjusted image is typically the result of a non-linear (e.g., sigmoid) function. To avoid applying the contrast adjustments recursively, $linearflag is set to 1 (see interface button on lower right of large F4 interface panel). This can be used, for example, to save a contrast-reversed image (negative value for "contr:"), or a contrast-enhanced image. N.B.: using SAVE IMGS will overwrite the initial dataset, so to save the contrast-adjusted images to a new file, enter a name in the upper right "im:" entry and click "W". ------------------------------------------- New brightness-centerable distance-dep contrast ramp ------------------------------------------- On the [fn-]F3 tkmedit interface, a left-click on the middle-right "PieceWiseLinNorm" title brings up a popup with controls for setting the $contrastnochange value and $constrastslope. When a piecewise linear ramp (or a spherical linear or Gaussian ramp) is applied, the contrast can be increased as a function of distance. This will have no effect unless ffrac0,1,2,3 are changed from the default 1.0 (no brightness change). ------------------------------------------- Interface support for 'paintball' annots ------------------------------------------- A shift-middle click on the SMOOTH button brings up a popup providing interface support to run the C/tcl function, neighop_val2stat (with operation=3), for generating 'paintball' label/annots. This function generates a set of non-overlapping label/annotation regions, whose size is specified by vertex neighbor order (1=justneighbors, 2=neighbors-of-neighbors, etc). The special operation=3 here is the only one that ignores the .val field while writing to the .stat field (the other operations for neighop_val2stat are parallel to the operations in searchlightop_val2stat). Here are the neighbor counts for the fsaverage surfaces: 1-neighbors: 7 2-neighbors: 19 3-neighbors: 37 4-neighbors: 61 5-neighbors: 91 6-neighbors: 127 When neighop_val2stat is run with operation=3, it generates the non-overlapping regions as sequentially-numbered, integer values in the .stat field. There will be small unlabeled regions in between each non-overlapping, approximately circular patch. To fill these in, click the GROW STAT IDNUMS button (C/tcl function grow_stat_idnums). This selects a shuffled vertex and then, if it is empty, adds it to an existing region if any of its neighbors already have an idnum in the .stat field. The .stat idnum regions can then be turned into an MGH annotation in order to use these regions for further analysis. This was originally written to display the size of hypothetical granule cell patches in the cerebellar cortex :-} The regions are given random (non-overlapping) colors in the output MGH annot file. To see or use the result: (1) save the .stat regions to a randcol annot file: --R-click "label:" line "W" to get popup --choose output file name in "label:" entry --"Write StatIds to RandCol MGH Annot" button (2) display/use resulting annot file: --use "label:" line "D" button ------------------------------------------- New function to sort single-vertex-wide label paths ------------------------------------------- A new function, write_sorted_by_pathdist_label, reads the current label ("label:" entry) and then sorts the lines in the ASCII file by the Euclidean distance along a path from the last interactively selected vertex (e.g., the beginning of a single-vertex-wide label path). It simply copies any overlay data that may or may not be included in the original label file. The second vertex will be the closest to the initially selected vertex, the third vertex will be the closest to the second vertex, and so on (so this is not equivalent to merely sorting vertices by distance from the initial vertex). Standard freesurfer/csurf labels are normally written in vertex number order (but since the csurf/freesurfer label-reading code ignores the order of lines in the label file, the sorted file will still be readable). However, an external program can now use the re-ordered lines in the sorted output file to find the path order. This function can successfuly sort a path label containing a series of vertices along a line that curves back on itself (as long as it doesn't cross itself, since there is no linearity constraint). N.B.: this function overwrites the input label, but first saves it aside with a tilde (~) suffix. This is useful for sampling data (e.g., phase data) along an arbitrary curved line of vertices. First, save a standard label from a sequence of selected vertices (write_selected_list_to_label, or "Selected Vertices to Label" from R-click help pop-up on "W" on "label:" line) that contains the phase data you want, then path-sort that line label using this function ("Sort Label By Dist From Last Clk" on same popup). This was first written to sort the geodesic path output of mris_pmake. It is also useful for sorting a single vertex line label made by selecting vertices along a line, but not necessarily in exact path order (e.g., if missed vertices have been filled in after roughing out the line). ------------------------------------------- New buttonbar shortcuts remaining overloaded buttons ------------------------------------------- New R-click buttonbars were added for all remaining overloaded buttons lacking them. These include: "area:' line: D (display area ratio curr surf distort) "label:" line: T (t-course), S (stat), X (searchlight xcorr) "val:" line: R (read), CLR (clear), CS (cluster, FDR) SMOOTH button In the process there was a massive cleanup of the buttonbar code to remove event generate hacks. ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- fix draw_arrows3d arrownormflag bug (dz accidentally repeated dx) add labelcol_to_vtxcol to R-click "D" on "label:" line button bar rm dependence on glu.h, -lGLU (tksurfer, wheel) ########################################################################## UPDATE: 26 Apr 2024 ########################################################################## [tmprelease 240426] --tksurfer.tcl: new buttonbar for areal-line "D" button --tksurfer.tcl: new buttonbar for "SMOOTH" button --tksurfer.tcl: conv val-line "W" butt bind's to procs (rm event generate hacks) --tksurfer.tcl: new buttonbar for val line "CLR" button (just 2: val, all) --tksurfer.tcl: new buttonbar for val-line "CS" button (just 2: cluster, FDR) --tksurfer.tcl: conv val-line "S/V" butt bind's to procs (rm event gen hacks) --tksurfer.tcl: new buttonbar for val-line "R" button (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "X" butt (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "S" butt (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "T" butt (bind's -> proc's) --tksurfer.tcl: conv fs-line GR butt bind's to procs (rm event generate hacks) --tksurfer.tcl: conv label-line W butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line R butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line CLR butt bind's to procs (rm eventgenerate hack) --tksurfer.tcl: conv label-line C butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line D butt bind's to procs (rm event generate hack) --tksurfer.tcl: fix stale funct name: read_poi_annot -> read_poi_to_annot [tmprelease 240418] --lib/help/tksurfer/label_write: update write_sorted_by_pathdist_label --tksurfer.tcl: R-clk label W for C pathsort: write_sorted_by_pathdist_label --lib/help/tksurfer/label_write: update neighop_val2stat >op=3> usage --tksurfer.c: add write_sorted_by_dist_label(), uses last click for start vtx --sortlabel: standalone tcl script sorts label by Euclidean dist from start vtx --tksurfer.tcl: sort Dijk label to pathorder, opt insert overlay data into label --tksurfer.tcl: better feedback on Dijk output file, check overwrite --tksurfer.tcl: warn re-run startup, block init-run non-standalone SURFACE-STATS --tkmedit.c: saveim_for_undo() before flip_corview_xyz, im2wmedits_to_im [tmprelease 240129] --tkmedit.c: add parallel image window [shift]-ctrl-left-click for undo/redo --tkmedit.tcl: update cmd-z/Z for new extracted saveim's --tkmedit.c: 1-step redo_edit(), extract/export saveim_for_redo(), undoeditflag --tkmedit.c: rm edit_pixel {UNDO,REDO}_EDIT to export functs {undo,redo}_edit() [tmprelease 240110] --tkmedit.c: fix off-edge access of tmp array for finding existing imprevnums [tmprelease 231230] --tkmedit.tcl: add imim2op help to F4 panel ellipse parms --lib/help/tkmedit/{all,clks,wmtrunc,wmfilter{std,gau},smoothstats,clks,imim2op} --tkmedit.tcl: bind tools window cmd-z to undo --tkmedit.c: saveim_for_undo: smooth_3d,smooth_3d_nn,imim2op --tkmedit.c: saveim_for_undo: visible_to_im/norm_allslices_toim2 --tkmedit.c: saveim_for_undo: crop_im_using_im2cols, crop_im_using_im2cols_save --tkmedit.tcl: TRUNC/PF/PFGAU run_wmfilter does saveim_for_undo --tkmedit.c: trunc undo's to num prev sequential edits, export saveim_for_undo --tkmedit.c.c: implement 4-step undo stack/circbuff (TODO: undo stack) --tksurfer.c: fixed missed shift/ctrl/alt keyreleases b/c of popups --csurf: cbx:listcmd_mri for mritypes combo to force update before dropdown [tmprelease 231221] --tkmedit.c: fix shift/ctrl/alt KeyRelease missed b/c of popups (force 0 before) [tmprelease 231219] --tkmedit.c: 2-step undo (but no redo since no undo stack: curr im overwritten) [tmprelease 231217] --tkmedit.c: export right_click (undo spdtest): alloc imprev like im: 17% better --lib/help/tkmedit/nonbinaryfs: update --tksurfer.tcl: add FIELDSIGN/GRADIENT popup button for sparse arrows defaults --lib/help/tkmedit/undoedit: new helpfile --tkmedit.c: cmd-z in image window for undo edit --tkmedit.tcl: proc editfile pre-deletes any stranded script swapfiles --tkmedit.tcl: "un" tickbox R of CORONAL to enable/disable undo edit ability --tkmedit.c: implement 1 edit undo, export edit_pixel(),$undoeditflag (if slow) [tmprelease 231208] --tkmedit.c: raise F3 interface to keep its bottom on screen --tkmedit.tcl: fixed introduced mispelled "constrastslop" --tksurfer.tcl: add centerarrowsflag to "phc" arr control popup, arrownorm help --lib/help/csurf/tksurfer: mention SMOOTH val2stat searchlight popups --lib/help/tksurfer/script_searchlight{area,diff},smooth --tksurfer.tcl: pre-delete stranded TmpTclScript.tcl swapfiles --tksurfer.tcl: proc editfile pre-deletes stranded TmpTclScript.tcl swapfiles --tksurfer.tcl: add second alt SMOOTH controls popup for run neighop_val2stat --tksurfer.tcl: add write_statids2randcolannot to "label:" line "W" (no hotkey) --tksurfer.c: write_statids2randcolannot(): randcol-annot-from-neigh paintballs --tksurfer.c: shuffleUInt() for write_statids2randcolannot() --tksurfer.c: grow_stat_idnums(): grout randcol nearest neighbor patches [tmprelease 231203] --tksurfer.tcl: put code for tickbox binding into do_grad2col, binding uses it --wrappers.tcl: remove +2 from controls edlabval width test for narrower --tksurfer.tcl: DEFAULT LINE/FILL ARROWS butt FIELDSIGN popup (GR already does) --tksurfer.c,tcl: arrowheadtype->filledarrowsflag, arrowheadfrac->append "auto" --tksurfer.c,tcl: rename: line_arrowbarbangle, filled_arrow{tip,barb}angle --tkmedit.tcl: TRUNC popup: disable 2nd struct-save bounds unless im2boundsflag --tksurfer.tcl: add arrowhead{frac,min,angle} to FIELDSIGN and ARROWS popups --tksurfer.tcl: fix Ret in arrowline FIELDSIGN popup bound to PRUNE_ARROWS but --tksurfer.c: export arrowheadfrac, arrowheadmin, arrowheadangle (rad->deg) --tksurfer.tcl: Return in gridsize entry does prune_arrows --tkmedit.tcl: button bar for TRUNC butt, also put up bounds popup (move it up) --tkmedit.tcl: ctrl-R-click TRUNC for crop_im_using_im2col_save() --tkmedit.c: crop_im_using_im2col_save(): also save im within $edit_{lo,hi}lim --lib/help/tkmedit/{wmtrunc,truncparms}, lib/help/csurf/tkmedit: update [tmprelease 231126] --lib/help/tksurfer/{comp_grad,smooth}: update --tksurfer.tcl: add arrownormflag to FIELDSIGN and GRADIENT ARR CTRLS --tksurfer.c: fix draw_arrows3d arrownormflag bug (dz accidentally repeated dx) --tksurfer.c: new prune_arrows algorithm (nearest vs. 1st), add {make,free}int3D --tksurfer.tcl: PRUNE ARROWS/gridsize/prunearrowsflag: FIELDSIGN/GRAD ARR CTRLS --tksurfer.c: export prune_arrows(), prunearrowsflag --tkmedit.tcl: add toggle circleflag to "rad" label, fix lib/help/tkmedit/brush --tkmedit.c: TEST/APPLY also writes to tcl cmdlog, demo standalone tcl script --tkmedit.c: print norm tcl script for TEST or APPLY (already to tcl cmd log) --tkmedit.c: add contrast ramp into spherical norm --lib/help/csurf/tkmedit: update image window popop help --tkmedit.c: add/export $edit_{lo,hi}lim2 for shift-left click edits using im2 --tkmedit.c: add ctrlkey to dbl-clk image win help to block edit->blk,tcourse --tkmedit.tcl: overload "la" tickbox with toggle $im2boundsflag --$im2boundsflag (so can see editable im while using im2 bounds) --lib/help/tkmedit/truncparms: new helpfile, add to mk0 --tkmedit.tcl: new helpfile for TRUNC,PF entries: truncparms --tkmedit.c: shift-left-click edits pix to gray_hilim if within white_{lo,hi}lim --lib/help/tkmedit/wmtrunc: update --tkmedit.c: crop_im_using_im2cols() now accepts im2 range (like replace cols) --tkmedit.c: replace_cols -> cp_im_to_im2_replacing_cols: (vs. inplace->blink) --tkmedit.tcl: 5th overload TRUNC button to replace col range with single color --tkmedit.c: replace_cols(): replace editable colrange using TRUNC, PF entries --tkstrip.c: do_one -> do_all_glx_events, add to shrink for live rotate --tkstrip.c: double click raises GLwin, make -insurf option work --tkmedit.tcl: SAVEIMG (orig img name) warns when new img set read in over orig --tkmedit.tcl: ctrl-mid-TRUNC cp im->im2 repl $white_lolim-hilim w/$gray_hilim --tkmedit.c: crop_im_using_im2col(): crop col set by $white_lolim --lib/help/tkmedit/{compare,bwslope,test1,all}: updates --tkmedit.tcl: R-clk "PieceWiseLinNorm" F3 panel ctrls constrast{nochange,slope} --tkmedit.c: export contrastnochange,constrastslope for piecewise lin ramp hack --tkmedit.c: hack norm_allslices_to_imnum to add centerable lin contrast ramp --tkmedit.tcl: middle-click "contr:" label toggles linearflag --tkmedit.tcl: overload COMPARE button w/visible_to_im (contr-adj'd to editable) --tkmedit.c: visible_to_im(): cp contrast-adjusted editable image to editable [tmprelease 231002] --wheel Makefile: rm -lGLU --wheel.c: 03c: rewrite drawscale plain GL to avoid glu.h/-lGLU/gluPartialDisk --tksurfer Makefile: rm -lGLU --tksurfer.c: rewrite draw_colscaledisk plainGL avoid glu.h/-lGLU/gluPartialDisk --lib/help/tksurfer/label_read: update --tksurfer.tcl: add tenth label "D" overload: ctrl-mid-clk-D: labelcol_to_vtxcol --tksurfer.tcl: fix R-clk "D" popup text: CalcOverlap ->ctrl-shift-mid-clk => R! ########################################################################## UPDATE: 25 Sep 2023 ########################################################################## --tksurfer.c: calc_area_per_brainregion zeros brainregions before area sums --lib/help/tksurfer/{label,label_read}: update --tksurfer.c: print_annot_to_log_ctab also prints $ctabfname.area w/area append --tksurfer.tcl: count_mgh_annot_neigh2stat->areaneigh2stat,fix R-clk "D" menubar --tksurfer.c: read_{mgh,gifti,poi,obj}_annot now always count_mgh_annot_neigh --tksurfer.c: count_mgh_annot_neigh2stat -> count_mgh_annot_neigh+areaneigh2stat --tksurfer.c: fix read_gifti_to_annot off-by-1 bug (extra junk entry in ctab) --tksurfer.c: use print_annot_to_log_ctab() for read_gifti_to_annot --tksurfer.c: count_vtxs_per_brainregion: ignore alpha at compare annot,mghannot --tksurfer.c: rename: read_poi_annot -> read_poi_to_annot --tksurfer.c: hack fix 0vtx cnt by set_annot_alpha *after* count (fixed above) --tksurferc: functify print_annot_to_log_ctab() for read_mgh_annot --tksurfer.c: read_mgh_annot:print_annot_to_log_ctab writes areas to csurf log --tksurfer.tcl: fix "D" read-1-label popup: borders (new def), incl area, help --tksurfer.c: double-mid click also prints brainregion area --tksurfer.c: fix read_{gifti,poi,obj}_to_annot() as below --tksurfer.c: read_mgh_annot() uses 2 functs below --tksurfer.c: functify: count_vtxs_per_brainregion, calc_area_per_brainregion --tksurfer.c: read_label_to_annot_using_col() updates filled_{origarea,currarea} ... ################################################################### UPDATE: 12 Nov 2024 ################################################################### Summary: (0) fix label header bug introduced in Linux interim releases 240619,240707 (1) tksurfer can write Talairach coords (MNI 305 or 152) to label (10 functs) (2) tkmedit can use MNI 152 instead of MNI 305 (3) read_label_to_nearest_annot_using_col: import label w/diff vtx numbering (4) fill_annot_holes_neigh: fill holes (e.g., in imported label) (5) option to select vertices inside surface (for complexly folded) ------------------------------------------- fix write label header bug on two Linux interim releases ------------------------------------------- I fixed a Linux-specific bug in writing any ASCII *.label header that was just introduced ONLY in the previous two interim releases (240619, 240707). N.B.: no Mac release had this bug. The two-line header, which has a first info/comment line and a second line containing the number of vertices was being omitted. Thus, the label file would look like: 1263 49.014 -57.597 17.263 0.000000 1692 43.572 -53.039 20.957 0.000000 2350 47.215 -54.888 17.173 0.000000 instead of the correct: #!ascii , from subject fsaverage ... 288 1263 49.014 -57.597 17.263 0.000000 1692 43.572 -53.039 20.957 0.000000 2350 47.215 -54.888 17.173 0.000000 ... The resulting label, though containing all the correct data lines, would be unreadable by csurf without hand-editing. The bug was introduced when I added some error checking code that itself contained an error :-{ ------------------------------------------- tksurfer .orig/Talairach/currcoords/normsearch to label ------------------------------------------- The machinery for dumping vertex x,y,z coordinates to labels was overhauled and regularized. Four different kinds of coordinates can be written to a label: 1) .orig coords (gray/white boundary, default) 2) .orig -> MNI 305 (default MGH freesurfer Talairach) 3) .orig -> MNI 152 4) current surface coords (e.g., for flat data analysis) To control these options, there is a small button bar at the far upper-left replacing the "c2lab" (current to label) tickbox. Ticking the "ta" button results in Talairach to label, the "cu" button selected current surface to label. The buttons act like radio buttons (ticking one unticks the other), but they also both be unticked (the default state), which results in .orig coords to label. When you tick "ta", you get a popup to choose MNI 305 vs. MNI 152. A R-click on a ticked "ta" reports the current Talairach choice. In addition, movement along the local vertex normal can optionally be added so that final x,y,z point is in the gray matter (or underneath that border if desired), rather than at the gray/white border. To control this, left-click the bold "label" text on the "label:" line to get a popup. The first tickbox, $normdsampsearchflag, turns normal movement on (N.B.: the default!). The second tickbox, $normdfracflag, determines whether the movement amount is in millimeters or in fraction (0-1) of the local cortical thickness at that vertex. The selected point is halfway between $normdsamp and $normdmax (if in mm), or halfway between $normdfracsamp and $normdfracmax (if in fraction of cortical thickness). These parameters were originally introduced for sampling fMRI data to the surface vertices using the PAINT button. They are also used for writing out timecourses for multiple cortical depths. The tcl functions affected are: write_val_visible_vertices (was write_labeled_vertices, old OK) write_val_annoted_vertices write_val_annotedcol_vertices write_val_idnum_vertices write_val_unmasked_vertices write_annotedcol_autoname write_selected_list_to_label write_annotcols_timecourses_stats write_annotcol_timecourses_stats write_label_timecourses_stats The 305 -> 152 transformation matrix is inverted, so that an MNI 152 Talairach x,y,z can get back to 305, and then back to access native freesurfer .orig coordinates. The 305 -> 152 transformation matrix used is: 0.9975 -0.0073 0.0176 -0.0429 0.0146 1.0009 -0.0024 1.5496 -0.0130 -0.0093 0.9971 1.1840 0.0000 0.0000 0.0000 1.0000 ------------------------------------------- tkmedit can use MNI 152 coords ------------------------------------------- By default, tkmedit uses and reports MNI 305 coordinates (calculated during default recon-all cortical surface reconstruction). To change to using MNI 152 coordinates, tick the "152" tickbox (at the lower right of the "SAGITTAL" button and slider). N.B.: using MNI 152 vs. MNI 305 coordinates does not affect the operation of SEND'ing and GOTO'ing points between tkmedit and tksurfer, since that process always uses native .orig coordinates (possibly modified by normal movement along the local vertex normal). ------------------------------------------- Import label with different vtx numbering ------------------------------------------- Import a label file (for the same subject), but which has a different vertex numbering scheme (e.g., a surface made from a previous edit). This works like read_label_to_annot_using_col in that the requested color is defined in the r,g,b fields to the right of "MESH"), However, instead of reading the label file vertex indices (first entry on each label line) to determine which surface vertices to color, each label file line will be used to color the current surface vertex that has its .orig x,y,z coordinates closest to the x,y,z coordinates in that label file line. N.B.: the label file coordinates are are assumed to be from the .orig surface, which is the default for label-writing (i.e., not from the new Talairach coordinate option above, for from inflated surface coordinates, etc). This makes it possible to display a label file written out from an earlier version of a surface, which will have a different vertex numbering scheme, and which would otherwise be incompatible with the newer surface. N.B.: this will give non-sensical results if the label file comes from a different subject or if the label file contains x.y,z vertex coordinates that are not from the .orig surface. N.B.: to save new label: (1) re-cut current labeled (ctrl-L-clk "C" on "label:" line or tcl funct: labeled_cut_clearvals 0) (2) change name in "label:" line entry to avoid overwrite! (3) save label with \"W\" on \"label:\" line" This works well when edits are localized and no global refinements have been applied (e.g., slightly different target target image value criterion). If not, there will be aliasing between the older label x,y,z vertex positions and the newer surface x,y,z vertex positions, resulting in many small linear-shaped holes in the transferred label where a new surface vertex just missed being assigned an annotation from a label vertex. To fix this, see the next function below. However, even without filling the holes, the converted label can be used as a template to re-cut a new native label. This function is quick on a standard sized freesurfer brain (130K vertices), but it will be slow with a very large surface (e.g., over 30 min for a 5M vertex cerebellum). In that case, it can be sped up by cutting away irrelevant parts of the surface (if these are known), for example, using the "PLANE" button. ------------------------------------------- New funct to fill holes in imported label/annotations ------------------------------------------- A more general, controllable label hole-filler (than the basic one-vertex-hole-fixing "annotholes"). This function, fill_annot_holes_neigh is accessed by typing "annotholes-neigh" into the unlabeled "steps" entry immediately to the right of the "SMOOTH" button plus or click "SMOOTH", which generates a popup window. From the popup window, you can control the size of the smoothing neighborhood, "neighord" (1-5, where 1 means just consider nearest vertex neighbors, 2 means includ neighbors of neighbors, and so on), and the criterion for filling a hole, "annotedfrac" (% of surrounding non-hole vertices required to cause label/annotation hole to be filled with the surrounding color). Larger neighborhoods (3-5) are successively slower with a large surface (e.g., 5M vertex cerebellum), but can be sped up by cutting away irrelevant parts of the surface, for example, by using the "PLANE" button. ------------------------------------------- Option to select vertices inside surface ------------------------------------------- Normally, the inside of a surface is invisible, not lighted, and you cannot select vertices from the inside. However, when editing and cutting a complexly folded surface (e.g., the anterior lobe vermis of the cerbellum), it is sometimes helpful to be able to select points from the inside of the surface. An alternate middle-click on the "clo" tickbox (middle bottom) toggles $selectinsideflag. When this flag is ON, vertices can be selected from the inside/back surface. N.B.: this will disable the normal selecting of vertices on the outside of the surface! (middle=click again to go back to normal). To make the surface and the selected vertices visible, two additional variables are adjusted: set lighttwosidedflag 1 ;# show inside surface set light1 1.0 ;# also light inside/back surface Selections on the inside surface are also marked when viewing the surface from the outside. A shift-R-click on the "REDRAW" button makes a popup with full control over the 4 lights (brightness, x/y/z position, $insidesurffact (brightness inside relative to outside), and $lighttwosidedflag. ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- off-edge access causing occas. startup crash fixed in set_{real,complex}_col R-click help buttonbars for remaining overloaded buttons tksurfer/tkmedit better popups for using 2-D color space for truncation isocontour controls popup catch tkmedit crash in FILL struct 3D ROI if (irrelevant) im2i not loaded ########################################################################## UPDATE: 12 Nov 2024 ########################################################################## --lib/help/tksurfer/{smooth_steps,label_read,selectdmax}: update --tksurfer.c: read_label_to_nearest_annot_using_col: ignore ripflag vtxs --tksurfer.c: fill_annot_holes_neigh: ignore ripflag vtxs to speed high neiorder --tksurfer.c: fill_annot_holes_neigh: add neiorder=5 for smaller surfaces --tksurfer.c: fix fill_annot_holes bugs (fill val sometimes 0, then paren bug) --tksurfer.tcl: rm "annotholes-more" b/c fill_annot_holes_neigh is more general --tksurfer.c: rm fill_annot_holes_more (redundant w/fill_annot_holes_neigh) --tksurfer.tcl: "annotholes-neigh" uses funct: C/tcl fill_annot_holes_neigh --tksurfer.tcl: overload smooth steps: add "{annot,label}holes-neigh popup --tksurfer.c: add fill_annot_holes_neigh(neiorder,annotedfrac) general funct --tksurfer.tcl: smoothsteps: "{annot,label}holes-more" -> fill_annot_holes_more --tksurfer.c: add fill_annot_holes_more(): (filled nei minus 3 (vs. minus 2) --tksurfer.tcl: add no-hotkey "D" button: read_label_to_nearest_annot_using_col --tksurfer.c: read_label_to_nearest_annot_using_col(): for updated surfaces [tmprelease 241028] --tksurfer.c: fix write_label_hdr check-fp-writable-code on Linux (& O_ACCMODE) --tksurfer.tcl: disp annot prints totarea all regions (except Unknown) for csurf --tksurfer.c: tot area annot regions (except Unknown) to genstrret_1k/csurflog --tksurfer.tcl: add $lighttwosidedflag to lights popup from R-click help buttbar --tksurfer.tcl: fix R-click report popups for current ta/cu button state [tmprelease 240709] --csurf: hack^2: slow mac10.15 csurf log hangs tkwait/GLwin if appnaphack so blk [tmprelease 240707] --mk0: comment out version-name tksurfer (leave update-tksurfer for later) --tksurfer.c: set_{real,complex}_color: blk annotmask,adjphase off edge if k=-1 --mk0: add update-tksurfer sh script to dist --update-tksurfer: toggles tksurfer symlink between 10.6/10.15 --mk0: version-name 10.6 tksurfer compile, incl 10.15 compile, tksurfer->symlink [tmprelease 240619] --tksurfer.tcl: fix buttonbar REDRAW (forgot to make def cmd bind for event gen) --tksurfer.tcl: add $insidesurffact to brightness/position lights ctrls --lib/help/tksurfer/{redraw,lights,blufact,selectdmax}: update --tksurfer.c: draw prev selected inside surface vertices w/points --tksurfer.tcl: lights bright/pos ctrls: shift-R-clk-REDRAW, REDRAW buttonbar [tmprelease 240611] --tkmedit.c: do 305->152 xform if $xform_mni_305to152_flag (6 fwd's, 1 inv) --lib/help/tkmedit/xfm305to152,mk0: new helpfile --tkmedit.tcl: "152" tickbox for $xform_mni_305to152_flag under SAGITTAL --tkmedit.c: load_invert_305to152_xform() at startup, $xform_mni_305to152_flag [tmprelease 240609] --tksurfer.c: write_annotcol{s}_timecourse.. warns usecurrcoords cancels norm mv --tksurfer.c:xform_mni_305to152_flag picks find_orig_vertex_coordinates edit.dat --tksurfer.c: find_orig_vertex_coordinates always reports both MNI 305 and 152 --lib/help/tksurfer/: update multiple help (6 renames, 305 vs 152, 15 files) --tksurfer.c: export selected (curr vtx, starts -1) --tksurfer.c: rm xform_mni_305to152(), subst. mni_transform_point(): 5fwd/2inv --tksurfer.c: add load_305to152_xform() to startup seq: always load, invert --tksurfer.c: new global Transform's: {inverse_}mni_305to152_transform --tksurfer.tcl: R-click-"ta" reports MNI 305 vs. MNI 152 --tksurfer.tcl: select Talaiarch "ta" sets up choose MNI 305 vs. MNI 152 --tksurfer.c: test/add xform_mni_305to152(), add/export $xform_mni_305to152_flag --tksurfer.tcl: C:write_selected_list_to_label->write_val_selected_list_to_label --tksurfer.tcl: copy-C:write_annotedcol_autoname-> write_val_annotedcol_autoname --tksurfer.c: rename:write_annotedcol_autoname -> write_val_annotedcol_autoname --tksurfer.c:write_selected_list_to_label->write_val_selected_list_to_label(syn) --tksurfer.tcl: rename: extract_unmasked_flag -> unmasked_to_label_flag --tksurfer.tcl: rename: extract_overlays_flag -> unmasked_to_labels_flag --tksurfer.c: fix write_selected_list_to_label header update bug if bigcursorflg --tksurfer.c: fix all synonyms to use an extra Tcl_CreateCommand --tksurfer.c: rename write_labeled_vertices->write_val_visible_vertices (bakcmp) --searchlight{area,diff}.tcl: write_labeled_vertices->write_val_visible_vertices --tksurfer.tcl: copy-C: write_labeled_vertices->write_val_visible_vertices --tksurfer.c: write_selected_list_to_label uses new functs, but dup'd for neigh --tksurfer.c: write_annotedcol_autoname uses 2 new funct --tksurfer.c: write_{annotcols,annotcol}_timecourses_stats DON'T (do separately) --tksurfer.c: write_val_{annoted,annotedcol,unmasked}_vertices use 2 new functs --tksurfer.tcl: usecurrcoordsflag/usetalcoordsflag ticks to "|ta|cu|" tixSelect --tksurfer.c: extract new funct: write_label_vtxline,write_labeled_vertices uses --tksurfer.c: extract new funct: write_label_hdr, write_labeled_vertices uses --lib/help/tksurfer/nsamp_{search,dfrac,max,min,fracmax,fracmin}: update --tksurfer.tcl: fix R-click help on "label:" label popup --lib/help/tksurfer/label_write: update --tksurfer.c: find_orig_vertex_coordinates, write_labeled_vertices use it --tksurfer.c: extract new function: move_along_normal(k,vb,x,y,z,&x2,&y2,&z2) --tksurfer.tcl: overload "c2lab" button with usetalcoordsflag --tksurfer.c: separator: '=' to '_' for write_val_{annotedcols,idnum}_vertices --tksurfer.tcl: event generate buttonbars for R-clk help for REDRAW, RESTORE --lib/help/tksurfer/selectdmax: update --tksurfer.tcl: overload "clo" button with $selectinsideflag --tksurfer.c: if $selectinsideflag, draw cursor underneath surface (instead) --tksurfer.c: add/export $selectinsideflag (N.B.: cancels outside select!) --tksurfer.tcl: display label (labelD_display) opens label control popup (duh!) --lib/help/tksurfer/isocont: update --tksurfer.tcl: add isocontour controls pop-up for R-click "isocont" --lib/help/tksurfer/{label_read,label_toggle}: update --tksurfer.tcl: padlabelvtxsflag in label tickbox popup, hotkey, warn label read --tksurfer.c: add padlabelvtxsflag to read_label_to_annot_using_col (also neigh) --tkmedit.tcl: "im2:" label popup: better description (test vs. apply) --lib/help/tkmedit/im2label: clarify transpar overlay test vs apply to editable --tkmedit.c: COMPARE/TRUNC: event generate -> call proc, fix TRUNC cmd-. bind --tkmedit.tcl: COMPARE: event generate -> call proc, cleanup TRUNC/PF/PFGAU [tmprelease 240519] --tksurfer.tcl: fix def bind for Return in label: entry (invoke fail w/no-cmd) --tksurfer.tcl: fix def bind for Return in val: entry (invoke fail w/no-cmd) --tksurfer.c/tcl: check " invoke" of "buttons $f SOMEBUTTON { }" --tkmedit.c: WMTRUNC,CORONAL invoke -> event generate (b/c empty cmd/only bind) --tkmedit.tcl: change invoke to event generate: SMOOTHGAUSS,TRUNC,CORONAL,TEST --tkmedit.c: COMPARE Xkeys: add alt/cmd-C for COMPARE --tkmedit.c: COMPARE Xkeys: invoke->event generate (b/c empty cmd/only bind) --tkmedit.tcl: COMPARE hotkeys: add alt/cmd-C for COMPARE --tkmedit.tcl: COMPARE hotkeys: invoke->event generate (b/c empty cmd/only bind) --tkmedit.c,tcl: search " invoke" of "buttons $f SOMEBUTTON { }" -> event gen --tkmedit.tcl: mv up imim2 ctrls un-overlap TRUNC buttbar (not if from OP butt) --lib/help/tkmedit/wmtrunc: add imim2op help (overlap w/imim2op OP help) --tkmedit.tcl: add imim2op colspace ellipse to TRUNC buttbar, ctrls to OP --tkmedit.tcl: rm do_imim2op arg --tkmedit.tcl: add buttbar for SMOOTH{STRUCT/STATS} button, incl calc grad x/y/z --tkmedit.tcl: add buttonbar for PF,PFGAU butts (event gen hack for compact) [tmprelease 240503] --tkmedit.c: catch crash in FILL struct 3D ROI if (irrelevant) im2(i) not loaded --tkmedit.tcl: add buttonbar for FILL button (event gen hack for compactness --tkmedit.tcl: COMPARE/TRUNC: 'after 1' fix butt state race after bind->proc --tksurfer.tcl: put neighbor order info on paintball popup into [tmprelease 240501] --tkmedit.tcl: add toggle linearflag button to COMPARE buttonbar --tkmedit.tcl: add buttonbar for COMPARE button, change bind's to proc's --tkmedit.tcl: buttonbar for F3 TEST butt (event gen hack keep binds like APPLY) --tkmedit.tcl: buttonbar for CORONAL (event gen hack to keep binds like SAG/HOR) --tkmedit.tcl: convert TRUNC butt bind's to procs (rm event generate hacks) --tkmedit.tcl: section dividers for readability ########################################################################## UPDATE: 26 Apr 2024 ########################################################################## --tksurfer.tcl: new buttonbar for areal-line "D" button --tksurfer.tcl: new buttonbar for "SMOOTH" button --tksurfer.tcl: conv val-line "W" butt bind's to procs (rm event generate hacks) --tksurfer.tcl: new buttonbar for val line "CLR" button (just 2: val, all) --tksurfer.tcl: new buttonbar for val-line "CS" button (just 2: cluster, FDR) --tksurfer.tcl: conv val-line "S/V" butt bind's to procs (rm event gen hacks) --tksurfer.tcl: new buttonbar for val-line "R" button (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "X" butt (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "S" butt (bind's -> proc's) --tksurfer.tcl: new button bar for label-line "T" butt (bind's -> proc's) --tksurfer.tcl: conv fs-line GR butt bind's to procs (rm event generate hacks) --tksurfer.tcl: conv label-line W butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line R butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line CLR butt bind's to procs (rm eventgenerate hack) --tksurfer.tcl: conv label-line C butt bind's to procs (rm event generate hack) --tksurfer.tcl: conv label-line D butt bind's to procs (rm event generate hack) --tksurfer.tcl: fix stale funct name: read_poi_annot -> read_poi_to_annot [tmprelease 240418] --lib/help/tksurfer/label_write: update write_sorted_by_pathdist_label --tksurfer.tcl: R-clk label W for C pathsort: write_sorted_by_pathdist_label ... ################################################################### UPDATE: 07 May 2025 ################################################################### ------------------------------------------------------------------- Summary: (1) better instructions, testing, getonearch bugfix for latest Apple Silicon (2) new functs to make/process 3D cortical ribbon ROIs from rh/lh-*.annots (3) new 3D cortical ribbon ROIs/parcellations (Csurf, HCP-MMP1) (4) how to view 3D ROIs/parcellations/overlays in tkmedit (5) tcl script to make left+right color lookup table (6) cerebellar dentate nucleus surface recon and flattening ------------------------------------------------------------------- ------------------------------------------- (1) Better instructions, testing, getonearch bugfix latest Apple Silicon ------------------------------------------- [no effect on Linux distribution] Finally got access to latest Apple Silicon for testing. A recent Apple change in the uname -p response broke getonearch, which broke FreeSurferEnv.{sh,csh}, which broke startup of any csurf program :-{ Now fixed. The current distribution requires Rosetta 2: softwareupdate --install-rosetta --agree-to-license Working on native arm64/universal compile, to get rid of this requirement. Very good performance through Rosetta 2. Apple seeoms to have fixed the long-standing appnap bug that was catastrophically slowing down X11 apps, so I have turned off my hack fix (pop-up/kill xterm over X11 window so resulting expose event speeds draw). If problems comes back, can toggle the hack on/off in csurf Preferences. ------------------------------------------- (2) new functs to make/process 3D cortical ribbon ROIs from rh/lh-*.annots ------------------------------------------- There are three new functions for making 3D ROIs from fsaverage surface annotations, for both individual subjects, as well as for fsaverage itself: (a) fill_idnumbrik_holes This function examines the 26 voxels surround an empty (idnum=0=Unknown) voxel. If more than $threshneigh (default=13) contain idnums, it replaces the hole with the most common surrounding idnum. N.B.: This writes over its input. (b) merge_idnum_briks This function merges right and left hemisphere 3D ROI (idnum) BRIKs. If a voxel from the first BRIK is already occupied, if the second BRIK has an occupied voxel there, it will overwrite the voxel in the first BRIK. The input BRIKs must have the same dimensions and orientations. (c) read_shortbrik_write_mgz This function converts a 256^3 1mm^3 BRIK into an *.mgz parcellation (typically for fsaverage). ------------------------------------------- (3) New 3D ROIs/parcellations ------------------------------------------- 3D parcellations for the fsaverage orig volume made from the fsaverage orig surfaces are now included in the csurf distribution in $CSURF_DIR/subjects/fsaverage-ADDITIONS/mri): CsurfMaps1.mgz CsurfMaps1+orig.BRIK CsurfMaps1+orig.HEAD HCP-MMP1.mgz HCP-MMP1+orig.BRIK HCP-MMP1+orig.HEAD and can also be downloaded from here: https://pages.ucsd.edu/~msereno/csurf/fsaverage-labels/ These color tables have uniquely numbered and colored left and right hemisphere regions and are suitable for standard 3D analyses. The corresponding color tables can be found in the distribution here: $CSURF_DIR/lib/lut/CsurfColorLUT-both.txt $CSURF_DIR/lib/lut/HCP-MMP1ColorLUT-both.txt These extend from a cortical thickness depth fraction of 0.0 to 1.1 above the fsaverage orig (gray-white matter boundary) surface. These were generated with the improved annot2roi.tcl tcl script popup, which uses the new functions above. ------------------------------------------- (4) How to view 3D ROIs/parcellations/overlays in tkmedit ------------------------------------------- To view a 3D parcellation in tkmedit, select one (e.g., CsurfMaps1.mgz, HCP-MMP1.mgz) from the "im2:" dropdown at the middle bottom, and click the adjoining "R" (read) button. Double-middle-click a region to get a popup with the region name, idnum, and color. ------------------------------------------- (5) tcl script to make left+right color lookup tables ------------------------------------------- There are multiple conflicting conventions for region ID color tables in FreeSurfer. Here are features of some variants: FreeSurferColorLUT.txt (ASCII) -- for assembling *.annot file from indiv. *.label files -- non-sequential region id nums (gaps present) -- mostly hemisphere-specific names, different conventions CsurfColorLUT.txt (ASCII) -- for assembling *.annot file from indiv. *.label files (used by csurf tksurfer write_mgh_annot) -- non-sequential region id nums (gaps present) -- non-hemisphere-specific names -- used by csurf tksurfer write_mgh_annot to make annotation -.annot (binary) -- for displaying/using parcellation on hemisphere surface -- contains an embedded color lookup table -- each region must have a unique RGB color -- always sequential region id nums (0=Unknown/unlabeled) -- always one hemisphere .ctab (ASCII) -- written to subject's scriptsdir when tksurfer reads annotation -- this is embedded color lookup table -- always sequential region id nums (0=Unknown/unlabeled) -- names may or may not be hemisphere-specific For a full-brain 3D cortical ribbon ROI parcellation (e.g., Csurf or HCP-MMP1), we need hemisphere-specific names, unique ROI idnums, and unique RGB colors. Therefore, a new tcl script, mkbothlut, is provided to combine freesurfer single-hemisphere color lookup tables (LUTs) into a LUT suitable for use with the 3D cortical ribbon ROIs/parcellations above. Here is the usage: --------------------------------------------------- Use: cd $CSURF_DIR/lib/lut mkbothlut CsurfColorLUT.txt *or* mkbothlut HCP-MMP1ColorLUT.txt [looks for 2 files lh-*,rh-*] Make hemi-uniq idnums/names/cols from ONE hemi-agnostic csurf color LUT: (1) add max LH region idnum to RH region idnums (LH then RH) (2) prefix region names w/L_,R_ (LH is 1st) (3) add 1 to r/red region color *or* Make hemi-uniq idnums from TWO HCP-MMP1 color LUTs (rh-,lh- prefix): (1) concat files (rename from *.ctab scriptsdir outp on read annot) (2) add max LH region idnum to RH region idnums (LH then RH) outfile: CsurfColorLUT-both.txt *or* outfile: HCP-MMP1ColorLUT-both.txt --------------------------------------------------- Here are the properties of the two kinds of output files: CsurfColorLUT-both.txt (ASCII) -- sequential, no gaps, LH is first -- hemisphere-specific names (e.g., R_MT_lower/L_MT_lower) -- unique left/right RGB colors (add 1 to red region color) MCP-MMP1LUT-both.txt (ASCII) -- sequential, no gaps, LH is first -- hemisphere-specific names (e.g., R_MT/L_MT) -- [checks unique left/right RGB colors] These color lookup tables are now included in the current csurf distribution, or available here: https://pages.ucsd.edu/~msereno/csurf/fsaverage-labels/ ------------------------------------------- (6) cerebellar dentate nucleus surface recon and flattening ------------------------------------------- In the process of revising a cerebellar atlas paper (earlier version): https://www.biorxiv.org/content/10.1101/2024.08.27.610006v1.full.pdf I have distributed a left and right deep cerebellar dentate nucleus surface reconstruction and flattening in the same coordinate system as the original cerebellar cortex reconstruction: https://pages.ucsd.edu/~msereno/cereb/updates/dentate-nucleus I also added the vermis labels and flattenings, including labels that now continue into the anterior lobe: https://pages.ucsd.edu/~msereno/cereb/updates/vermis-labels/cerebmap20 ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- new flag to toggle border/no-borders of newly read labels fix annot2roi.tcl combo box csurf '-' style annotations not loaded (!) fix HCP-MMP1 colortable so tkmedit underlay not washed out g++ compile now error clean savesingleROIbriksflag so avoid indiv ROI BRIK bloat add restore_zero_position to R-click RESTORE button menu clean g++ compile (for eventual ftgl font parcellation text labels) ########################################################################## UPDATE: 07 May 2025 ########################################################################## --update-csurf: Mac add unquarantine note at end --update README.txt: maybe unquarantine (w/tar! don't auto-do since req's pwd) --FreeSurferEnv.{sh,csh}: mention getonearch in unrecognized architecture error --getonearch: fix for mac uname -p now returning "arm" (was "arm64") --csurf/tksurfer.tcl/tkmedit.tcl: appnap OFF apple silicon (kernvers=BigSur=20+) --add cerebmap20-dentate.tgz to csurf/cereb/updates distro --make cerebmap20 compat cerebmap20-dentate-nuc from cereb2c-export-dentate-nuc --rescale surfaces in cereb2c-export-dentate-nuc: flipscale{flat}.tcl, NOTES --csurf: versions to startup stdout, regularize title bar versions --tkmedit.tcl: save imgs w/"w" warns/allows save to new name ims read over start --tksurfer.tcl: add to RESTORE button command/buttonmenu: restore_zero_position --lib/help/tksurfer/patch: document restore_zero_position, rotate_brain_x -90 --mv font/g++/tksurfer.c/Makefile to new dir: tksurfer-ftgl [tmprelease 250217] --update-sdsu-sereno: re-download UCSD fsaverage-labels, fsaverage-ADDITIONS.tgz --tksurfer.c: couldn't get vtx-spec working, curr state left in tksurfer-ftgl.c --tksurfer.c: add freetype/ftgl, compile OK, single lower left display --mk0: add luxisb.ttf to $CSURF_DIR/lib/fonts --tksurfer.c: g++: rm "or", clamp rgb, fix !const char's, signed/unsigned cmp's --tksurfer.c: g++: (void *)->(short ***),etc in contig multidim array mallocs --bin/noarch/mkbothlut: automatically does below --HCP-MMP1ColorLUT-both.txt: ??? 255 255 255->Unknown 0 0 0 0 (fix tkmedit olay) --cd $CSURF_DIR/dist/fsaverage-ADDITIONS/scripts; sh zz-getREADME.sh --update README.txt's on pages.ucsd.edu, download to fsaverage-ADDITIONS --bin/noarch/update-fsaverage; add CsurfMaps1.{mgz,+orig.BRIK}, orig+orig.BRIK --fsaverage-ADDITIONS/mri: add orig+orig.BRIK (+6M inst .tgz) --lib/tcl/annot2roi.tcl: add savesingleROIbriksflag (def=0) --tksurfer.c: savesingleROIbriksflag: if def=0, delete 7G of single-ROI BRIKs [tmprelease 250122] --lib/help/tkmedit/{im2entry,im2read}: update --lib/help/tksurfer/script_annot2roi: update --fsaverage-ADDITIONS: add HCP-MMP1.mgz, HCP-MMP1+orig.{BRIK,HEAD} ($subj/mri) --tkmedit.c: detect {HCP-MMP1,Csurf}ColorLUT-both.txt, rm seq_renum_lut (seq'd) --tkmedit.tcl: detect {HCP-MMP1,Csurf}ColorLUT-both.txt, rm seq_renum_lut(seq'd) --mk0: add mkbothlut: tclscript to mk hemi-specific lib/lut/*ColorLUT.txt files --tksurfer.c: merge_idnum_briks makes unique idnums (lh,rh+maxrh) --lib/help/tkmedit/im2{entry,read}: update --update-sdsu-sereno: fix cerebellum updates bug --lib/help/tksurfer/script_annot2roi: update --tksurfer.{c,tcl}: rename fill_brik_holes -> fill_idnumbrik_holes --update-fsaverage: add CsurfMaps 3D ROI files [tmprelease 250115] --fsaverage-ADDITIONS: add CsurfMaps1.mgz, CsurfMaps1+orig.{BRIK,HEAD} --tkmedit.c: timeout overlay double-mid-click popups --tkmedit.tcl: im2 read mgz parcellation also calls seq_num_lut if match Csurf* --tkmedit.c: read_val2rgblut uses seq_renum_lut if CsurfColorLUT.txt recog'd --tkmedit.c: add/export seq_renum_lut for annot-derived sequential LUTs --annot2roi.tcl: use neighfracthresh (def=0.8) vs. threshneigh --tksurfer.c: fill_brik_holes: threshneigh arg (1-26) -> neighfracthresh (0-1) --tksurfer.c: use above in fill_brik_holes/merge_idnum_briks/shortcorbrik2intmgz --tksurfer.c: new lazy global 3D tmpshortbrik avoid Mac repeat malloc/free crash --tksurfer.c: add makeshort3D: fill_brik_holes/merge_idnum_briks/shortcorbrik2.. --lib/help/tksurfer/script_annot2roi: major update --annot2roi.tcl: mk "annot:" dropdown like main "label:" (.annot only,!setfile) --annot2roi.tcl: convert merged BRIK to mgz parc if subject is fsaverage --annot2roi.tcl: if both right/left hemi idnum ROI BRIKs present, merge them --tksurfer.c: add/export merge_idnum_briks (non-general: short, same dims) --tksurfer.c: add get_brikoris (not exported) --tksurfer.c: get_{brik,bfloat}dims return vs. harsh xit, pass BRIK vs. HEAD --tkmedit.tcl: add CsurfMaps1,MY_ANNOT to 'mgh'seglabstemlist to autodetect parc --annot2roi.tcl: add fill3Dholesflag to run fill_brik_holes --tksurfer.c: fill_brik_holes: patch all-in-one BRIK pial surface holes --annot2roi.tcl: disable/normal feedback for search/nosearch, frac/mm options --tksurfer.c: add/export shortcorbrik2intmgz: 256^3 all-in-one BRIK -> mgz parc --tksurfer.c: get_brikbyteorder: not exported --annot2roi.tcl: rm redundant sampclustctrls popup (main panel has enough) --tksurfer.tcl: add R-click help for entry labels on sampclustctrls --wrappers.tcl: controls proc: uniq window id from new global: $ctrlswinid --tksurfer.tcl: regularize sampclustctrls{win}, return win for reposition --tksurfer.tcl: fix comment-bug crasher "E## force opaque ignoring "tran" entry" --tksurfer.tcl: select_patch: after 100 to (try to) improve missed shift key --annot2roi.tcl: improve feedback sequence, better bugouts --annot2roi.tcl: add sampclustctrls popup, unoverlap by reposition up --annot2roi.tcl: fix combobox wasn't loading '-' style like CsurfMaps1 (!!) --annot2roi.tcl: fsaverage 3D ROIs: auto-make pseudoscandir/funct/regdat --annot2roi.tcl: fsaverage 3D ROIs: force user to mk pseudofunct scandir w/csurf --tksurfer.c: smooth_steps alt functs report filled/eroded --tksurfer.tcl: add annoterode button to R-click smooth_steps help [tmprelease 241208] --tksurfer.tcl: $newreadfulllabflag (tcl) overrides def just show label borders --lib/help/tksurfer/{redraw,arrownorm,label_write}: bigcursorflag behavior --csurf: change startup subject to fsaverage if it exists --lib/help/tksurfer/{redraw,arrownorm}: update --tksurfer.tcl: add toggle bigcursor button to REDRAW right-clk popup [tmprelease 241129] --mk0: 04a: also incl EMAIL in dist and insttmp, UPDATES in dist --tksurfer.c: .._nearest_annot: foreign surf vtxcnt unknown: allow 'off edge' k --tksurfer.tcl: labelW_randcolannot/write_statids2randcolannot chks overwrite --tksurfer.tcl: better HOWTO save/see result on 'paintballs' popups --tksurfer.tcl: isocont popup action button sets isocontourflag --tksurfer.tcl: R-clk smoothsteps buttbar for numer/non-numer smooth steps opts ########################################################################## UPDATE: 12 Nov 2024 ########################################################################## --lib/help/tksurfer/{smooth_steps,label_read,selectdmax}: update --tksurfer.c: read_label_to_nearest_annot_using_col: ignore ripflag vtxs --tksurfer.c: fill_annot_holes_neigh: ignore ripflag vtxs to speed high neiorder --tksurfer.c: fill_annot_holes_neigh: add neiorder=5 for smaller surfaces --tksurfer.c: fix fill_annot_holes bugs (fill val sometimes 0, then paren bug) --tksurfer.tcl: rm "annotholes-more" b/c fill_annot_holes_neigh is more general --tksurfer.c: rm fill_annot_holes_more (redundant w/fill_annot_holes_neigh) --tksurfer.tcl: "annotholes-neigh" uses funct: C/tcl fill_annot_holes_neigh --tksurfer.tcl: overload smooth steps: add "{annot,label}holes-neigh popup --tksurfer.c: add fill_annot_holes_neigh(neiorder,annotedfrac) general funct --tksurfer.tcl: smoothsteps: "{annot,label}holes-more" -> fill_annot_holes_more --tksurfer.c: add fill_annot_holes_more(): (filled nei minus 3 (vs. minus 2) --tksurfer.tcl: add no-hotkey "D" button: read_label_to_nearest_annot_using_col --tksurfer.c: read_label_to_nearest_annot_using_col(): for updated surfaces [tmprelease 241028] --tksurfer.c: fix write_label_hdr check-fp-writable-code on Linux (& O_ACCMODE) --tksurfer.tcl: disp annot prints totarea all regions (except Unknown) for csurf --tksurfer.c: tot area annot regions (except Unknown) to genstrret_1k/csurflog --tksurfer.tcl: add $lighttwosidedflag to lights popup from R-click help buttbar --tksurfer.tcl: fix R-click report popups for current ta/cu button state [tmprelease 240709] ... ################################################################### UPDATE: 17 Sep 2025 ################################################################### ------------------------------------------------------------------- Summary: (1) option to display annotation region names on surface (2) fourier panel also calculates/paints alternate coherence stat mask (3) better percent resp popup for middle-click "W" on "val:" line (4) distinguish val/stat smooth, ignore dispersion opt for complex smooth (5) gather 14 SMOOTH/fillholes/searchlight functs into R-clk-SMOOTH buttonbar (6) new GR button opts to compute/display per-annot-region avg gradient vecs ------------------------------------------------------------------- ------------------------------------------- (1) option to display annotation region names on surface ------------------------------------------- There is a new option to display MGH annotation region names on the surface. After an annotation has been displayed, tick "areanamesflag" on the LABEL CONTROLS popup. Here is a small vid of what it looks like: https://pages.ucsd.edu/~msereno/csurf/screenshots/areanames.mp4 The label names are centered on the vertex in each annotation region that is closest to the 3D average of the vertices in each region. This 3D average is calculated (by read_mgh_annot) on whatever surface (folded, inflated, flattened) the annotation was read onto. To print out the averages and nearest vertices, use the bottom button, "Write Region Centers to scriptsdir (no hotkey)", from the button bar available from a R-click on the "W" (write) button on the "label:" line. The fontsize is autoscaled when using the SCALE slider or changing the size of the GLX/OpenGL display window. It can also be manually fine-tuned by using $fontsize (default 9, for roughly 9 point at initial startup, on the popup). Adding the FTGL/freetype font library necessitated a g++ compile (C++, vs plain C gcc), which helped clean up a little cruft. No speed difference detected for any display or compute function. Adding font-drawing capabilities also finally allowed me to label the 1 cm scale bar :-} Finally, there is a new tksurfer command line option, -fontfile , to allow using a different font than the included luxisb.ttf (copy alt .ttf font into $CSURF_DIR/lib/fonts, else defaults back to luxisb.ttf). ------------------------------------------- (2) fourier panel also calculates/paints alternate coherence stat mask ------------------------------------------- Another measure of significance of response to 'phase-encoded' stimuli, coherence, is now automatically calculated upon clicking FOURIER on the csurf SessionTools -> Calculate 3D Fourier Stats panel. This is saved in a scandir as a 3D stat BRIK with the infix _c. The coherence is defined as: stimfreq_amp / sqrt(sum(noisefreq_amps^2)) after ignoring 2nd and 3rd harmonics and their +/- neighbors as neither signal nor noise. This 3D stat is also automatically sampled to the surface when clicking PAINT on the fourier panel. To use the coherence (instead of F) as a mask, open the SessionTools -> View Functional Data panel, select "sig+coher", which will auto-select the coherence StatMask Paintfile with the "_c" infix. A popup panel will ask to reset the 6 relevant thresholds ($sfslope, $sfmid, $sfthresh and $fslope, $fmid, $fthresh) to sane values. Ticking/unticking "FTamp" (use raw Fourier amplitude, _x,_y, vs. sqrtF-substituted amplitude, _r,_i) will bring up the same popup. The results of the coherence calculation are quite similar to the standard csurf F mask. ------------------------------------------- (3) better percent resp popup for middle-click "W" on "val:" line ------------------------------------------- There are three ways in csurf to obtain percent response measures from Fourier transformed timecourses: (A) single vertex: load 3D _x,_y Fourier transform data BRIKs ctrl-middle-click vertex => look in csurf log (B) avg percent resp over label find/make label load 3D _x,_y Fourier transform data BRIKs shift-left-click "T" on "label:" line => percent resp in log, on final popup (C) vertexwise percent: load 3D rawata load 2D _x,_y Fourier transform data wfiles vertexwise percent displayed => makes wfile Previously, method (C) required entering the rawdata average (used where no rawdata was available, e.g., cross subject, phase averaged data). Now it can also be calculated from the rawdata itself if it is available. ------------ New R-click help for method (C) above: ------------ An alternative middle-click on the "W" button brings up a popup that converts raw Fourier transform data to vertexwise percent responses, displays the results, and writes them to a wfile (infix: _%). To do this, we need the time series average brightness. This can either be calculated from the raw time series BRIK if this is available, or it can be entered directly, if it is not available (e.g., phase average, or cross-subj average). (1) First, load the raw Fourier amplitude wfiles to the surface. Pick the _x (or _y) surface wfile from the "val:" dropdown and click "R" (picking either loads both). (2) Second, if raw data is present, load it. This can be done quickly by ctrl-mid-clicking the surface (to display a single vertex timecourse, which auto-loads the rawdata), or more verbosely as follows: click "val:" label to change it to "val3d:" click "RD" to get read rawdata popup select rawdata timeseries BRIK in dropdown click READ RAWDATA & REGISTRATION on popup [now back to the RAW FOURIER TO PERCENT popup] (3) Third, find average rawata brightness. If rawdata has been loaded, click: COMPUTE AVG t-SERIES EACH VTX on the popup. Once this finishes, the $avg_rawamp entry will be set to "vtxwise", and the number of $time_points will be set. If no rawdata is available, manually enter the average rawdata brightness (voxels in brain - or brains), and number of timepoints. avg_rawamp: avg brain voxel timecourse brightness time_points: TRs in timecourse (e.g., 512) (4) Finally, compute percent response by clicking: COMPUTE PERCENT RESP on the FOURIER TO PERCENT RESPONSE popup. The .stat field at each vertex will now be filled with response percent, which will then be swapped to the viewable .val field, and then the color scale adjusted to display real values. Finally, the .stat field result will be written to a wfile with a "_%" infix. To return to viewing the complex data, re-swap stat and val, by left-clicking S/V. Implementation details The tcl/C function to calculate the vertexwise raw data average is: compute_tseriesavg2stat The tcl/C function to calculate percent resp is: compute_dftamp2pcnt2stat $avg_rawamp $time_points In tksurfer.tcl, the proc writedftampctrls makes the popup and the two popup buttons call the following tcl proc's: do_computetseravgs do_writedftamp which finally call the two C/tcl functs above. N.B.: results are valid only if the complex-valued raw Fourier transform of timeseries at stim freq frequency has been read onto surface (this data typically has _x,_y infixes). This *vertexwise* operation partly overlaps with shift-left-click on the "T" button, which by contrast, displays the average response percent *across an entire label*. The tcl/C functions run by do_writedftamp are: compute_dftamp2pcnt2stat $avg_rawamp $time_points swap_stat_val set complexvalflag 0 setfile val ${stem}_%-${hemi}.w write_binary_values Entering -1.0 for $avg_rawamp is a flag meaning use average rawdata amplitude currently saved in .stat field (vs. use the argument value, which should be positive). Here is the C-code for compute_dftamp2pcnt2stat: if (avgrawamp == -1.0) usestat = 1; for (k=0; ktcl: desperate hack fix flashy labels w/script [tmprelease 250810] --csurf: add Expert Preferences->Views alt font, pass -fontfile to tksurfer [tmprelease 250810] --csurf: add Expert Preferences->Views alt font, pass -fontfile to tksurfer [tmprelease 250808] --mk0: 04f: combine separate but dependent freetype,ftgl compiles to "libftgl" --tksurfer.c: add opt -fontfile for diff .ttf font put into $CSURF_DIR/lib/fonts --tksurfer.c: 1 cm label same col as scalebar, tweak bar thick, font size/pos --tksurfer.c: separate draw_areanames dthresh (depth) inflated vs. folded surf [tmprelease 250804] --tksurfer.c: fix linux compiler cast warnings --mk0: 04e: add freetype, ftgl for static tksurfer compile --tksurfer.c: new fast draw_areanames: cmp testpnt depth w/glReadPixels readback [tmprelease 250802] --tksurfer.c: draw_areanames: test neigh to 6th order to fix sloppy re-select --tksurfer Makefile: LIB_PATH mv X11 after freetype/ftgl to get static freetype --lib/help/tksurfer/{label_write: update --tksurfer.tcl: "Write Region Centers" butt R-clk "W" on "label:" line buttbar --tksurfer.c: draw_areanames: add brightness cue to reduce edge flashing --tksurfer.c: draw_areanames: hacky/slow/working select_vertex occlusion test --mk0: dist/insttmp: copy luxisb.ttf to $CSURF_DIR/lib/fonts --tksurfer.c: add write_annot_region_centers (scriptsdir:AnnotRegionCenters.txt) --lib/help/tksurfer/{label_toggle,meshr/g/b,label_read}: update --tksurfer.c: fix scalebar label scaling/placement --tksurfer.tcl: if vars exist, add $areanamesflag, annot-warn to LABEL CONTROLS --tksurfer.c: newvars: export: fontname,areanamesflag, intern: FTFont --tksurfer.c: newfunc: export:draw_areanames intern:initfont,drawstr_centonvec --tksurfer.c: #include FTGL/ftgl.h, #define FTGLFONT to included luxisb.ttf --tksurfer.c: add ifdef'd __cplusplus FTGL font code below (req's g++) 3 above: --tksurfer.c: add find_regionvtx_nearest_avg, always do (fast) in read_mgh_annot --tksurfer.c: add vec2glxwinpix so to use glBitmap (vs. glRasterPos) for FTGL --tksurfer Makefile: logic so just changing CMPL to g++ fixes libs/includes --tksurfer.c: add find_regionvtx_nearest_avg, always do (fast) on read_mgh_annot --tksurfer.c: add vec2glxwinpix to use glBitmap (vs. glRasterPos) for FTGL --tksurfer.c: finally rm stale select_vertex v->dist test (cause of occas fail?) --lib/help/tksurfer/{fmid,sfmid}: doc inverse relation fmid,fslope [tmprelease 250708] --lib/help/tksurfer/setuprender: update --csurf: tick/untick "FTamp" triggers ask reset using askresetcmplxthresh2sane --csurf: reset chks $renderscanlists($page,fourierampflag): sm sqrtF vs lg FTamp --csurf: extract ask reset code to proc askresetcmplxthresh2sane --csurf: select_complexstatsource asks reset thresholds on select "PhaseMask:" --csurf: addrenderscan: sig+coher PhaseMask, fix select buttnames, shrink title [tmprelease 250703] --csurf: fourier panel Painted VertexList Files (outputs) adds _c coherence --csurf,mk0: "All Help Contents" starts with all-help, new/calc all-help header --lib/help/csurf/{setupfour,setuprender}: document coherence stat mask --csurf: View Functional Data (already) loads new *_c-$hemi.w --csurf: paintcmd (PAINT button) also paints new fourier.c _c coherence output --fourier.c: always also write out coherence to _c BRIK, update usage [tmprelease 250617] --lib/help/tksurfer/nonbinaryfs,mk0,tksurfer.tcl -> helpfile name: gradfsarrows --tksurfer.tcl: fstickctrls warn re-calc grad areaoutliermin,rmgradoutliersflag --tksurfer.c: centerarrowsflag now also works for curved 3d surface arrows --lib/help/tksurfer/{arrownorm,nonbinaryfs}: update --tksurfer.tcl: warn (both popups) re-calc gradient if change rmgradoutliersflag --tksurfer.tcl: FIELDSIGN and GRADIENT ARR: $rmgradoutliersflag --tksurfer.tcl: FIELDSIGN and GRADIENT ARR: $sdoutlierfact, $areaoutliermin --tksurfer.tcl: FIELDSIGN and GRADIENT ARR: $centerarrowsflag, $angoffrevarrflag --tksurfer.tcl: FIELDSIGN popup: sdoutlierfact,areaoutliermin,rmgradoutliersflag --tksurfer.tcl: ARROWS/NORMALS/POINTS popup: add $rmgradoutliersflag --tksurfer.c: add/export: double sdoutlierfact,areaoutliermin --tksurfer.tcl: bind to warn filledarrowsflag w/3Dsurf (no space Lbracket,plus!) [tmprelease 250604] --tksurfer.tcl: move up fstickctrls to unoverlap buttonbar if from R-click GR --lib/help/tkmedit/*: regularize header lines in 109 helpfiles --lib/help/tksurfer/*: regularize header lines in 280 helpfiles --tksurfer.tcl: R-clk GR, clk unmarked fstick -> fieldsign/gradient arrows ctrls --tksurfer.tcl: mid-clk DIST now reports edges (tksurfer.c genstrret_1k append) --tksurfer.c: compute_avg_edgewidth appends edge count to genstrret_1k --lib/help/tksurfer/dist: update, Euler, howto calc edges from vtxs,faces --tksurfer.tcl: middle-click on DIST button does compute_avg_edgewidth --tksurfer.c: add/export compute_avg_edgewidth, output to log and $genstrret_1k --csurf: add missing SMOOTH types to help panel (valonly,stat,grad) --lib/help/tksurfer/smooth_stat: new (update mk0, add R-clk to tksurfer.tcl)) --lib/help/tksurfer/smooth: update (add smooth_stat to SMOOTH buttonbar) --tksurfer.tcl: add smooth_stat to SMOOTH R-click buttonbar (no vis radiobutton) --lib/help/tksurfer/softtruncwidth: new, "soft" popup cp avoids new allhelp ent --lib/help/tksurfer/{smooth,smooth_steps,smooth_weight}: smooth_stat, alt smooth --tksurfer.c: add smooth_stat (vs. currently using swap stat val and smooth_val) --lib/help/tksurfer/smooth_weight: update for popup --tksurfer.tcl: mini popup on R-click "w" smoothing to control $halfweightdist [tmprelease 250529] --lib/help/tksurfer/smooth: update --tksurfer.tcl: check appropriate fields loaded for all SMOOTH/fillholes functs --tksurfer.tcl: combine SMOOTH/smoothsteps buttonbars, expand -> all smoothtypes --lib/help/tksurfer/restore: document restore_zero_position, make_lateral_view --tksurfer.tcl: tick isocont makes popup (prev just R-click isocont label) [tmprelease 250519] --lib/help/csurf/setuprender: fix $revphaseflag, $angleoffset, other flags --tksurfer.tcl: "sft" -> "soft" (unoverlap sfthresh!) --csurf: defsmooth down if fsaverage: ecc:20/20->3/2 (rend,stat), pol:10/10->2/1 --csurf: block auto change to fsaverage if started from scripts dir --lib/help/csurf/setuprender: update: for new "labels" --csurf: update/homogenize/improve View Functional Data panel dual-field labels [tmprelease 250516] --lib/tcl/{eccen,polar,twocond}-{views,flat}.tcl: pass/use $smoothstepsstat --lib/tcl/{eccen,polar,twocond}-{views,flat}.tcl: separate val/stat smooth parms --lib/tcl/{eccen,polar,twocond}-{views,flat}.tcl: $smoothoverlaymaskflag ignored --csurf: addrenderscan: rm "m" tickbox (smoothoverlaymaskflag now only 3D/tkmed) --csurf: addrenderscan: add entry to distinguish data and stat smoothing --csurf: surftestrender: pass $smoothstepsstat by env to scripts --csurf: setdefaultparms: new: renderscanlists(def,smoothstepsstat) 5 ;#statonly --lib/help/csurf/setuprender: update --lib/help/tksurfer/{val_clear,smooth}: update --tksurfer.tcl: add clear_stat button for "val:" line "CLR" buttonbar --lib/tcl/{eccen,polar,twocond}-{views,flat}.tcl: can use $cpxangrealampflag --csurf: addrender: cryptic "m" tick (smoothoverlaymaskflag) explain if changed --csurf: addrender: bare tick to ignore dispersion w/smooth (cpxangrealampflag) --csurf: surftestrender: pass $cpxangrealampflag by env to scripts --csurf: setdefaultparms: renderscanlists(def,cpxangrealampflag) 0 ;#ignore disp --lib/help/csurf/setuprender: add refs to 3 kinds of FT->percent at end [tmprelease 250513] --lib/help/tksurfer/val_write: major update --tksurfer.tcl: add COMPUTE AVG t-SERIES EACH VTX (do_computetseravgs) to popup --tksurfer.tcl: rewrite RAW FOURIER TO PERCENT RESPONSE pop-up --tksurfer.c: compute_dftamp2pcnt2stat div by avgrawamp in .stat if avgrawamp=-1 --tksurfer.c: compute_tseriesavg2stat from rawdata, export rawdata_{xyzt}dim --lib/help/tksurfer/val_write: fix backwards "cat" command (!), FT amp doc --csurf: empty tarfiledate -> "none" (local compile vs. mk0 insttmp tarfile) ########################################################################## UPDATE: 06 Apr 2025 ########################################################################## --update-csurf: Mac add unquarantine note at end --update README.txt: maybe unquarantine (w/tar! don't auto-do since req's pwd) --FreeSurferEnv.{sh,csh}: mention getonearch in unrecognized architecture error --getonearch: fix for mac uname -p now returning "arm" (was "arm64") --csurf/tksurfer.tcl/tkmedit.tcl: appnap OFF apple silicon (kernvers=BigSur=20+) --add cerebmap20-dentate.tgz to csurf/cereb/updates distro --make cerebmap20 compat cerebmap20-dentate-nuc from cereb2c-export-dentate-nuc --rescale surfaces in cereb2c-export-dentate-nuc: flipscale{flat}.tcl, NOTES --csurf: versions to startup stdout, regularize title bar versions --tkmedit.tcl: save imgs w/"w" warns/allows save to new name ims read over start --tksurfer.tcl: add to RESTORE button command/buttonmenu: restore_zero_position --lib/help/tksurfer/patch: document restore_zero_position, rotate_brain_x -90 --mv font/g++/tksurfer.c/Makefile to new dir: tksurfer-ftgl [tmprelease 250217] --update-sdsu-sereno: re-download UCSD fsaverage-labels, fsaverage-ADDITIONS.tgz --tksurfer.c: couldn't get vtx-spec working, curr state left in tksurfer-ftgl.c --tksurfer.c: add freetype/ftgl, compile OK, single lower left display --mk0: add luxisb.ttf to $CSURF_DIR/lib/fonts --tksurfer.c: g++: rm "or", clamp rgb, fix !const char's, signed/unsigned cmp's --tksurfer.c: g++: (void *)->(short ***),etc in contig multidim array mallocs --bin/noarch/mkbothlut: automatically does below --HCP-MMP1ColorLUT-both.txt: ??? 255 255 255->Unknown 0 0 0 0 (fix tkmedit olay) --cd $CSURF_DIR/dist/fsaverage-ADDITIONS/scripts; sh zz-getREADME.sh --update README.txt's on pages.ucsd.edu, download to fsaverage-ADDITIONS --bin/noarch/update-fsaverage; add CsurfMaps1.{mgz,+orig.BRIK}, orig+orig.BRIK --fsaverage-ADDITIONS/mri: add orig+orig.BRIK (+6M inst .tgz) --lib/tcl/annot2roi.tcl: add savesingleROIbriksflag (def=0) --tksurfer.c: savesingleROIbriksflag: if def=0, delete 7G of single-ROI BRIKs [tmprelease 250122] --lib/help/tkmedit/{im2entry,im2read}: update --lib/help/tksurfer/script_annot2roi: update --fsaverage-ADDITIONS: add HCP-MMP1.mgz, HCP-MMP1+orig.{BRIK,HEAD} ($subj/mri) --tkmedit.c: detect {HCP-MMP1,Csurf}ColorLUT-both.txt, rm seq_renum_lut (seq'd) --tkmedit.tcl: detect {HCP-MMP1,Csurf}ColorLUT-both.txt, rm seq_renum_lut(seq'd) --mk0: add mkbothlut: tclscript to mk hemi-specific lib/lut/*ColorLUT.txt files --tksurfer.c: merge_idnum_briks makes unique idnums (lh,rh+maxrh) --lib/help/tkmedit/im2{entry,read}: update --update-sdsu-sereno: fix cerebellum updates bug --lib/help/tksurfer/script_annot2roi: update --tksurfer.{c,tcl}: rename fill_brik_holes -> fill_idnumbrik_holes --update-fsaverage: add CsurfMaps 3D ROI files [tmprelease 250115] --fsaverage-ADDITIONS: add CsurfMaps1.mgz, CsurfMaps1+orig.{BRIK,HEAD} --tkmedit.c: timeout overlay double-mid-click popups --tkmedit.tcl: im2 read mgz parcellation also calls seq_num_lut if match Csurf* --tkmedit.c: read_val2rgblut uses seq_renum_lut if CsurfColorLUT.txt recog'd --tkmedit.c: add/export seq_renum_lut for annot-derived sequential LUTs --annot2roi.tcl: use neighfracthresh (def=0.8) vs. threshneigh ... ################################################################### UPDATE: 02 May 2026 ################################################################### ------------------------------------------------------------------- Summary: (1) find gradient reversals (curv, real-valued, phase) (2) export annot region IDs to label/wfile (copy_idnum_val) (3) new csurf menu item: add Preferences -> Upate Csurf (4) tksurfer: alt/cmd-z undo for accidental clear vertex marks ------------------------------------------------------------------- ------------------------------------------- (1) find gradient reversals (curv, real-valued, phase data) ------------------------------------------- There is a new 13th "Find Gradient Reversals" button on the R-click popup for the tksurfer "GR" (gradient) button. It runs the C/tcl function, find_gradient_reversals. This requires that a gradient (of .curv, real-valued data in .val, or complex-valued phase data from .val and .val2) has first been calculated and displayed using one of the first 12 buttons on the "GR" right-click popup. For each vertex, the absolute angular difference (lesser of CW and CCW angles) between the gradient vector at the vertex and the gradient vectors at each neighboring vertex are measured. For each angular difference that exceeds $mindiffphase, the .pval field for that vertex is incremented by 1/n, where n is the number of neighbors. The permissive default value of $mindiffphase is 0.1 (36deg) (0.5=180deg), which can be increased to reduce noise in the reversal detection. The calculated vertexwise .pval's are saved as a wfile in the current scandir (or in the subject's scripts dir for curv gradient reversals) as: gradrevprob_k-$hemi.w The gradient reversals can be displayed in two ways. By default, $pvalborddotflag is ON (ticked), which displays reversal vertices as cyan dots (color adjustable in the the popup), with a .pval threshold controlled by $dthresh (default 0.3). Turn this up to reduce the number of dots displayed (i.e., require a higher pval). If $pvalborddotflag is unticked, there will be a popup offering to swap .pval into the .val field and display it using colscale 11 (BRy). Here are some screenshots of using this function on retinotopy and curvature data: https://pages.ucsd.edu/~msereno/csurf/screenshots/reversals-4polavg.jpg https://pages.ucsd.edu/~msereno/csurf/screenshots/reversals-curv+gradarrows.jpg ------------------------------------------- (2) copy_idnum_val: export annot region IDs to label/wfile ------------------------------------------- A new C/tcl function, copy_idnum_val, was added to the R-click "S/V" (swap stat val) button bar. After an MGH annotation file has been loaded and displayed, this will copy the integer region ID numbers to the .val field at each vertex. This allows writing out a labelfile OR a valfile as a lightweight version of an annotation. The x,y,z coordinates in the labelfile can be 'original' (from $hemi.orig), or can be Talairach (MNI 305 or MNI 152, as selected by |la|cu| buttons at the upper left, prior to writing the file. This was used to add 8 lightweight 'annotation' files (labelfiles, valfiles): {rh,lh}-CsurfMaps1_MNI152.label {rh,lh}-CsurfMaps1_MNI305.label CsurfMaps1_newcurv-{rh,lh}.w CsurfMaps1_old3byte-{rh,lh}.w to both the csurf download site and the fsaverage and fsaverage-ADDITIONS tarfiles: https://pages.ucsd.edu/~msereno/csurf: fsaverage-labels/CsurfMaps1-parcellation/simple-annot/* fsaverage.tgz # full, updated fsaverage-ADDITIONS.tgz # just additions, updated ------------------------------------------- (3) Add Preferences -> Update Csurf ------------------------------------------- There is a new csurf menu item to auto-run the 'update-csurf' shell script from the csurf interface itself. It moves the existing install aside to a dated directory. You have to quit/restart csurf to get the new version. The old, moved-aside install directory and the new tarfile can/should be deleted to save space afterward. ------------------------------------------- (4) tksurfer: alt/cmd-z undo for accidental clear vertex marks ------------------------------------------- An alt/cmd-z in the surface display window restores vertex marks accidentally cleared with a R-click. This is useful when making difficult cuts on complexly shaped surfaces for flattening (e.g., cerebellum :-} ). ----------------------------------------------- Bug fixes, small changes ---------------------------------------------- Rm'd Apr2026 vtx range chk on deref'd selected ptr that broke 1st tksurfer GOTO Better layout of fieldsign and find retin borders panel tksurfer.c: add compute_laplacian (curv, real, complex phase) tksurfer.c: write_label_hdr() includes Talairach 152 vs. 305, normd{frac}samp new opt cancels separate overlay fade into 2 sulc/gyrus grays above fthresh ########################################################################## UPDATE: 02 May 2026 ########################################################################## [newrelease 260502] --lib/help/tksurfer/{save,goto}_pnt: update --tksurfer.c: sensibly rename: *vindex -> *selectedptr (in 2 functs below) --tksurfer.c: same fix as below for (script-only) select_talairach_point [tmprelease 260429] --tksurfer.c: funct below passed &selected(def=-1) so deref rngchk brks 1stcall --tksurfer.c: rm bad select_orig_vertex_coords err chk *vindex - broke 1st GOTO --tksurfer.tcl: bind toggle nobicurvfadeoverfthresh mid-clk F3 panel "cv" radio [tmprelease 260426] --tksurfer.tcl: cut_{line,vertices},uncut_connected_vertices: warn no selected --lib/help/tksurfer/curv_tick: update --tksurfer.tcl: bind toggle nobicurvfadeoverfthresh mid-clk "[ ] curv" tickbox --tksurfer.c: add/exp nobicurvfadeoverfthresh:no diff fade to sulc/gyr > fthresh [tmprelease 260412] --tksurfer.tcl: disp-annot,chng-annotbordflag reselect_selected_list:select->top --tksurfer.c: finally fix undo logic! select_vertex w/select=-1 restarts baklist --tksurfer.c: back out: draw_curs 3x for all b/c weird offset select problem? --tksurfer.c: reselect_selected_list: draw last-in-list curs 2x extra fix fail? --lib/help/tksurfe/clks: update, undo --tksurfer.c: glxwin 'cmd-z' restores prev selected list & redisplays --tksurfer.c; add restore_selected_list() --tksurfer.c: clear_vertex_marks_list saves prev (if not already clr:2Rclk help) --tksurfer.c: glxwin 'd' key does reselect_selected_list to see over annot --tksurfer.c: add/export reselect_selected_list() [tmprelease 260108] --csurf: warn {SUBJECTS,FUNCTIONALS}_DIR autoset to inside csurf (by FS Env) --update-csurf: non-verbose untar if "ggo" to not clog csurf.log --csurf: updatecsurfcmd: find moved-aside name before run update-csurf --csurf: check csurf install/update dir writable --csurf: add un-quarantine commands to final updatecsurfcmd popup [tmprelease 260104] --update-csurf: echo pwd/install dir! --update-csurf: Mac warns run xattr (new tar), don't autodo b/c req's passwd --csurf: Preferences->Update Csurf:setupupdatecsurf,updatecsurfcmd: update-csurf --update-csurf: add "ggo" for don't-ask install [tmprelease 260101] --8 file/label lightweight 'annots' (8M) added to fsaverage/fsaverage-ADDITIONS {rh,lh}-CsurfMaps1_MNI152.label {rh,lh}-CsurfMaps1_MNI305.label CsurfMaps1_newcurv-{rh,lh}.w CsurfMaps1_old3byte-{rh,lh}.w --tksurfer.c: write_label_hdr() includes Talairach 152 vs. 305, normd{frac}samp --lib/help/tksurfer/val_{lab,write}: update --tksurfer.tcl: mid-click "val;" makes allverticesflag,val2newcurfflag popup --tksurfer.tcl: left-click "label:" auto-pops up label_label help --lib/help/tksurfer/swapstatval: update --tksurfer.tcl: add copy_idnum_val to S/V (swap stat val) button bar --tksurfer.c: add/export copy_idnum_val (for writing annot-like wfile/label) --lib/help/tksurfer/comp_grad: doc hidden compute_laplacian <0,1,2> funct --tksurfer.c: scale_brain() updates tcl-exported glxzoomfact (not yet used) --tksurfer.c: trunc pval dots w/fthresh (not fully general for all mod flags) --tksurfer.tcl: rm 3 Calc Laplacian (includelaplacian=0),leave procs,tksurfer.c --tksurfer.tcl add 3 Calc Laplacian buttons, comp_disp_laplace proc --tksurfer.c: add/export compute_laplacian (curv,val,phase) -> valbak --wrappers.tcl: allow "whitespace" (use proc null), added into GR gradient menu --tksurfer.tcl: findgradrevctrls help: non-existent findgradrev -> comp_grad [tmprelease 251126] --lib/help/tksurfer/{gradfsarrows,comp_grad}: updates --tksurfer.tcl: add flipRHpolararrowsflag to FIELDSIGN and GRADIENT ARR --tksurfer.tcl: do_gradrev: find_grad..,write pval wfile, borddots/val display --tksurfer.c: add/export pvalborddotflag/dthresh to view .pval above thr as dots --tksurfer.c: find_gradient_reversals: get same ang from 2D/3D grads dot prod --lib/help/tksurfer/gradfsarrows: update stale hotkeys, regularize --tksurfer.tcl: don't trunc lg early-area curv gradients (curv avg flatter/OK) --tksurfer.c: find_gradient_reversals: replace w/new neighbors-only version --tksurfer.c: add/export find_gradient_reversals (similar to find_retin_borders) --tksurfer.tcl: findgradrevctrls popup to run find_gradient_reversals --tksurfer.tcl: calc gradient reversals make-popup-button to GR button R-click --lib/help/csurf/setupfield: respect reordered parms --csurf: Setup Calculate Fieldsign, Borders: dividers, better var description --lib/help/tksurfer/comp_grad: fix avggradvecbak{3d}flag->reggradvecbak{3d}flag ########################################################################## UPDATE: 17 Sep 2025 ########################################################################## [tmprelease 250917] --lib/help/tksurfer/gradfsarrows: update --tksurfer.c: bugfix: compute_{gradient,surfgrad} unset valbaks_cart2polarflag --tksurfer.tcl: do_grad2col bugfixes: accept 3D surfgrad, blk reggrad, colscale --lib/help/tksurfer/comp_grad: update --tksurfer.c: add/export flipRHpolararrowsflag (def=1) for draw_arrows{2,3}d --tksurfer.tcl: add 6 brainregion avg gradient buttons to GR gradient buttonbar --tksurfer.tcl: add reggradvecbak{3d}flags to FIELDSIGN and GRADIENT ARROWS ppup --tksurfer.c: draw_arrows{2d,3d}() can also just draw brainregion[i].avgvtx k's --tksurfer.c: add/exp reggradvecbakflag,reggradvecbak3dflag,reggradvecloadedflag --tksurfer.c: add/export compute_brainregion_avggrads --mk0: insttmp finally puts tardate also into all-help [tmprelease 250829] --lib/help/tkurfer/label_toggle: document dthreshfact, reason for it --tksurfer.tcl: add $dthreshfact hack to LABEL CONTROLS popup --lib/help/*/*: shorten lines for AllHelp (48 vs. 50 wide to reduce white space) --lib/help/tksurfer: update 18 helpfiles: incl buttonbar buttontext for search! --tksurfer.tcl: labelR_val: better error/help if trying to read .cols file --tksurfer.tcl: listcmd_tcl: don't dup dropdown scripts csurf start from subjdir --lib/tcl/zz-examples/assemble-render-maps.tcl: dthreshfact anti-labelflash hack --tksurfer.c export dthreshfact->tcl: desperate hack fix flashy labels w/script [tmprelease 250810] --csurf: add Expert Preferences->Views alt font, pass -fontfile to tksurfer [tmprelease 250810] --csurf: add Expert Preferences->Views alt font, pass -fontfile to tksurfer [tmprelease 250808] --mk0: 04f: combine separate but dependent freetype,ftgl compiles to "libftgl" --tksurfer.c: add opt -fontfile for diff .ttf font put into $CSURF_DIR/lib/fonts --tksurfer.c: 1 cm label same col as scalebar, tweak bar thick, font size/pos --tksurfer.c: separate draw_areanames dthresh (depth) inflated vs. folded surf [tmprelease 250804] --tksurfer.c: fix linux compiler cast warnings --mk0: 04e: add freetype, ftgl for static tksurfer compile --tksurfer.c: new fast draw_areanames: cmp testpnt depth w/glReadPixels readback [tmprelease 250802] --tksurfer.c: draw_areanames: test neigh to 6th order to fix sloppy re-select --tksurfer Makefile: LIB_PATH mv X11 after freetype/ftgl to get static freetype --lib/help/tksurfer/{label_write: update --tksurfer.tcl: "Write Region Centers" butt R-clk "W" on "label:" line buttbar --tksurfer.c: draw_areanames: add brightness cue to reduce edge flashing --tksurfer.c: draw_areanames: hacky/slow/working select_vertex occlusion test --mk0: dist/insttmp: copy luxisb.ttf to $CSURF_DIR/lib/fonts --tksurfer.c: add write_annot_region_centers (scriptsdir:AnnotRegionCenters.txt) --lib/help/tksurfer/{label_toggle,meshr/g/b,label_read}: update --tksurfer.c: fix scalebar label scaling/placement --tksurfer.tcl: if vars exist, add $areanamesflag, annot-warn to LABEL CONTROLS --tksurfer.c: newvars: export: fontname,areanamesflag, intern: FTFont --tksurfer.c: newfunc: export:draw_areanames intern:initfont,drawstr_centonvec --tksurfer.c: #include FTGL/ftgl.h, #define FTGLFONT to included luxisb.ttf --tksurfer.c: add ifdef'd __cplusplus FTGL font code below (req's g++) 3 above: --tksurfer.c: add find_regionvtx_nearest_avg, always do (fast) in read_mgh_annot --tksurfer.c: add vec2glxwinpix so to use glBitmap (vs. glRasterPos) for FTGL --tksurfer Makefile: logic so just changing CMPL to g++ fixes libs/includes ...