Rank: 201993 based on 0 downloads (last 30 days) and 0 file submitted
photo

Mark

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by Mark View all
Updated File Comments Rating
30 May 2012 JSONlab: a toolbox to encode/decode JSON files in MATLAB/Octave JSONlab is an open-source JSON/UBJSON encoder and decoder (parser) for MATLAB and Octave. Author: Qianqian Fang

I should have been clearer with my first question: What I would like is for savejson to keep cell arrays of strings as cell arrays (i.e., to keep the single brackets around them). That is, I would like
O.test = {'x'};
s = savejson('',O)
to output:
s = '{"test":["x"]}'

You said, "both loadjson and savejson were designed to eliminate a JSON array that has a single element by default." - what was your reason for making this choice? And is there some way I can hack around in the code to get the behavior I want out of it without having 289 other things go wrong?

Also: I found that if I comment out the try-catch-end block you mentioned in your response to Nancy (loadjson.m lines 247-253), I can ensure that bracketed json objects (even with only one element: '["x"]') are interpreted as cell arrays ({'x'}) (which I want). Is making that change going to get me in trouble elsewhere in the code?

As to the underscores - well, I was thinking about a unique prefix you could use (or post-fix? two trailing underscores is legal (and uncommon) in matlab...?) But I can work around this myself if you'd rather not change both functions. Thanks!

30 May 2012 JSONlab: a toolbox to encode/decode JSON files in MATLAB/Octave JSONlab is an open-source JSON/UBJSON encoder and decoder (parser) for MATLAB and Octave. Author: Qianqian Fang

Hi Qianqian,

Thanks for the excellent code!

Can you please clarify your answer to Nancy's question above? When you wrote,

For savejson, there is a flag "NoRowBracket" controls if you want to force a [] around a single numerical element. By default, [] is not printed. Although this was not implemented for string arrays, a similar behavior is probably preferred to be consistent.

...did you mean that you intend to implement NoRowBracket functionality for arrays of strings? (And if so, might I add some encouragement for you to do so?)

Also, though I understand the complexity of achieving full round-trip invariance with loadjson and savejson, I wonder if you could be convinced to make one special case of round-trip invariance:

Leading "_" characters are commonly used in python variables, and are necessary for "_id" and "_rev" field names if you are working with json objects in couchdb. Is there any chance you could ensure that savejson un-did the string substitutions made to leading underscores in loadjson?

02 May 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen

Thanks, that's exactly what I wanted to know!

30 Apr 2012 Tools for NIfTI and ANALYZE image Load, save, make, reslice, view (and edit) both NIfTI and ANALYZE data on any platform Author: Jimmy Shen

Hello,

Is it possible to use reslice_nii to apply a transform to a nifti volume? for example, if I have a transformation matrix that is the result of a 3D coregistration of a functional with an anatomical volume, could I use reslice_nii to apply that transformation matrix to the functional volume to transform it into anatomical space? If so, any chance of some example code?

Thanks very much for the useful code.

Contact us