Roast程序文件简介


Roast

roast.m

function roast(subj,recipe,varargin)

function roast(subj,recipe,varargin)

  • subj:脑区模板
  • recipe:电极配置
  • varargin:坐标系统(一般用默认的,即此处为空)

tDCS电场仿真的主函数。

reviewRes.m

function reviewRes(subj,simTag,tissue,fastRender,tarTag)

A simpler interface to visualize the simulations/targetings that are already done. Users do not have to enter all the parameters as they would have in roast() or roast_target() main function. Instead, they just need to enter the path to the input MRI and the unique simulation/targeting tag for that MRI.

roast_target.m

function roast_target(subj,simTag,targetCoord,varargin)

实现电极优化、靶区定位功能的主函数。

靶区定位功能相关论文:

Dmochowski, J.P., Datta, A., Bikson, M., Su, Y., Parra, L.C., Optimized multi-electrode stimulation increases focality and intensity at target, Journal of Neural Engineering 8 (4), 046011, 2011

Dmochowski, J.P., Datta, A., Huang, Y., Richardson, J.D., Bikson, M., Fridriksson, J., Parra, L.C., Targeted transcranial direct current stimulation for rehabilitation after stroke, NeuroImage, 75, 12-19, 2013

Huang, Y., Thomas, C., Datta, A., Parra, L.C., Optimized tDCS for Targeting Multiple Brain Regions: An Integrated Implementation. Proceedings of the 40th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Honolulu, HI, July 2018, 3545-3548

elecPreproc.m

function [para,ind2UI] = elecPreproc(subj,elec,para)

预处理电极名称,在capInfo中找到对应的电极信息。

  • subj:脑区模板
  • elec:电极名称
  • para:电极参数,包括脑电帽系统类型,电极类型,电极大小等参数

start_seg.m

function start_seg(P,T2,Template,norm)

开始运行SPM12分割函数的方法脚本。

  • P:待分割的脑区模板
  • T2:默认为空
  • Template:样版,默认为eTPM.nii
  • norm:规范化,默认不规范化数据

segTouchup.m

function segTouchup(P,T2,isSmooth,conn)

此函数对SPM12分割的输出执行自动清理,并对其余孔应用自动修补。

  • P:待分割的脑区模板
  • T2:默认为空
  • isSmooth:默认是true
  • conn:默认是18

electrodePlacement.m

function hdrInfo = electrodePlacement(P1,P2,T2,elecNeeded,options,uniTag)

将电极放置在头皮表面。options.elecPara包含每个电极的所有选项信息。

meshByIso2mesh.m

function [node,elem,face] = meshByIso2mesh(P1,P2,T2,opt,hdrInfo,uniTag)

使用iso2mesh工具箱生成体积四面体网格。

prepareForGetDP.m

function prepareForGetDP(P,node,elem,elecNeeded,uniTag)

准备getDP

GetDP是一个自由有限元求解器,使用混合元素在一维、二维和三维离散de Rham型复合物。GetDP的主要特点是定义离散问题的输入数据(由用户以ASCII数据文件编写)与这些问题的符号数学表达式之间的紧密性。

solveByGetDP.m

function solveByGetDP(P,current,sigma,indUse,uniTag,LFtag)

使用GetDP进行有限元计算。

postGetDP.m

function [vol_all,ef_mag,ef_all] = postGetDP(P1,P2,node,hdrInfo,uniTag,indSolved,indInCore)

求解模型/生成导联后的后处理。将结果以Matlab格式保存在MRI体素空间中。对于导联场,它以Matlab格式保存,以便roast_target()工作。

visualizeRes.m

function visualizeRes(P1,P2,T2,node,elem,face,inCurrent,hdrInfo,uniTag,showAll,varargin)

显示仿真结果。三维渲染显示在世界空间中,而切片视图显示在体素空间中。

optimize_prepare.m

function p = optimize_prepare(p,A,locs)

执行电极优化的预处理函数。

该函数计算目标信息和算法参数(目标处的场方向除外)。这里将对矩阵A进行奇异值分解以节省时间。

运行完此函数后,应运行优化的方法函数(optimize.m);或者如果想寻找更合适的靶区位置,应先执行optimize_anon.m, 再运行optimize.m。

  • p:prepare data。包括numOfTargets(靶区个数)、I_max、targetCoord(靶点坐标)、optType(优化方法)、elecNum、targetRadius(靶区半径)、k(一般默认)、desiredIntensity
  • A:转移系数矩阵
  • locs:坐标位置参数

optimize_anon.m

function res = optimize_anon(p,t,A)

用于搜索目标处的电场的最佳方向的目标函数。

一般选择”radial-in”径向向内方向,就不需要运行次函数了

optimize.m

function sopt = optimize(p,A)

执行电极优化的函数。

optimize_currents.m

function [x_opt,s_opt,status] = optimize_currents(A,d,S_max,w,tar_nodes,method,U,S,V,solElecNum,verbose)

具体进行电流优化的函数。

输入:

  • A:转移系数矩阵(一个3N×M矩阵,其中N为体积网格节点数,M为电极数(不包括参考电极))
  • d:需要的电场强度(向量长度为3N)
  • S_max:最大允许电流强度
  • w:权重用于加权最小二乘法,也用于索引目标区域
  • tar_nodes:目标区域的索引,为每个区域/ROI单独存储,用于计算每个ROI的平均值
  • solElecNum:需要的电极数量
  • verbose:with screen output (1, default) or without screen output (0)

输出:

  • x_opt:优化电场(3*N矢量,其中N为节点数)
  • s_opt:优化电流强度(向量M,M是电极个数)
  • status:判断优化是否成功的变量

文章作者: Mat Jenin
文章链接: http://matjenin.xyz
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 Mat Jenin !
  目录