This library is compatible with the CIFTI-2 format, withoutexternally installed dependencies (except that CIFTI-1 files requirewb_command for conversion), returning a structure that exposes theinformation contained in the CIFTI-2 XML with minimal translation, as wellas the data matrix with no added padding. The cifti_read function isthe intended starting point, ciftiopen and similar are compatibilitywrappers so that the library can be used in older code.
Additionally, the library provides numerous helper functions to make manycommon operations (such as extracting the data for one structure) into asingle line of intuitive code.
The previous code that was derived from FieldTrip is in the "ft_cifti"folder.
The cifti structure returned by this library uses 0-basedindices for vertex and voxel indices, 1-based for cifti indices, andthe helper functions return 1-based indices for everything.
All exposed functions have usage information available through the help
command:
>> help cifti_read
function outstruct = cifti_read(filename, ...)
Read a cifti file.
...
The simplest practical usage is to load a cifti file with cifti_read
, takeits data from the .cdata
field, modify it, store it back into the .cdata
field,and write it back out to a new file with cifti_write
:
mycifti = cifti_read('something.dscalar.nii');
mycifti.cdata = sqrt(mycifti.cdata);
cifti_write(mycifti, 'sqrt.dscalar.nii');
The ciftiopen
, ciftisave
, and ciftisavereset
functions provide backwardcompatibility with a previous cifti library (option II ofHCP FAQ 2),and you can also use this ciftisavereset
function even if you use cifti_read
.An alternative way to do the equivalent of ciftisavereset
is to use thecifti_write_from_template
helper function (which also has options to setthe names of the maps for dscalar, and similar for other cifti file types):
mycifti = cifti_read('something.dscalar.nii');
cifti_write_from_template(mycifti, mycifti.cdata(:, 1), 'firstmap.dscalar.nii', 'namelist', {'map #1'});
%ciftisavereset equivalent (keeping 'mycifti' unmodified):
mycifti = cifti_read('something.dscalar.nii');
newcifti = mycifti;
newcifti.cdata = mycifti.cdata(:, 1);
ciftisavereset(newcifti, 'firstmap.dscalar.nii');
clear newcifti;
The cifti_struct_create_from_template
function can create a cifti struct without writingit to a file, with the same options as cifti_write_from_template
to control the otherdiminfo. The cifti_write...
or cifti_struct...
functions should handle most cases ofworking with common cifti files, including extracting the data for one cortical surface,doing some computation on it, and replacing the surface data with the new values:
mycifti = cifti_read('something.dscalar.nii');
leftdata = cifti_struct_dense_extract_surface_data(mycifti, 'CORTEX_LEFT');
newleftdata = 1 - leftdata;
newcifti = cifti_struct_dense_replace_surface_data(mycifti, newleftdata, 'CORTEX_LEFT');
...
The dense
part of some function names refers to only being applicable to "dense" filesor diminfo (in cifti xml terms, a "brain models" mapping), such as dtseries, dscalar,dlabel, or dconn. There are more dense
helpers mainly because there is a more commonneed to make use of the information in a dense diminfo than most other diminfo types.
The cifti_diminfo_*
helpers are lower-level and require more understanding of thedetails of the cifti format, and often require writing more code to use them, so youshould generally look at the cifti_write...
and cifti_struct...
functions first.
outstruct = cifti_read(filename, ...)
cifti_write(cifti, filename, ...)
cifti = ciftiopen(filename, ...) %note: these 3 do not use option pairs,
ciftisave(cifti, filename, ...) % the varargin here is to make passing 'wb_command' optional
ciftisavereset(cifti, filename, ...)
cifti = cifti_struct_create_from_template(ciftitemplate, data, type, ...)
cifti_write_from_template(ciftitemplate, data, filename, ...)
cifti = cifti_struct_create_sdseries(data, ...)
cifti_write_sdseries(data, filename, ...)
[outdata, outroi] = cifti_struct_dense_extract_surface_data(cifti, structure[, dimension])
cifti = cifti_struct_dense_replace_surface_data(cifti, data, structure[, dimension])
[outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_all_data(cifti[, cropped, dimension])
cifti = cifti_struct_dense_replace_volume_all_data(cifti, data[, cropped, dimension])
[outdata, outsform1, outroi] = cifti_struct_dense_extract_volume_structure_data(cifti, structure[, cropped, dimension])
cifti = cifti_struct_dense_replace_volume_structure_data(cifti, data, structure[, cropped, dimension])
[surflist, vollist] = cifti_diminfo_dense_get_structures(diminfo) %returns the names of structures that exist in this diminfo
outstring = cifti_metadata_get(metadata, key) %returns empty string for nonexistent key
metadata = cifti_metadata_remove(metadata, key) %returns unmodified metadata struct for nonexistent key
metadata = cifti_metadata_set(metadata, key, value) %overwrites key if it exists
outinfo = cifti_diminfo_dense_get_surface_info(diminfo, structure)
outinfo = cifti_diminfo_dense_get_volume_all_info(diminfo[, cropped])
outinfo = cifti_diminfo_dense_get_volume_structure_info(diminfo, structure[, cropped])
outmap = cifti_diminfo_make_scalars(nummaps[, namelist, metadatalist])
outmap = cifti_diminfo_make_series(nummaps[, start, step, unit])
indices = cifti_vox2ind(dims, voxlist1) %helper to act like sub2ind for voxel ijk lists
压缩包 : af17b1d8d9ab536f5051cef48e6da642.zip 列表 cifti-matlab-master/ cifti-matlab-master/@gifti/ cifti-matlab-master/@gifti/Contents.m cifti-matlab-master/@gifti/display.m cifti-matlab-master/@gifti/exp
问题内容: 我有一个让我发疯的问题。Matlab仅看到我的某些类嵌入到JAR文件中 如果我在包外部编译类,并使用javaaddpath在Matlab中添加类的路径,则不会遇到任何问题 当我在一个包中编译该类,然后尝试在Matlab下访问它们时,出现了问题。下面是一些Matlab代码 现在,在包装中,所有类都是公共的。这是由于 及以下 我在OSX上运行Matlab。我已经尝试过使用Matlab 7.
问题内容: 现在,MATLAB 2012a中的mex仅正式支持gcc 4.4.6,但我要自担风险使用gcc 4.7。现在,如果我直接用mex编译东西,它将抱怨 通过我确认它具有该版本字符串。我审查和修改变量,并在该脚本,但它不工作。因此,如果我不使用符号链接,那么在哪里可以配置mex使用的路径?谢谢。 问题答案: 您需要创建一个指向gcc 4.7库的符号链接,以便matlab知道要使用它。就像是:
问题内容: 我正在用Java开发一个库,需要在Matlab中使用它。Java和Matlab代码都在不断开发中。因此,每当我重建Java代码并创建一个新的jar文件时,都需要将其重新加载到Matlab代码中并在其中使用新的jar文件。我的问题是Matlab锁定了jar文件,除非重新启动整个Matlab环境,否则无法用新的jar文件替换旧的jar文件。如何使Matlab解锁我的jar文件? 我通过访问
问题内容: 我有一个处理图像的Matlab代码。我想创建一个使用该代码的Hadoop映射器。我遇到了以下解决方案,但不确定哪种解决方案最好(对我而言,很难在hadoop中的每个从属节点上安装matlab编译器运行时): 手动将Matlab代码转换为C ++中的OpenCV,然后从映射器中调用其exe / dll(并为其提供适当的参数)。不确定,因为群集在每个节点上都安装了Linux,而不是Wind
问题内容: 我是Rails和Web开发的新手。 我正在Matlab中生成一堆对象,我想将这些对象发送到我的Rails应用程序中的数据库中。谁能建议我该怎么做? 到目前为止,在Rails端,我已经为数据生成了基本的支架。我可以使用“ / myobjects / new”中的表单将对象添加到数据库中。 在Matlab端,我一直在尝试使用HTTP POST请求添加对象,如下所示: 这将失败,并将以下内容
问题内容: 我需要在Matlab中运行Java .jar文件。 我们将文件称为MyJar.jar,如果有帮助,我正在运行Java 1.8.0_121-b13。 我尝试了不同的解决方案,并收到了这些相应的错误 我已经设置了javaclasspath:C:\ My \ Java \ Class \ Path \ To \ MyJar.jar(即使它没有任何帮助) 我什至已经准备好编辑classpath