**fScan Reference Manual, Chapter 3 (KeyCmds:WinKeys): roi ** ===== ROI -- Specify ROI functions ===== **usage: mode,flags h** (see below for variations) ROIMENU -- manipulate ROI interactively ('h') h toggle ROI flag 0h turn off roi 0,1h list active ROIs for this window 0,2h list all active ROIs 1h turn on roi 'text',1 h add text to current ROI 1,type h set default roi type (for subsequent ROIs) 2h select ROI (nearest cursor) 2,flag h select ROI with options 2,flag,num h select ROI by number 'name',2,flag h select ROI by NAME 'name',2,flag,locnum h select and save ROI location 2,flag,num,locnum h select ROI by NAME FLAG: 0 deselect -- make no ROI active 1 select ROI as active 2 select and open ROI for editting 4 save ROI 1st point in savedLoc Locnum 5 save ROI 2nd point in savedLoc Locnum 6 save ROI active point in savedLoc Locnum 7 save ROI stats Peak point in savedLoc Locnum NUM: select ROI by number explictly. Numbering is order for this window (see 0,1h). If NUM is 0 or omitted: For flag < 4, find ROI at cursor (edge or center) For flag 4-6, use current selected ROI LOCNUM: Saved Location number (1-NSAVEDLOCS) 'name'3,type h start new roi (and give it a name) 3 h start new roi of default type 3,type h create roi interactively 3,type,x1,y1,z1 h create pt roi explicitly 3,type,x1,y1,z1,x2,y2,z2 h create block roi explicitly 3,type,x1,y1,z1,xs,ys,zs h create circle roi explicitly 3,type,loc1 h create pt roi using saved loc 3,type,loc1,loc2 h create roi using saved locs 3,type,loc1,xs,ys,zs h create roi using saved loc TYPE: 0 duplicate most recent ROI to current cursor (& edit) 1 single point in 3-D space 2 start and end points of arrow 3 block -- rectangular volume in 3D or 4D corner and 3 lengths, t0 and nt (3D if nt==0) 5 3d cross: ctr pt and 3 lengths 6 3-D elliptical volume: ctr pt and 3 radii 7 path -- linked points in space 8 polygon -- closed path (perimeter on surface) 9 slice polygons -- separate polygon drawn in each slice 10 slice paths -- separate path drawn in each slice 11 area -- perimeter and all internal points 12 shell -- perimeter and all internal points 13 mask -- 2-D areas in image slices LOCn 0 - current cursor location 1-10 - stored location N (1-NSAVEDLOCS [1-10]) 4 h stop editting and save current roi 'name',4h save current marked roi as 'name' 5h set roi parameters 5,r,g,b h set color to R,G,B 'color',5h set color to "color" 5,rgb h set color to RGB (0xRRGGBB) 5,0,flag h set current roi flag to FLG 5,1,flag h turn on FLG bits in current roi flag 5,2,flag h toggle FLG bits in current roi flag FLAG values: 1 - Hide this ROI (don't draw, don't use) 4 - Fill interior of ROI when drawing 8 - Treat circular ROI as cylinder in 3D (default is sphere) 5,3,val h set ROI 'value' to val (default is roi num for data set) 5,4,0 h set polygon seed pt to current cursor location 5,4,x,y,z h set polygon seed pt to specified dataset xyz location 5,5,0 h set contour slice seed pt to current cursor location 5,5,x,y,z h set contour slice seed pt to specified dataset xyz location 5,6,a h set current roi adjuster param to A 5,7,n h set 4th dim low to N (t0 for Block, nsteps for Circle) 5,8,n h set 4th dim high to N (t1 for Block) 5,9 h move vtx to nearest previous (not immediate neighbor) 6h copy ROIs from previous window 'name',6 copy ROIs from named dataset/window 7h edit roi 7,0,n h erase last N points in path (N=0 for all) 7,2,wid,flag h convert arrow roi to rectangular polygon FLAG: 1 - center polygon at arrow tip 4 - fill polygon 7,6,n,flag h convert elliptical roi to N concentric steps FLAG: 1 - inner rois increment r->value 2 - decrement color from max in ctr to 1/2 of original in outermost ring 4 - fill each ring 8 - don't link inner rois to original 16 - reverse increment/decrement sense (with flag 1 or 2) 7,90 h delete current roi for this window 'name'7,90 h delete named roi for this window 7,99 h delete all rois for this window 8h calculate roi stats 'name'8,flag,flag2,mod,val,nlvls,lvl0,dlvl h save stats in NAME, if present FLAG - stat calculation options 1 - mean of voxels 2 - stdev of voxels 4 - include N voxels for each time point 010 - mean time course 020 - calculate laterality index if available 040 - only use non-zero voxels for stats FLAG2 - report generation options 020 - include zero voxel ROI's in report 0100 - save as XML text file 0200 - save as tab-delimited text file MOD 0 - default: 1 if active ROI, 2 if this has glossary, 4 if prev is atlas, 3 if prev has glossary 1 - block ROI's (active or all) 2 - mask values in current data 3 - mask values in prev data set 4 - atlas areas VAL: if > 0, only calculate for this mask value NLVLS: # threshold levels to calc separately (def=1) 'name',9 h write ROIs to file NAME 9,0 h write saved ROIs to file ("rois.txt" by default) 9,nbits,flg,val h write filled ROIs' values to data set NBITS: < 8 -> values are written as low (mask) bits in current data set 8,16,24,32 -> values are written to new data set FLG: 1 write roi values (default, write roi color if NBITS >= 8; otherwise roi->value) 2 write roi color 4 write VAL 8 OR values from different ROIs VAL: Value to write if (FLG & 4) 10h auto roi for surfs For surfaces: 10,1h expand path to geodesic list 10,2h mark all vertices inside path with parm and color 10,3h expand path to include all inside vertices 10,4h paint roi color onto vertices For images: 10,1,flg,dist h expand path by interpolation FLG 1 - reuse same ROI 2 - interpolate contours for intervening slices ? - add node for every voxel DIST step (default) DIST - distance between node steps in mm (default: voxel width) - Flg 2: distance between contours in mm (default: voxel depth) 10,2,flg,dist,val h sample image perpendicular to path at each node; find edge where image intensity crosses VAL boundary, move node to edge if found; flag nodes where no edge found FLG 1 - reuse same ROI (default is create new ROI) 2 - edge is intensity change >= VAL % 4 - only look for edge on one side (default is one side, then the other [left then right]) 8 - swap search directions (look first on right side of path) (default is inward for counter-clockwise path) 16 - first jump away from search direction then search (assumes 4) VAL edge intensity value (default current Thresh value, or 1 if Thresh==0) 10,3,flg,dist h clean up nodes in path FLG 1 - reuse same ROI (default is create new ROI) ? - remove non-edge nodes (after 10,2h cmd) 2 - remove kinks (where path doubles back on itself) 4 - remove outliers (where path jumps 8 - smooth regardless of distance (default: smooth small jumps) DIST 10,5,flg,val,plane h Generate contour ROI for image mask(s) This creates a contour around the border of the image region with intensity VAL (each value >0 by default) Note: this is inverse of 9h cmd. FLG 1 - inside voxels have values >= VAL (default) 2 - inside voxels have values <= VAL 3 - edge is intensity drop >= VAL 4 - edge is intensity increase >= VAL 5 - edge is intensity drop >= VAL % 6 - edge is intensity increase >= VAL % VAL edge intensity value (default current Thresh value, or 1 if Thresh==0) PLANE is 0,1,2 for which image plane x,y,z to draw contours (plane=2, z, by default. 11h Sample values in a region (ROI or near cursor) 'name',11,flg,roinum,dist,thresh h FLG: 1 - sample around (most recent) cursor loc otherwise sample activeroi (if active) 2 - sample only thresholded voxels, if threshold active 4 - sample only non-zero voxels 8 - sample all contiguous (thresholded/non-zero) voxels DIST: Distance (in mm) to sample around cursor loc (0=no limit). If DIST > 0, FLG bit 1 is ignored. THRESH: Only sample voxels at or above THRESH (implies FLG 2). NAME: If input is time series, result is reference array, NAME. Single value result (or 1st val of time series) is stored in number variable $SAMPLE, regardless of NAME. 12h generate sliceRx ROI from slice Rx of prev window **See Also:**\\ [[jvs:fscan|fScan Home]], [[jvs:fscan:manual|fScan Manual]], [[jvs:fscan:manual:chapter3|KeyCmds]], [[jvs:fscan:manual:chapter3:winkeys|WinKeys]], [[jvs:fscan:manual:help|Manual Help]]