The2DShapeStructureDataset.jl
The2DShapeStructureDataset — ModuleThe2DShapeStructureDataset.jl
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 The2DShapeStructureDatasetand make it available:
julia> using The2DShapeStructureDatasetYou can then obtain the coordinates for, say, the structure apple-1:
julia> shape_coords("apple-1")
2×112 Matrix{Float64}:
0.0 0.0 0.0047847 … 0.0 0.0 0.0
0.41627 0.44498 0.47368 0.38278 0.41148 0.41627Find out what shapes are available by calling shape_names or visiting the visual explorer.
Docstrings
The2DShapeStructureDataset.shape_names — Methodshape_names()Returns a vector of names of all shapes in the dataset.
julia> shape_names()
1256-element Vector{SubString{String}}:
"Bone-1"
"Bone-10"
"Bone-11"
[...]The2DShapeStructureDataset.shape_coords — Methodshape_coords(name)Returns a 2 ⨯ n Matrix 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 Matrix{Float64}:
0.34174 0.3578 0.37615 … 0.32339 0.33945 0.34174
0.5 0.52523 0.55046 0.46789 0.49312 0.5The2DShapeStructureDataset.shape_ring — Functionshape_ring(name)Requires the Meshes.jl package being loaded.
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)The2DShapeStructureDataset.shape_area — Functionshape_area(name)Requires the Meshes.jl package being loaded.
Returns the same coordinates as shape_coords but as a PolyArea from Meshes.jl.
julia> shape_area("Bone-1")
PolyArea
outer
└─ Ring((x: 0.34174 m, y: 0.5 m), ..., (x: 0.34174 m, y: 0.5 m))The2DShapeStructureDataset.shape_sample_outline — Functionshape_sample_outline(name, n)Requires the Meshes.jl package being loaded.
Returns a 2 ⨯ n Matrix of n points homogeneously sampled from the outline of the shape with the given name.
julia> shape_sample_outline("Bone-1", 10)
2×10 Matrix{Float64}:
0.213944 0.0874572 0.695606 … 0.778814 0.681997
0.0313239 0.0992228 0.753576 0.906329 0.955572The2DShapeStructureDataset.shape_sample_inner — Functionshape_sample_inner(name, n)Requires the Meshes.jl package being loaded.
Returns a 2 ⨯ n Matrix of n points homogeneously sampled from the interior of the shape with the given name.
julia> shape_sample_inner("Bone-1", 10)
2×10 Matrix{Float64}:
0.0754321 0.727358 0.19444 … 0.645929 0.323449 0.638125
0.241538 0.747493 0.188188 0.778322 0.370565 0.79197