Storing JSON structures in files

In order to quickly read and write JSON files and exchange configuration data with NxView you can use the ‘ file:// ‘ prefix with set_framegrabber_param and get_framegrabber_param:

To apply a previously saved configuration from NxView to your open camera you can simply read it from a file:

get_framegrabber_param(AcqHandle'file://C:/MyJsonFiles/Configuration.json'params)

and then apply the configuration to the camera’s parameters item:

set_framegrabber_param(AcqHandle'Parameters', ['apply'params])

Note

You must use the ‘apply’ parameter, because the Parameters subtree contains write protected nodes. Thus replacing the entire subtree will result in an error. The ‘apply’ parameter will ensure that only writable nodes will be modified, other nodes will be silently ignored.

You can save a camera’s configuration to a file in the same way by just getting it’s parameters subtree:

get_framegrabber_param(AcqHandle'Parameters'params)

and then save it to a file on your hard disk (which you can later load in NxView):

set_framegrabber_param(AcqHandle'file://C:/MyJsonFiles/Configuration.json'params)