-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7f04ca
commit 9d94db1
Showing
4 changed files
with
55 additions
and
23 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
function ma2nii | ||
% convert model with Radial basis function kernels from matlab to NIfTI | ||
% we could use JSON, but we want to retain precision | ||
|
||
|
||
models = load('models_5x10_diff.mat').models; | ||
% | ||
v = 1; | ||
nii(v) = numel(models); | ||
v = v + 1; | ||
for i = 1:numel(models) | ||
nii(v) = size(models{i}.SVs,1); | ||
v = v + 1; | ||
nii(v) = size(models{i}.SVs,2); | ||
v = v + 1; | ||
nii(v) = - models{i}.rho; % bias_i | ||
v = v + 1; | ||
nii(v) = models{i}.Parameters(4); % gamma_i | ||
v = v + 1; | ||
for j = 1:numel(models{i}.SVs) | ||
nii(v) = models{i}.SVs(j); % support_vectors_i | ||
v = v + 1; | ||
end | ||
if (size(models{i}.SVs,1) ~= numel(models{i}.sv_coef)) | ||
error('unexpected numel sv_coef'); | ||
end | ||
for j = 1:numel(models{i}.sv_coef) | ||
nii(v) = models{i}.sv_coef(j); % coefficients_i | ||
v = v + 1; | ||
end | ||
end | ||
niftiwrite(nii,'models_5x10_diff.nii') |
Binary file not shown.