Skip to content

Commit

Permalink
Merge pull request #1 from AlphonsG/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AlphonsG authored Jan 19, 2023
2 parents b2126ae + 99f970f commit b8c0039
Show file tree
Hide file tree
Showing 1,100 changed files with 213,222 additions and 1 deletion.
Binary file added .coverage
Binary file not shown.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pth filter=lfs diff=lfs merge=lfs -text
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '40 7 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
45 changes: 45 additions & 0 deletions .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Python package

on: [push, pull_request]

jobs:
build:

runs-on: windows-latest
strategy:
max-parallel: 4
matrix:
python-version: ['3.10']

steps:
- name: Support longpaths
run: git config --system core.longpaths true
- uses: actions/checkout@v1
with:
lfs: 'true'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[test]
- name: Checkout submodule
run: |
git submodule sync
git submodule update --init --recursive
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest --cov=bimana --cov-report term-missing --cov-report lcov tests/
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.vscode/

bimana.egg-info/

*.pyc
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "third_party/DexiNed"]
path = third_party/DexiNed
url = https://github.com/AlphonsG/DexiNed
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# How to contribute to Bimana

:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:

## Report issues or problems with the software

* **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/AlphonsG/BIMANA/issues).

* If you're unable to find an open issue addressing the problem, use the relevant bug report [template](https://github.com/AlphonsG/BIMANA/issues/new/choose) to create one.

* If not possible, you can [open a blank issue](https://github.com/AlphonsG/BIMANA/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.

## Submitting Changes

* Open a new GitHub pull request with the change.

* Ensure the PR description clearly describes the change. Include the relevant issue number if applicable.

* At lease one reviewer should be added so that the code is looked over by someone else.

Always write a clear log message for your commits, for example:

$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."

## Coding conventions

Please follow the [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) when contributing to the code.

## Seek Support

Please feel free to send an email to the following address for other matters:
- [email protected]
120 changes: 119 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,119 @@
# BIMANA
# Bimana

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![Python package](https://github.com/AlphonsG/BIMANA/actions/workflows/python-package.yaml/badge.svg?branch=dev)](https://github.com/AlphonsG/BIMANA/actions/workflows/python-package.yaml)
[![Coverage
Status](https://coveralls.io/repos/github/AlphonsG/BIMANA/badge.svg?branch=dev)](https://coveralls.io/github/AlphonsG/BIMANA?branch=dev)
[![CodeFactor](https://www.codefactor.io/repository/github/alphonsg/bimana/badge/dev)](https://www.codefactor.io/repository/github/alphonsg/bimana/overview/dev)
[![GitHub license](https://img.shields.io/github/license/AlphonsG/BIMANA)](https://github.com/AlphonsG/BIMANA/blob/main/LICENSE)

![](misc/images/bimana.png?raw=true "Bimana Image Analysis")

Package for performing automated bio-image analysis tasks.

# Table of contents
1. <a href="#installation">Installation</a>
2. <a href="#usage">Usage</a>
3. <a href="#license">License</a>
4. <a href="#community-guidelines">Community Guidelines</a>
5. <a href="#acknowledgements">Acknowledgements</a>
## Installation <a id="installation"></a>

Bimana can be installed on Linux, Windows (with 64 bit Python) & macOS and
supports Python 3.10 and above. It is recommended to install and run Bimana
within a [virtual environment](https://docs.python.org/3/tutorial/venv.html).

1. Download and install [Python](https://www.python.org/downloads/) (Bimana was
tested using [Python version
3.10.6](https://www.python.org/downloads/release/python-3106/)),
[Git](https://git-scm.com/) and [Git LFS](https://git-lfs.github.com/).
Linux and macOS users must also install [libvips](https://www.libvips.org/install.html).

2. Launch the terminal (*Linux* and *macOS* users) or command prompt (*Windows* users). The proceeding commands will be entered into the opened window<sup>1</sup>.

3. Create and activate a virtual environment called 'bimana-env' in your desired directory:

```pip install --upgrade pip```

```python -m venv bimana-env```

```. bimana-env/bin/activate``` (*Linux* and *macOS* users) or ```bimana-env\Scripts\activate.bat``` (*Windows* users)

4. Install PyTorch by specifying your system configuration using the official [PyTorch get started tool](https://pytorch.org/get-started/locally/) and running the generated command:
<p style="text-align:center;">
<img src="misc/images/pytorch_get_started.png" width="750" alt="centered image" />
</p>
For example, according to the image above, Windows users without a GPU (i.e. CPU only) will run:

```pip3 install torch torchvision torchaudio```


5. Clone this repository into your desired directory:

```
git lfs install
git clone https://github.com/AlphonsG/BIMANA.git
```

6. Navigate into the cloned directory:

```cd BIMANA```

7. Install Bimana:

```
git submodule update --init --recursive
pip install -e .
```

Notes:
- <sup>1</sup>Confirm that the correct python version for Bimana has been installed using the `python -V` command in the terminal. If this command does not report the correct python version, try using the `python3 -v` command instead. If the second command produces the expected result, replace all `python` and `pip` commands in this guide with `python3` and `pip3`, respectively.

- The virtual environment can be deactivated using:

```deactivate```

## Usage <a id="usage"></a>

Enter `bimana -h` or `bimana --help` within the `bimana-env` environment after installation for details on how to use Bimana.

Example commands that can be used to test Bimana using input data provided in
each folder [here](misc/examples) are given below. After
processing is finished for a given folder containing input images, multiple subfolders
containing generated outputs (e.g. images, CSV files, etc) are created. Examples of these are also provided.

Example commands (first run `cd misc` from the cloned repository folder):

- Histological Section Analysis
```
bimana histological-section-analysis --staining-amount-in-tissue-area --cilia-amount-above-tissue-area
```

- Tight junction analysis
```
bimana tight-junction-analysis misc/examples/tight_junctions --analyse-tight-junctions --analyse-cells
```
- Live cell imaging metrics analysis
```
bimana live-cell-imaging metrics-file-processing misc/examples/live_cell_imaging
```

## License <a id="license"></a>

[MIT License](LICENSE)


## Community guidelines <a id="community-guidelines"></a>

Guidelines for third-parties wishing to:

- Contribute to the software
- Report issues or problems with the software
- Seek support

can be found [here](CONTRIBUTING.md).

## Acknowledgements <a id="acknowledgements"></a>

- https://github.com/xavysp/DexiNed
- https://github.com/DevonsMo/IJOQ
Empty file added bimana/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions bimana/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from bimana.cli import cli


def main() -> int:
cli()

return 0


if __name__ == '__main__':
main()
21 changes: 21 additions & 0 deletions bimana/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import click

from bimana.histological_section.commands import histological_section_analysis
from bimana.tight_junctions.commands import tight_junction_analysis
from bimana.live_cell_imaging.commands import live_cell_imaging

CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])


@click.group(context_settings=CONTEXT_SETTINGS)
def cli() -> None:
""" Simple command line utility called `bimana`.
The cli is composed of commands for performing automated bio-image
analysis tasks.
"""


cli.add_command(histological_section_analysis)
cli.add_command(tight_junction_analysis)
cli.add_command(live_cell_imaging)
Empty file.
Loading

0 comments on commit b8c0039

Please sign in to comment.