Skip to content

Commit

Permalink
Dimension Stacking: Fixed Dockerfile and build script (#554)
Browse files Browse the repository at this point in the history
* chore: some initial cleanup

* ci: updated Dockerfile and build script

* Bump version: 0.1.1-dev0 → 0.1.1-dev1

* build: updated bfio to 2.3.6

* Bump version: 0.1.1-dev1 → 0.1.1-dev2
  • Loading branch information
nishaq503 authored Jul 19, 2024
1 parent 750479d commit a53c27d
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 25 deletions.
4 changes: 2 additions & 2 deletions formats/image-dimension-stacking-tool/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[bumpversion]
current_version = 0.1.1-dev
commit = False
current_version = 0.1.1-dev2
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
Expand Down
16 changes: 10 additions & 6 deletions formats/image-dimension-stacking-tool/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ ENV POLUS_LOG="INFO"
# Work directory defined in the base container
WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY src ${EXEC_DIR}/src
# TODO: Change the tool_dir to the tool directory
ENV TOOL_DIR="formats/image-dimension-stacking-tool"

RUN pip3 install ${EXEC_DIR} --no-cache-dir
# Copy the repository into the container
RUN mkdir image-tools
COPY . ${EXEC_DIR}/image-tools

# Default command. Additional arguments are provided through the command line
# Install the tool
RUN pip3 install "${EXEC_DIR}/image-tools/${TOOL_DIR}" --no-cache-dir

# Set the entrypoint
# TODO: Change the entrypoint to the tool entrypoint
ENTRYPOINT ["python3", "-m", "polus.images.formats.image_dimension_stacking"]
CMD ["--help"]
2 changes: 1 addition & 1 deletion formats/image-dimension-stacking-tool/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Image dimension stacking(0.1.1-dev)
# Image dimension stacking(0.1.1-dev2)

This plugin leverages the [filepattern](https://filepattern2.readthedocs.io/en/latest/Home.html) library and employs the filepattern `groupBy` functionality to enable the matching of image filenames, facilitating their stacking into multi-dimensional images.

Expand Down
2 changes: 1 addition & 1 deletion formats/image-dimension-stacking-tool/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.1-dev
0.1.1-dev2
20 changes: 19 additions & 1 deletion formats/image-dimension-stacking-tool/build-docker.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash

# TODO: Change the name of the tool here
tool_dir="formats"
tool_name="image-dimension-stacking-tool"

# The version is read from the VERSION file
version=$(<VERSION)
docker build . -t polusai/image-dimension-stacking-tool:${version}
tag="polusai/${tool_name}:${version}"
echo "Building docker image with tag: ${tag}"

# The current directory and the repository root are saved in variables
cur_dir=$(pwd)
repo_root=$(git rev-parse --show-toplevel)

# The Dockerfile and .dockerignore files are copied to the repository root before building the image
cd ${repo_root}
cp ./${tool_dir}/${tool_name}/Dockerfile .
cp .gitingore .dockerignore
docker build . -t ${tag}
rm Dockerfile .dockerignore
cd ${cur_dir}
4 changes: 2 additions & 2 deletions formats/image-dimension-stacking-tool/plugin.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "Image Dimension Stacking",
"version": "0.1.1-dev",
"version": "0.1.1-dev2",
"title": "Stacking of image dimensions (c, z, t) to create a multidimensional image.",
"description": "Stacking of image dimensions (c, z, t) to create a multidimensional image.",
"author": "Nick Schaub (nick.schaub@nih.gov), Hamdah Shafqat Abbasi (hamdahshafqat.abbasi@nih.gov)",
"institution": "National Center for Advancing Translational Sciences, National Institutes of Health",
"repository": "https://github.com/PolusAI/image-tools",
"website": "https://ncats.nih.gov/preclinical/core/informatics",
"containerId": "polusai/image-dimension-stacking-tool:0.1.1-dev",
"containerId": "polusai/image-dimension-stacking-tool:0.1.1-dev2",
"baseCommand": [
"python3",
"-m",
Expand Down
12 changes: 3 additions & 9 deletions formats/image-dimension-stacking-tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "polus-images-formats-image-dimension-stacking"
version = "0.1.1-dev"
version = "0.1.1-dev2"
description = "Stacking multi-dimensional images"
authors = [
"Nick Schaub <nick.schaub@nih.gov>",
Expand All @@ -12,19 +12,13 @@ packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
bfio = {version = "2.3.3", extras = ["all"]}
bfio = {version = "^2.3.6", extras = ["all"]}
typer = "^0.7.0"
tqdm = "^4.66.1"
filepattern = "^2.0.4"
pydantic = "^1.10.4"
preadator="0.4.0.dev2"


[[tool.poetry.source]]
name = "test"
url = "https://test.pypi.org/simple/"
default = false
secondary = true
numpy = "<2.0.0"

[tool.poetry.group.dev.dependencies]
bump2version = "^1.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
"""Image dimension stacking package."""
__version__ = "0.1.1-dev"

__version__ = "0.1.1-dev2"
1 change: 1 addition & 0 deletions formats/image-dimension-stacking-tool/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Set up all data used in tests.
"""

import shutil
import tempfile
from pathlib import Path
Expand Down
6 changes: 4 additions & 2 deletions formats/image-dimension-stacking-tool/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
"""Test Command line Tool."""
from typer.testing import CliRunner
from polus.images.formats.image_dimension_stacking.__main__ import app

from pathlib import Path
from typing import Union

from typer.testing import CliRunner
import pytest
from polus.images.formats.image_dimension_stacking.__main__ import app


def test_cli(synthetic_images: tuple[Union[str, Path]], output_directory: Path) -> None:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Testing of image dimension stacking."""

from pathlib import Path
from typing import Union

Expand Down

0 comments on commit a53c27d

Please sign in to comment.