ndjsonTosvg

Logo GitHub Actions CI status Test coverage Documentation Status

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

Running tests

Pytest is used for running unit tests:

pip install pytest
python -m pytest

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.

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
ndjsontosvg.ui package
Submodules
ndjsontosvg.ui.ndjsontosvg_command_line module

Command line ui for ndjsontosvg

ndjsontosvg.ui.ndjsontosvg_command_line.main(args=None)[source]

Entry point for ndjsonTosvg application

Module contents

ndjsonTosvg

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