使用SPM_batch进行批量跑脚本(matlab.m)

2024-02-05 08:04

本文主要是介绍使用SPM_batch进行批量跑脚本(matlab.m),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

软件:spm8+matlab2023b+win11
数据格式:
F:\ASL\HC\CBF\HC_caishaoqing\CBF.nii
F:\ASL\HC\CBF\HC_caishaoqing\T1.nii

F:\ASL\HC\CBF\HC_wangdonga\CBF.nii
F:\ASL\HC\CBF\HC_wangdonga\T1.nii

clear
spmdir='D:\AnalysisApps\spm8';
datadir='F:\ASL\HC\CBF';
cd(datadir);
allsubs=dir('HC*');for i=1:numel(allsubs)cursub=allsubs(i).name;matlabbatch{1}.spm.spatial.normalise.estwrite.subj.source = {fullfile(datadir,cursub,'CBF.nii')};matlabbatch{1}.spm.spatial.normalise.estwrite.subj.wtsrc = '';matlabbatch{1}.spm.spatial.normalise.estwrite.subj.resample = {fullfile(datadir,cursub,'CBF.nii')};matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.template = {'D:\AnalysisApps\spm8\templates\PET.nii,1'};matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.weight = '';matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.smosrc = 8;matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.smoref = 0;matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.regtype = 'mni';matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.cutoff = 25;matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.nits = 16;matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.reg = 1;matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.preserve = 0;matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.bb = [-78 -112 -5078 76 85];matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.vox = [2 2 2];matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.interp = 1;matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.wrap = [0 0 0];matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.prefix = 'w';spm_jobman('run',matlabbatch)
end

后面的脚本来自spm-view-show.m code
在这里插入图片描述
下面这里是show.m产生的原始脚本。可以看出我们只是把绿色部分用循环语句替换了。

matlabbatch{1}.spm.spatial.normalise.estwrite.subj.source = {'F:\ASL\HC\CBF\HC_caishaoqing\CBF.nii,1'};
matlabbatch{1}.spm.spatial.normalise.estwrite.subj.wtsrc = '';
matlabbatch{1}.spm.spatial.normalise.estwrite.subj.resample = {'F:\ASL\HC\CBF\HC_caishaoqing\CBF.nii,1'};
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.template = {'D:\AnalysisApps\spm8\templates\PET.nii,1'};
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.weight = '';
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.smosrc = 8;
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.smoref = 0;
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.regtype = 'mni';
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.cutoff = 25;
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.nits = 16;
matlabbatch{1}.spm.spatial.normalise.estwrite.eoptions.reg = 1;
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.preserve = 0;
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.bb = [-78 -112 -5078 76 85];
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.vox = [2 2 2];
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.interp = 1;
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.wrap = [0 0 0];
matlabbatch{1}.spm.spatial.normalise.estwrite.roptions.prefix = 'w';

在这里插入图片描述

这篇关于使用SPM_batch进行批量跑脚本(matlab.m)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/680257

相关文章

从零教你安装pytorch并在pycharm中使用

《从零教你安装pytorch并在pycharm中使用》本文详细介绍了如何使用Anaconda包管理工具创建虚拟环境,并安装CUDA加速平台和PyTorch库,同时在PyCharm中配置和使用PyTor... 目录背景介绍安装Anaconda安装CUDA安装pytorch报错解决——fbgemm.dll连接p

Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)

《Vue项目的甘特图组件之dhtmlx-gantt使用教程和实现效果展示(推荐)》文章介绍了如何使用dhtmlx-gantt组件来实现公司的甘特图需求,并提供了一个简单的Vue组件示例,文章还分享了一... 目录一、首先 npm 安装插件二、创建一个vue组件三、业务页面内 引用自定义组件:四、dhtmlx

使用Python创建一个能够筛选文件的PDF合并工具

《使用Python创建一个能够筛选文件的PDF合并工具》这篇文章主要为大家详细介绍了如何使用Python创建一个能够筛选文件的PDF合并工具,文中的示例代码讲解详细,感兴趣的小伙伴可以了解下... 目录背景主要功能全部代码代码解析1. 初始化 wx.Frame 窗口2. 创建工具栏3. 创建布局和界面控件4

一文详解如何在Python中使用Requests库

《一文详解如何在Python中使用Requests库》:本文主要介绍如何在Python中使用Requests库的相关资料,Requests库是Python中常用的第三方库,用于简化HTTP请求的发... 目录前言1. 安装Requests库2. 发起GET请求3. 发送带有查询参数的GET请求4. 发起PO

Python进行PDF文件拆分的示例详解

《Python进行PDF文件拆分的示例详解》在日常生活中,我们常常会遇到大型的PDF文件,难以发送,将PDF拆分成多个小文件是一个实用的解决方案,下面我们就来看看如何使用Python实现PDF文件拆分... 目录使用工具将PDF按页数拆分将PDF的每一页拆分为单独的文件将PDF按指定页数拆分根据页码范围拆分

Java中的Cursor使用详解

《Java中的Cursor使用详解》本文介绍了Java中的Cursor接口及其在大数据集处理中的优势,包括逐行读取、分页处理、流控制、动态改变查询、并发控制和减少网络流量等,感兴趣的朋友一起看看吧... 最近看代码,有一段代码涉及到Cursor,感觉写法挺有意思的。注意是Cursor,而不是Consumer

Vue ElementUI中Upload组件批量上传的实现代码

《VueElementUI中Upload组件批量上传的实现代码》ElementUI中Upload组件批量上传通过获取upload组件的DOM、文件、上传地址和数据,封装uploadFiles方法,使... ElementUI中Upload组件如何批量上传首先就是upload组件 <el-upl

Node.js net模块的使用示例

《Node.jsnet模块的使用示例》本文主要介绍了Node.jsnet模块的使用示例,net模块支持TCP通信,处理TCP连接和数据传输,具有一定的参考价值,感兴趣的可以了解一下... 目录简介引入 net 模块核心概念TCP (传输控制协议)Socket服务器TCP 服务器创建基本服务器服务器配置选项服

Python3脚本实现Excel与TXT的智能转换

《Python3脚本实现Excel与TXT的智能转换》在数据处理的日常工作中,我们经常需要将Excel中的结构化数据转换为其他格式,本文将使用Python3实现Excel与TXT的智能转换,需要的可以... 目录场景应用:为什么需要这种转换技术解析:代码实现详解核心代码展示改进点说明实战演练:从Excel到

如何使用CSS3实现波浪式图片墙

《如何使用CSS3实现波浪式图片墙》:本文主要介绍了如何使用CSS3的transform属性和动画技巧实现波浪式图片墙,通过设置图片的垂直偏移量,并使用动画使其周期性地改变位置,可以创建出动态且具有波浪效果的图片墙,同时,还强调了响应式设计的重要性,以确保图片墙在不同设备上都能良好显示,详细内容请阅读本文,希望能对你有所帮助...