ndjsonTosvg¶

Author: Stephen Thompson
ndjsonTosvg is a utility to convert data from Google’s Quickdraw dataset to scalable vector graphics format. The input data should be in Google’s simplified ndjson format.
ndjsonTosvg is part of the SciKit-Surgery software project, developed at the Wellcome EPSRC Centre for Interventional and Surgical Sciences, part of University College London (UCL).
ndjsonTosvg supports Python 3.x.
Usage
ndjsonTosvg --filein FILEIN -n NUMBEROFSAMPLES
For more usage run
ndjsonTosvg --help
Please explore the project structure, and implement your own functionality.
Developing¶
Cloning¶
You can clone the repository using the following command:
git clone https://github.com/thompson318/ndjsonTosvg
Linting¶
This code conforms to the PEP8 standard. Pylint can be used to analyse the code:
pip install pylint
pylint --rcfile=tests/pylintrc ndjsontosvg
Installing¶
You can pip install directly from the repository as follows:
pip install git+https://github.com/thompson318/ndjsonTosvg
Contributing¶
Please see the contributing guidelines.
Useful links¶
Licensing and copyright¶
Copyright 2020 University College London. ndjsonTosvg is released under the BSD-3 license. Please see the license file for details.
Acknowledgements¶
Supported by Wellcome and EPSRC.
Requirements for ndjsonTosvg¶
This is the software requirements file for ndjsonTosvg, part of the SNAPPY project. The requirements listed below should define what ndjsonTosvg does. Each requirement can be matched to a unit test that checks whether the requirement is met.
Requirements¶
ID | Description | Test |
---|---|---|
0000 | Module has a help page | pylint, see tests/pylint.rc and tox.ini |
0001 | Functions are documented | pylint, see tests/pylint.rc and tox.ini |
0002 | Package has a version number | No test yet, handled by git. |
latest¶
ndjsontosvg package¶
Subpackages¶
Submodules¶
ndjsontosvg.ndjsontosvg module¶
converts simplified quickdraw into separate svg files
-
ndjsontosvg.ndjsontosvg.
ndjsontosvg
(filein, numberofsamples, outsize=256, linecolour='black', backgroundcolour='white', outdir='./', checkifidentified=True, randomsort=True, inputsize=256)[source]¶ converts a multiline google quickdraw simplified format file into separate svg images.
Params filein: the input json file
Params numberofsamples: how many drawings to generate
Params outsize: You can set the outsize, simplified quickdraw are designed for 256 x 256, and svg should scale easily, but for some applications that don’t scale svg well, you can set your own output size.
Params outdir: the directory to write to.
Params checkifidenified: if true we will check that recognized key is true before creating svg.
Params randomsort: If true we will select a random set of drawings, not just the first numberofsamples
Params inputsize: use this if the input ndjson is not 256x256
Raises: - ValueError – If more that 10000 samples requested.
- KeyError – If ndjson is missing expected fields.
- IOError – If output dir does not exist.
Module contents¶
ndjsonTosvg