diff --git a/.github/workflows/publish_conda.yml b/.github/workflows/publish_conda.yml index bc1b5a9f..a58442ec 100644 --- a/.github/workflows/publish_conda.yml +++ b/.github/workflows/publish_conda.yml @@ -4,16 +4,34 @@ on: workflow_dispatch: release: types: [published] - + jobs: - publish: + conda_deployment_with_new_tag: + name: Conda deployment of package with Python ${{ matrix.python-version }} runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v1 - - name: publish-to-conda - uses: MichaelsJP/conda-package-publish-action@v1.0.0 - with: - subDir: 'conda-build' - AnacondaToken: ${{ secrets.ANACONDA_TOKEN }} - platforms: 'all' - override: true \ No newline at end of file + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Conda environment creation and activation + uses: conda-incubator/setup-miniconda@v2 + with: + python-version: ${{ matrix.python-version }} + environment-file: conda-build/conda_build_config.yml + auto-update-conda: false + auto-activate-base: false + show-channel-urls: true + - name: Build and upload the conda packages + uses: uibcdf/action-build-and-upload-conda-packages@v1.3.0 + with: + meta_yaml_dir: conda-build + python-version: ${{ matrix.python-version }} + platform_linux-64: true + platform_osx-64: true + platform_win-64: true + user: RRobert92 + label: auto + token: ${{ secrets.ANACONDA_TOKEN }} # Replace with the right name of your secret \ No newline at end of file diff --git a/conda-build/conda_publish_env.yaml b/conda-build/conda_publish_env.yaml index 283a6902..c526ad7b 100644 --- a/conda-build/conda_publish_env.yaml +++ b/conda-build/conda_publish_env.yaml @@ -9,7 +9,6 @@ dependencies: - scikit-learn>1.0.1 - scikit-image>0.19.2 - scipy>=1.8.1 - - edt>=2.3.0 - pillow>10.0.0 - open3d>=0.9.0 - requests>2.28.0 diff --git a/conda-build/meta-v0.2.2.yaml b/conda-build/meta-v0.2.2.yaml index 50d8d47d..090d1869 100644 --- a/conda-build/meta-v0.2.2.yaml +++ b/conda-build/meta-v0.2.2.yaml @@ -35,7 +35,6 @@ build: number: 0 script: "{{ PYTHON }} setup.py install --single-version-externally-managed --record=record.txt" - about: home: https://github.com/SMLC-NYSBC/TARDIS license: MIT diff --git a/docs/tutorials.rst b/docs/tutorials.rst index 41e973dc..6343e46a 100644 --- a/docs/tutorials.rst +++ b/docs/tutorials.rst @@ -15,3 +15,6 @@ Tutorials `4. Visualize Instance segmentation results `__ ------------------------------------------------------------------------- + +`4. Helper functions `__ +------------------------------------------------------------------------- diff --git a/docs/usage/helper.rst b/docs/usage/helper.rst new file mode 100644 index 00000000..b6a6c82a --- /dev/null +++ b/docs/usage/helper.rst @@ -0,0 +1,2 @@ +Helper functions +---------------- diff --git a/tardis_em/scripts/visualize.py b/tardis_em/scripts/visualize.py index 2ec50c7b..9176514a 100644 --- a/tardis_em/scripts/visualize.py +++ b/tardis_em/scripts/visualize.py @@ -11,7 +11,7 @@ import click import numpy as np from tardis_em.utils.visualize_pc import VisualizeFilaments, VisualizePointCloud -from tardis_em.utils.load_data import ImportDataFromAmira +from tardis_em.utils.load_data import ImportDataFromAmira, load_mrc_file from tardis_em._version import version @@ -63,6 +63,24 @@ def main(dir_: str, _2d: bool, type_: str, animate: bool, with_node: bool): pc = ImportDataFromAmira(dir_).get_segmented_points() elif dir_.endswith(".npy"): pc = np.load(dir_) + elif dir_.endswith(".mrc"): + pc, _ = load_mrc_file(dir_) + if pc.min() == 0 and pc.max() == 1: + pc = np.array(np.where(pc > 0)).T + else: + idx_ = np.unique(pc) + + px_df = [] + for i in idx_: + if i == 0: + continue + + i_ = np.array(np.where(pc == i)).T + px_df.append( + np.hstack((np.repeat(i, len(i_))[:, None], i_)) + ) + + pc = np.vstack(px_df) if type_ == "p": if pc.shape[1] == 4 or pc.shape[1] == 3 and _2d: