From a710ab323d9d8eeeeb22257a23821e41b3aad292 Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Tue, 7 Nov 2023 22:07:07 -0500 Subject: [PATCH] allow converting integer cfg.vol to json --- utils/mcx2json.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/mcx2json.m b/utils/mcx2json.m index 631bca7d..b11a9e06 100644 --- a/utils/mcx2json.m +++ b/utils/mcx2json.m @@ -95,7 +95,13 @@ function mcx2json(cfg,filestub) cfg.vol=single(cfg.vol); end if(all(mod(cfg.vol(:),1) == 0)) - Domain.MediaFormat='integer'; + if(max(cfg.vol(:))<256) + Domain.MediaFormat='byte'; + cfg.vol=uint8(cfg.vol); + else + Domain.MediaFormat='integer'; + cfg.vol=uint32(cfg.vol); + end elseif(ndims(cfg.vol)==4) if(size(cfg.vol,1))==1 Domain.MediaFormat='mua_float';