From 654dff19bb9e1388d03c505d28123f4715717897 Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Wed, 5 Jun 2024 17:44:36 -0400 Subject: [PATCH] [bug] fix outputtype error in json2mcx, reformat with miss_hit --- mcxlab/mcxlab.m | 2 +- utils/json2mcx.m | 2 +- utils/mcxsvmc.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mcxlab/mcxlab.m b/mcxlab/mcxlab.m index cb0ac520..4685723c 100644 --- a/mcxlab/mcxlab.m +++ b/mcxlab/mcxlab.m @@ -591,7 +591,7 @@ [traj.id, idx] = sort(traj.id); traj.pos = traj.pos(idx, :); traj.srcid = int32(data(6, :)'); - if(size(data, 1) >= 10) + if (size(data, 1) >= 10) traj.iquv = data(7:10, :)'; end traj.data = [single(traj.id)'; data(2:end, idx)]; diff --git a/utils/json2mcx.m b/utils/json2mcx.m index 0f3dce5b..5aadadf7 100644 --- a/utils/json2mcx.m +++ b/utils/json2mcx.m @@ -124,7 +124,7 @@ cfg = copycfg(cfg, 'isnormalize', json.Session, 'DoNormalize'); cfg = copycfg(cfg, 'outputformat', json.Session, 'OutputFormat'); cfg = copycfg(cfg, 'outputtype', json.Session, 'OutputType'); -if (length(cfg.outputtype) == 1) +if (isfield(cfg, 'outputtype') && length(cfg.outputtype) == 1) otypemap = struct('x', 'flux', 'f', 'fluence', 'e', 'energy', 'j', 'jacobian', 'p', 'nscat', 'm', 'wm', 'r', 'rf', 'l', 'length'); if (~isfield(otypemap, cfg.outputtype)) error('output type %s is not supported', cfg.outputtype); diff --git a/utils/mcxsvmc.m b/utils/mcxsvmc.m index ae36a531..dd6cd62e 100644 --- a/utils/mcxsvmc.m +++ b/utils/mcxsvmc.m @@ -153,7 +153,7 @@ %% computing total area and normal vector for each boundary voxel areas = elemvolume(iso.vertices, iso.faces); normals = surfacenorm(iso.vertices, iso.faces); -if(isoctavemesh) +if (isoctavemesh) normals = -normals; end centroids = meshcentroid(iso.vertices, iso.faces);