-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updated to new structure * Fixed bumpbversion filename * Fixed bumpversion paths and added version to README * Bump version: 0.4.2 → 0.5.0-dev0 * Fixed JSON formatting * Removed old binary operations plugin * Added in memory function * Bump version: 0.4.2 → 0.5.0-dev1 --------- Co-authored-by: nicholas-schaub <nicholas.j.schaub@gmail.com>
- Loading branch information
1 parent
d85e223
commit 30abc61
Showing
28 changed files
with
1,555 additions
and
1,283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
transforms/images/binary-operations-plugin/.bumpversion.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[bumpversion] | ||
current_version = 0.5.0-dev1 | ||
commit = True | ||
tag = False | ||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))? | ||
serialize = | ||
{major}.{minor}.{patch}-{release}{dev} | ||
{major}.{minor}.{patch} | ||
|
||
[bumpversion:part:release] | ||
optional_value = _ | ||
first_value = dev | ||
values = | ||
dev | ||
_ | ||
|
||
[bumpversion:part:dev] | ||
|
||
[bumpversion:file:pyproject.toml] | ||
search = version = "{current_version}" | ||
replace = version = "{new_version}" | ||
|
||
[bumpversion:file:plugin.json] | ||
|
||
[bumpversion:file:VERSION] | ||
|
||
[bumpversion:file:src/polus/plugins/transforms/images/binary_operations/__init__.py] | ||
|
||
[bumpversion:file:README.md] | ||
search = v{current_version} | ||
replace = v{new_version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM polusai/bfio:2.1.9 | ||
|
||
# environment variables defined in polusai/bfio | ||
# ENV EXEC_DIR="/opt/executables" | ||
# ENV DATA_DIR="/data" | ||
# ENV POLUS_EXT=".ome.tif" | ||
# ENV POLUS_LOG="INFO" # Change to WARNING for fewer logs, and DEBUG for debugging | ||
ENV POLUS_IMG_EXT=".ome.tif" | ||
ENV POLUS_TAB_EXT=".csv" | ||
|
||
# Work directory defined in the base container | ||
# WORKDIR ${EXEC_DIR} | ||
|
||
COPY pyproject.toml ${EXEC_DIR} | ||
COPY VERSION ${EXEC_DIR} | ||
COPY README.md ${EXEC_DIR} | ||
RUN pip3 install --index-url https://test.pypi.org/simple/ filepattern==2.2.7 | ||
COPY src ${EXEC_DIR}/src | ||
|
||
RUN pip3 install ${EXEC_DIR} --no-cache-dir | ||
|
||
ENTRYPOINT ["python3", "-m", "polus.plugins.transforms.images.binary_operations"] | ||
CMD ["--help"] |
60 changes: 30 additions & 30 deletions
60
.../polus-binary-operations-plugin/README.md → ...images/binary-operations-plugin/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.5.0-dev1 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
{ | ||
"name": "Binary Operations Plugin", | ||
"version": "0.5.0-dev1", | ||
"containerId": "polusai/binary-operations-plugin:0.5.0-dev1", | ||
"title": "Binary Operations Plugin", | ||
"description": "Everything you need to start a WIPP plugin.", | ||
"authors": "nicholas-schaub (nick.schaub@nih.gov), Madhuri Vihani", | ||
"institution": "National Center for Advancing Translational Sciences, National Institutes of Health", | ||
"repository": "https://github.com/polusai/polus-plugins", | ||
"website": "https://ncats.nih.gov/preclinical/core/informatics", | ||
"citation": "", | ||
"runCommand": [ | ||
"python3", | ||
"-m", | ||
"polus.plugins.transforms.images.binary_operations" | ||
], | ||
"inputs": [ | ||
{ | ||
"name": "inpDir", | ||
"description": "Input image collection to be processed by this plugin", | ||
"type": "collection", | ||
"options": null, | ||
"required": true | ||
}, | ||
{ | ||
"name": "filePattern", | ||
"description": "Pattern of the images in Input", | ||
"type": "string", | ||
"options": null, | ||
"required": false | ||
}, | ||
{ | ||
"name": "kernel", | ||
"description": "Kernel size that should be used for transformation", | ||
"type": "number", | ||
"options": null, | ||
"required": false | ||
}, | ||
{ | ||
"name": "operation", | ||
"description": "The Binary Operations that will be done on the image", | ||
"type": "enum", | ||
"options": { | ||
"values": [ | ||
"blackhat", | ||
"close", | ||
"dilate", | ||
"erode", | ||
"fillHoles", | ||
"invert", | ||
"morphologicalGradient", | ||
"open", | ||
"removeLarge", | ||
"removeSmall", | ||
"skeleton", | ||
"tophat" | ||
] | ||
}, | ||
"required": true | ||
}, | ||
{ | ||
"name": "shape", | ||
"description": "Structuring Shape (Default is Elliptical)", | ||
"type": "enum", | ||
"options": { | ||
"values": [ | ||
"ellipse", | ||
"rect", | ||
"cross" | ||
] | ||
}, | ||
"required": false | ||
}, | ||
{ | ||
"name": "threshold", | ||
"description": "Minimum Area of objects to keep.", | ||
"type": "number", | ||
"options": null, | ||
"required": false | ||
}, | ||
{ | ||
"name": "iterations", | ||
"description": "Number of times to perform an operation (when applicable).", | ||
"type": "number", | ||
"options": null, | ||
"required": false | ||
} | ||
], | ||
"outputs": [ | ||
{ | ||
"name": "outDir", | ||
"description": "Output collection", | ||
"type": "collection", | ||
"options": null, | ||
"required": true | ||
} | ||
], | ||
"ui": [ | ||
{ | ||
"key": "inputs.operation", | ||
"title": "Operations", | ||
"description": "Operations that will be used on image" | ||
}, | ||
{ | ||
"key": "inputs.filePattern", | ||
"title": "Image Pattern: ", | ||
"description": "Pattern of images in input collection (image_r{rrr}_c{ccc}_z{zzz}.ome.tif). " | ||
}, | ||
{ | ||
"key": "inputs.inpDir", | ||
"title": "Input collection", | ||
"description": "Input image collection to be processed by this plugin" | ||
}, | ||
{ | ||
"key": "inputs.kernel", | ||
"title": "Kernel Size", | ||
"description": "Kernel size to use for operations" | ||
}, | ||
{ | ||
"key": "inputs.shape", | ||
"title": "Structuring Shape (Default is Elliptical)", | ||
"description": "Kernel shape to use for operations" | ||
}, | ||
{ | ||
"key": "inputs.threshold", | ||
"title": "Threshold of area for objects in images", | ||
"description": "Threshold to use for operations" | ||
}, | ||
{ | ||
"key": "inputs.iterations", | ||
"title": "Iterations", | ||
"description": "Number of iterations to perform" | ||
} | ||
], | ||
"validators": null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[tool.poetry] | ||
name = "polus-plugins-transforms-images-binary-operations" | ||
version = "0.5.0-dev1" | ||
description = "" | ||
authors = ["nicholas-schaub <nick.schaub@nih.gov>", "Madhuri Vihani"] | ||
readme = "README.md" | ||
packages = [{include = "polus", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.9" | ||
bfio = {version = "2.1.9", extras = ["all"]} | ||
typer = "^0.7.0" | ||
filepattern = "^2.2.7" | ||
opencv-python = "^4.7.0.72" | ||
preadator = "^0.2.0" | ||
|
||
|
||
[tool.poetry.group.dev.dependencies] | ||
pytest = "^7.2.1" | ||
mypy = "^1.0.1" | ||
black = "^23.1.0" | ||
flake8 = "^6.0.0" | ||
pre-commit = "^3.1.0" | ||
bump2version = "^1.0.1" | ||
flake8-docstrings = "^1.7.0" | ||
|
||
[[tool.poetry.source]] | ||
name = "test" | ||
url = "https://test.pypi.org/simple/" | ||
secondary = true | ||
|
||
[build-system] | ||
requires = ["poetry-core"] | ||
build-backend = "poetry.core.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version=$(<VERSION) | ||
datapath=$(readlink --canonicalize ../../../data/) | ||
|
||
# Inputs: these parameters can be changed | ||
inpDir=/data/input/ # relative directory for where the input data is saved | ||
shape=ellipse #image or segmentation | ||
operation=removeLarge #boolean | ||
filePattern=None #the kinds of images/labels you want to use in the input directory | ||
|
||
# Depending on what operation is chosen, need to give values to certain arguments | ||
kernel=5 # necessary for dilation | ||
threshold=1 # Threshold for object sizes, only used for removeLarge and removeSmall | ||
iterations=1 # Number of iterations for an operation, only used by some operations | ||
|
||
# Outputs | ||
outDir=/data/output/ | ||
|
||
# Show the help message | ||
sudo docker run polusai/binary-operations-plugin:${version} | ||
|
||
# Run Docker | ||
sudo docker run --mount type=bind,source=${datapath},target=/data/ \ | ||
polusai/binary-operations-plugin:${version} \ | ||
--inpDir ${inpDir} \ | ||
--outDir ${outDir} \ | ||
--shape ${shape} \ | ||
--operation ${operation} \ | ||
--filePattern ${filePattern} \ | ||
--kernel ${kernel} \ | ||
--threshold ${threshold} \ | ||
--iterations ${iterations} |
25 changes: 25 additions & 0 deletions
25
...inary-operations-plugin/src/polus/plugins/transforms/images/binary_operations/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"""Binary operations tool.""" | ||
__version__ = "0.5.0-dev1" | ||
|
||
from polus.plugins.transforms.images.binary_operations.binops import ( # noqa | ||
Operation, | ||
StructuringShape, | ||
batch_binary_ops, | ||
binary_op, | ||
scalable_binary_op, | ||
) | ||
from polus.plugins.transforms.images.binary_operations.utils import ( # noqa | ||
blackhat, | ||
close_, | ||
dilate, | ||
erode, | ||
fill_holes, | ||
invert, | ||
iterate_tiles, | ||
morphgradient, | ||
open_, | ||
remove_large, | ||
remove_small, | ||
skeletonize, | ||
tophat, | ||
) |
Oops, something went wrong.