Skip to content

Commit 7b0e2c7

Browse files
author
Jennings Zhang
committed
Add docs, examples, tests
1 parent 077bd08 commit 7b0e2c7

File tree

10 files changed

+491634
-91
lines changed

10 files changed

+491634
-91
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,38 @@ on:
1515
- "v?[0-9]+.[0-9]+.[0-9]+*"
1616

1717
jobs:
18+
test:
19+
name: Test
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- uses: actions/checkout@v3
23+
- uses: docker/setup-buildx-action@v2
24+
- name: Cache Docker layers
25+
uses: actions/cache@v3
26+
with:
27+
path: /tmp/.buildx-cache
28+
key: ${{ runner.os }}-buildx-${{ github.sha }}
29+
restore-keys: |
30+
${{ runner.os }}-buildx-
31+
- name: Build
32+
uses: docker/build-push-action@v3
33+
with:
34+
build-args: extras_require=dev
35+
context: .
36+
load: true
37+
push: false
38+
tags: "localhost/fnndsc/pl-adapt_object_mesh:dev"
39+
cache-from: type=local,src=/tmp/.buildx-cache
40+
cache-to: type=local,dest=/tmp/.buildx-cache
41+
- name: Run pytest
42+
run: |
43+
docker run -v "$GITHUB_WORKSPACE:/app:ro" -w /app localhost/fnndsc/pl-adapt_object_mesh:dev \
44+
pytest -o cache_dir=/tmp/pytest
45+
1846
build:
1947
name: Build
2048
runs-on: ubuntu-22.04
49+
needs: [ test ]
2150

2251
# A local registry helps us reuse the built image between steps
2352
services:

README.md

Lines changed: 14 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -4,106 +4,36 @@
44
[![MIT License](https://img.shields.io/github/license/fnndsc/pl-adapt_object_mesh)](https://github.com/FNNDSC/pl-adapt_object_mesh/blob/main/LICENSE)
55
[![ci](https://github.com/FNNDSC/pl-adapt_object_mesh/actions/workflows/ci.yml/badge.svg)](https://github.com/FNNDSC/pl-adapt_object_mesh/actions/workflows/ci.yml)
66

7-
`pl-adapt_object_mesh` is a [_ChRIS_](https://chrisproject.org/)
8-
_ds_ plugin which takes in ... as input files and
9-
creates ... as output files.
10-
11-
## Abstract
7+
![before and after](examples/before_and_after.png)
128

13-
...
9+
`pl-adapt_object_mesh` is a [_ChRIS_](https://chrisproject.org/)
10+
_ds_ plugin wrapper for
11+
[`adapt_object_mesh`](https://github.com/aces/surface-extraction/blob/clasp_3-0-3/src/adapt_object_mesh.c),
12+
a polygonal mesh smoothing program from [CIVET](http://mcin.ca/technology/civet/).
13+
It implements
14+
It runs `adapt_object_mesh` on every `.obj` file in its input directory,
15+
writing outputs to an output directory, and printing logs to log files
16+
which are created next to the output surfaces.
1417

1518
## Installation
1619

1720
`pl-adapt_object_mesh` is a _[ChRIS](https://chrisproject.org/) plugin_, meaning it can
1821
run from either within _ChRIS_ or the command-line.
1922

20-
[![Get it from chrisstore.co](https://ipfs.babymri.org/ipfs/QmaQM9dUAYFjLVn3PpNTrpbKVavvSTxNLE5BocRCW1UoXG/light.png)](https://chrisstore.co/plugin/pl-adapt_object_mesh)
23+
[![Get it from chrisstore.co](https://raw.githubusercontent.com/FNNDSC/ChRIS_store_ui/963938c241636e4c3dc4753ee1327f56cb82d8b5/src/assets/public/badges/light.svg)](https://chrisstore.co/plugin/pl-adapt_object_mesh)
2124

2225
## Local Usage
2326

2427
To get started with local command-line usage, use [Apptainer](https://apptainer.org/)
25-
(a.k.a. Singularity) to run `pl-adapt_object_mesh` as a container:
26-
27-
```shell
28-
singularity exec docker://fnndsc/pl-adapt_object_mesh adapt_object_mesh_wrapper [--args values...] input/ output/
29-
```
30-
28+
(a.k.a. Singularity) to run `pl-adapt_object_mesh` as a container.
3129
To print its available options, run:
3230

3331
```shell
34-
singularity exec docker://fnndsc/pl-adapt_object_mesh adapt_object_mesh_wrapper --help
35-
```
36-
37-
## Examples
38-
39-
`adapt_object_mesh_wrapper` requires two positional arguments: a directory containing
40-
input data, and a directory where to create output data.
41-
First, create the input directory and move input data into it.
42-
43-
```shell
44-
mkdir incoming/ outgoing/
45-
mv some.dat other.dat incoming/
46-
singularity exec docker://fnndsc/pl-adapt_object_mesh:latest adapt_object_mesh_wrapper [--args] incoming/ outgoing/
47-
```
48-
49-
## Development
50-
51-
Instructions for developers.
52-
53-
### Building
54-
55-
Build a local container image:
56-
57-
```shell
58-
docker build -t localhost/fnndsc/pl-adapt_object_mesh .
59-
```
60-
61-
### Running
62-
63-
Mount the source code `adapt_object_mesh_wrapper.py` into a container to try out changes without rebuild.
64-
65-
```shell
66-
docker run --rm -it --userns=host -u $(id -u):$(id -g) \
67-
-v $PWD/adapt_object_mesh_wrapper.py:/usr/local/lib/python3.10/site-packages/adapt_object_mesh_wrapper.py:ro \
68-
-v $PWD/in:/incoming:ro -v $PWD/out:/outgoing:rw -w /outgoing \
69-
localhost/fnndsc/pl-adapt_object_mesh adapt_object_mesh_wrapper /incoming /outgoing
70-
```
71-
72-
### Testing
73-
74-
Run unit tests using `pytest`.
75-
It's recommended to rebuild the image to ensure that sources are up-to-date.
76-
Use the option `--build-arg extras_require=dev` to install extra dependencies for testing.
77-
78-
```shell
79-
docker build -t localhost/fnndsc/pl-adapt_object_mesh:dev --build-arg extras_require=dev .
80-
docker run --rm -it localhost/fnndsc/pl-adapt_object_mesh:dev pytest
81-
```
82-
83-
## Release
84-
85-
Steps for release can be automated by [Github Actions](.github/workflows/ci.yml).
86-
This section is about how to do those steps manually.
87-
88-
### Increase Version Number
89-
90-
Increase the version number in `setup.py` and commit this file.
91-
92-
### Push Container Image
93-
94-
Build and push an image tagged by the version. For example, for version `1.2.3`:
95-
96-
```
97-
docker build -t docker.io/fnndsc/pl-adapt_object_mesh:1.2.3 .
98-
docker push docker.io/fnndsc/pl-adapt_object_mesh:1.2.3
32+
apptainer exec docker://fnndsc/pl-adapt_object_mesh adapt_object_mesh_wrapper --help
9933
```
10034

101-
### Get JSON Representation
102-
103-
Run [`chris_plugin_info`](https://github.com/FNNDSC/chris_plugin#usage)
104-
to produce a JSON description of this plugin, which can be uploaded to a _ChRIS Store_.
35+
## Example
10536

10637
```shell
107-
docker run --rm localhost/fnndsc/pl-adapt_object_mesh:dev chris_plugin_info > chris_plugin_info.json
38+
singularity exec docker://fnndsc/pl-adapt_object_mesh:latest adapt_object_mesh_wrapper --iterations 50 incoming/ outgoing/
10839
```
109-

examples/before_and_after.png

142 KB
Loading

0 commit comments

Comments
 (0)