From 08da9f9cf72ce42b2b9bfe0fd6fbccf84b93a099 Mon Sep 17 00:00:00 2001 From: Qianqian Fang Date: Wed, 15 Apr 2015 13:39:25 -0400 Subject: [PATCH] allow JSON input to have only one detector --- mmc/trunk/src/mcx_utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mmc/trunk/src/mcx_utils.c b/mmc/trunk/src/mcx_utils.c index 50a8532b..bc6d8797 100644 --- a/mmc/trunk/src/mcx_utils.c +++ b/mmc/trunk/src/mcx_utils.c @@ -277,7 +277,10 @@ int mcx_loadjson(cJSON *root, mcconfig *cfg){ } dets=FIND_JSON_OBJ("Detector","Optode.Detector",Optode); if(dets){ - cJSON *det=dets->child; + cJSON *det=dets; + if(!FIND_JSON_OBJ("Pos","Optode.Detector.Pos",dets)) + det=dets->child; + if(det){ cfg->detnum=cJSON_GetArraySize(dets); cfg->detpos=(float4*)malloc(sizeof(float4)*cfg->detnum);