Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af58413
Merge pull request #39 from plaque2/dev
trinade Sep 20, 2024
90a097a
Create docmd-wiki.yml
ayakimovich Jul 4, 2025
7a8807d
Merge pull request #40 from plaque2/ayakimovich-patch-1
ayakimovich Jul 4, 2025
21619d6
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
df3d27d
Merge pull request #42 from plaque2/ayakimovich-patch-2
ayakimovich Jul 4, 2025
3b1d323
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
7d806ee
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
594f687
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
43cd922
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
ee49c53
Merge pull request #43 from plaque2/ayakimovich-patch-3
ayakimovich Jul 4, 2025
46e7020
Update picks.py
ayakimovich Jul 4, 2025
219387d
Update picks.py
ayakimovich Jul 4, 2025
83ff3de
Merge pull request #44 from plaque2/fix/strel_fun
ayakimovich Jul 4, 2025
756268f
Update picks.py
ayakimovich Jul 4, 2025
3936086
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
2d9b1a0
Merge pull request #45 from plaque2/ayakimovich-patch-1
ayakimovich Jul 4, 2025
4f37808
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
b9aa042
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
fb0feb8
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
682ef15
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
fd7cde7
Update docmd-wiki.yml
ayakimovich Jul 4, 2025
84a427d
Update docmd-wiki.yml
ayakimovich Jul 7, 2025
19a8bcb
Update docmd-wiki.yml
ayakimovich Jul 7, 2025
d9f54ba
Update docmd-wiki.yml
ayakimovich Jul 7, 2025
d5545c2
Update docmd-wiki.yml
ayakimovich Jul 7, 2025
55517e7
Update docmd-wiki.yml
ayakimovich Jul 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/docmd-wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generate and Push Docs to Wiki

on:
release:
types: [created]

jobs:
generate-docs:
runs-on: ubuntu-latest

steps:
- name: Checkout wiki repo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}.wiki
path: wiki

- name: Checkout PyPlaque repo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: PyPlaque

- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install docmd
run: pip install docmd

- name: Check existing paths
run: |
pwd
ls

- name: Create MD files from PyPlaque docstrings
run: |
cd PyPlaque
pwd
pip install -e .
docmd PyPlaque.experiment --out ../wiki
docmd PyPlaque.phenotypes --out ../wiki
docmd PyPlaque.specimen --out ../wiki
docmd PyPlaque.utils --out ../wiki
docmd PyPlaque.view --out ../wiki

- name: Check existing paths
run: |
pwd
ls

- name: Run script to update wiki
run: |
cd wiki
git config --global user.email "noreply@github.com"
git config --global user.name "gh_actions_runner"
git add .
git commit -m "Updated wiki with a new page"
git push
27 changes: 17 additions & 10 deletions PyPlaque/utils/picks.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import numpy as np
from scipy import ndimage as ndi

STREL_4 = np.array([[0, 1, 0],
def get_strel(neighbourhood):
"""
**get_strel Function**
This function returns structural elements of the defined neighbourhood.

Args:
neighbourhood (int, required): Neighbourhood value of 4 or 8.

Returns:
np.uint8 array of the structural element.
"""
if neighbourhood == 4:
return np.array([[0, 1, 0],
[1, 1, 1],
[0, 1, 0]], dtype=np.uint8)
STREL_8 = np.ones((3, 3), dtype=np.uint8)
elif neighbourhood == 8:
return np.ones((3, 3), dtype=np.uint8)

def picks_area(image, neighbourhood=4):
"""
Expand All @@ -31,10 +44,7 @@ def picks_area(image, neighbourhood=4):
TypeError: If `image` is not a 2D numpy array or `neighbourhood` is not an integer.
ValueError: If `neighbourhood` is not either 4 or 8.
"""
if neighbourhood == 4:
strel = STREL_4
elif neighbourhood == 8:
strel = STREL_8
strel = get_strel(neighbourhood)
image = image.astype(np.uint8)
eroded_image = ndi.binary_erosion(image, strel, border_value=0)
border_image = image - eroded_image
Expand Down Expand Up @@ -86,10 +96,7 @@ def picks_perimeter(image, neighbourhood=4):
TypeError: If `image` is not a 2D numpy array or `neighbourhood` is not an integer.
ValueError: If `neighbourhood` is not either 4 or 8.
"""
if neighbourhood == 4:
strel = STREL_4
else:
strel = STREL_8
strel = get_strel(neighbourhood)
image = image.astype(np.uint8)

(w, h) = image.shape
Expand Down