Skip to content

Commit

Permalink
Merge branch 'master' of github.com:fangq/mcx
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Dec 29, 2023
2 parents 1e3b031 + 1100e36 commit 894ed6e
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 3 deletions.
1 change: 1 addition & 0 deletions example/muamus/run_muamus.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
..\..\bin\mcx.exe -f test_muamus_float.json -D P %*
2 changes: 2 additions & 0 deletions example/muamus/run_muamus.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
../../bin/mcx -f test_muamus_float.json -D P $@
45 changes: 45 additions & 0 deletions example/muamus/test_muamus_float.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"Session":{
"ID":"test_muamus_float",
"DoAutoThread":1,
"Photons":1000000
},
"Forward":{
"T0":0,
"T1":5e-09,
"Dt":5e-09
},
"Optode":{
"Source":{
"Pos":[30,30,1],
"Dir":[0,0,1]
}
},
"Domain":{
"OriginType":0,
"Media":[
{
"mua":0,
"mus":0,
"g":1,
"n":1
},
{
"mua":0.005,
"mus":1,
"g":0,
"n":1.37
}
],
"MediaFormat":"muamus_float",
"Dim":[60,40,20],
"VolumeFile":""
},
"Shapes":{
"_ArrayType_":"single",
"_ArraySize_":[60,40,20,2],
"_ArrayZipType_":"zlib",
"_ArrayZipSize_":[1,96000],
"_ArrayZipData_":"eAHtxV1rlnUcAOD13nCWS7OYONmKFmzlFhmrPf97OZrSignTiphglEaRyTxYtWBzOiw1aTWJXC6YGcYIO7CHiRgF2Vg0q1Fu1sGQCmEtxKRw1SD8Hj+uo+vwga/qCgq66w+TJEmSJEmSJEkG8aG7bs31HtlFkiRJkiRJkiQZxnxRc6609W2SJEmSJEmSJMkwLry0PffJ9e+RJEmSJEmSJEmGcezcQC4Nf0CSJEmSJEmSJBnGnoljuVPPfEySJEmSJEmSJBnG3MgPudbiPEmSJEmSJEmSZBj/zp/PzXz+GUmSJE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qVmSN42+RJEmSJEmSJEmG8ar+2mxoro8kSZIkSZIkSTKM/12qy+ZXvEOSJEmSJEmSJBnGi+vqs60t75IkSZIkSZIkSYZx+mhDNtHZT5IkSZIkSZIkGcazC1ZltUMHSJIkSZIkSZIkwzi55eFs4PT7JEmSJEmSJEmSYfz21KNZQcEgSZIkSZIkSZJkGC8DdffaiA=="
}
}
9 changes: 6 additions & 3 deletions src/mcx_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2163,14 +2163,15 @@ int mcx_loadjson(cJSON* root, Config* cfg) {

val = FIND_JSON_OBJ("MediaFormat", "Domain.MediaFormat", Domain);

if (val) {
if (!flagset['K'] && val) {
cfg->mediabyte = mcx_keylookup((char*)FIND_JSON_KEY("MediaFormat", "Domain.MediaFormat", Domain, "byte", valuestring), mediaformat);

if (cfg->mediabyte == -1) {
MCX_ERROR(-1, "Unsupported media format.");
}

cfg->mediabyte = mediaformatid[cfg->mediabyte];
flagset['K'] = 1;
}

if (!flagset['u']) {
Expand Down Expand Up @@ -2859,9 +2860,11 @@ int mcx_loadjson(cJSON* root, Config* cfg) {

if (FIND_JSON_OBJ("_ArrayZipData_", "Volume._ArrayZipData_", Shapes)) {
int ndim;
uint dims[4] = {1, 1, 1, 1};
char* type = NULL, *buf = NULL;

if (mcx_jdatadecode((void**)&buf, &ndim, &(cfg->dim.x), 3, &type, Shapes, cfg) == 0) {
if (mcx_jdatadecode((void**)&buf, &ndim, dims, 4, &type, Shapes, cfg) == 0) {
memcpy(&(cfg->dim.x), dims, sizeof(uint) * 3);
mcx_loadvolume(buf, cfg, 1);
}

Expand Down Expand Up @@ -4080,7 +4083,7 @@ int mcx_jdatadecode(void** vol, int* ndim, uint* dims, int maxdim, char** type,
vdata = cJSON_GetObjectItem(obj, "_ArrayZipData_");
}

if (vtype) {
if (!flagset['K'] && vtype) {
*type = vtype->valuestring;

if (strstr(*type, "int8")) {
Expand Down
3 changes: 3 additions & 0 deletions utils/mcx2json.m
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ function mcx2json(cfg,filestub)
else
Domain.VolumeFile='';
Shapes=cfg.vol;
if(ndims(Shapes)==4 && size(Shapes,1)>1)
Shapes=permute(Shapes, [2 3 4 1]);
end
end
end

Expand Down

0 comments on commit 894ed6e

Please sign in to comment.