The2DShapeStructureDataset.jl

The2DShapeStructureDatasetModule

The2DShapeStructureDataset.jl

Static Badge

This is a convenience package for working with The 2D Shape Structure Dataset. The dataset has the following copyright notice

Copyright (c) [2016] [A. Carlier, K. Leonard, S. Hahmann, G. Morin, M. Collins]

and is licensed under an MIT-License.

The whole dataset is 1.8 MB large (zipped) and is only downloaded once when you use this package.

Quickstart

Install this package from the General Registry:

julia> ]
pkg> add The2DShapeStructureDataset

and make it available:

julia> using The2DShapeStructureDataset

You can then obtain the coordinates for, say, the structure apple-1:

julia> shape_coords("apple-1")
2×112 HybridArrays.HybridMatrix{2, StaticArraysCore.Dynamic(), Float64, 2, Matrix{Float64}} with indices SOneTo(2)×Base.OneTo(112):
 0.0      0.0      0.0047847  0.0047847  0.014354  0.019139  0.028708  0.043062  …  0.038278  0.028708  0.019139  0.0095694  0.0047847  0.0      0.0      0.0
 0.41627  0.44498  0.47368    0.50239    0.5311    0.55981   0.58852   0.61722      0.23923   0.26794   0.29665   0.32536    0.35407    0.38278  0.41148  0.41627

Find out what shapes are available by calling shape_names or visiting the visual explorer.

source

Docstrings

The2DShapeStructureDataset.shape_coordsMethod
shape_coords(name)

Returns a 2 ⨯ n HybridMatrix with all coordinates of the shape with the given name. Use shape_names to find all possible inputs for this function.

julia> shape_coords("Bone-1")
2×106 HybridArrays.HybridMatrix{2, StaticArraysCore.Dynamic(), Float64, 2, Matrix{Float64}} with indices SOneTo(2)×Base.OneTo(106):
 0.34174  0.3578   0.37615  0.3922   0.40826  0.42431  0.44037  0.45642  0.47248  …  0.22477  0.24083  0.25688  0.27294  0.28899  0.30505  0.32339  0.33945  0.34174
 0.5      0.52523  0.55046  0.57569  0.60092  0.62615  0.65138  0.67661  0.70183     0.31651  0.34174  0.36697  0.3922   0.41743  0.44266  0.46789  0.49312  0.5
source
The2DShapeStructureDataset.shape_ringMethod
shape_ring(name)

Returns the same coordinates as shape_coords but as a Ring from Meshes.jl.

julia> shape_ring("Bone-1")
Ring
├─ Point(x: 0.34174 m, y: 0.5 m)
├─ Point(x: 0.3578 m, y: 0.52523 m)
├─ Point(x: 0.37615 m, y: 0.55046 m)
├─ Point(x: 0.3922 m, y: 0.57569 m)
├─ Point(x: 0.40826 m, y: 0.60092 m)
⋮
├─ Point(x: 0.28899 m, y: 0.41743 m)
├─ Point(x: 0.30505 m, y: 0.44266 m)
├─ Point(x: 0.32339 m, y: 0.46789 m)
├─ Point(x: 0.33945 m, y: 0.49312 m)
└─ Point(x: 0.34174 m, y: 0.5 m)
source
The2DShapeStructureDataset.shape_sample_outlineMethod
shape_sample_outline(name, n)

Returns a 2 ⨯ n HybridMatrix of n points homogeneously sampled from the outline of the shape with the given name.

julia> shape_sample_outline("Bone-1", 10)
2×10 HybridArrays.HybridMatrix{2, StaticArraysCore.Dynamic(), Float64, 2, Matrix{Float64}} with indices SOneTo(2)×Base.OneTo(10):
 0.652387  0.476934  0.220565  0.358224  0.0707124  0.224358  0.446889  0.435535  0.538483  0.786873
 0.765361  0.708831  0.167959  0.369937  0.100747   0.144465  0.661627  0.643784  0.812571  0.894025
source
The2DShapeStructureDataset.shape_sample_innerMethod
shape_sample_inner(name, n)

Returns a 2 ⨯ n HybridMatrix of n points homogeneously sampled from the interior of the shape with the given name.

julia> shape_sample_inner("Bone-1", 10)
2×10 HybridArrays.HybridMatrix{2, StaticArraysCore.Dynamic(), Float64, 2, Matrix{Float64}} with indices SOneTo(2)×Base.OneTo(10):
 0.0915315  0.125075   0.751956  0.580064  0.780953  0.0356033  0.143631  0.0505262  0.337685  0.597154
 0.177619   0.0742084  0.907282  0.955151  0.828131  0.141015   0.138244  0.150312   0.466503  0.809213
source