################################################################### 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 ...