Skip to content

Commit

Permalink
update for v0.2.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
RRobert92 committed May 9, 2024
1 parent b02a85c commit 23afc60
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 323 deletions.
11 changes: 9 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
.. image:: https://img.shields.io/badge/Join%20Our%20Community-Slack-blue
:target: https://join.slack.com/t/tardis-em/shared_invite/zt-27jznfn9j-OplbV70KdKjkHsz5FcQQGg


Python-based software for generalized object instance segmentation from (cryo-)electron microscopy
micrographs/tomograms. The software package is built on a general workflow where predicted semantic segmentation
is used for instance segmentation of 2D/3D images.
Expand All @@ -32,7 +33,7 @@ Features
- Robust and high-throughput semantic/instance segmentation of all microtubules:
- Supported file formats: [.tif, .mrc, .rec, .am]
- Supported modality: [ET, Cryo-ET]
- Supported Å resolution: [all]
- Supported Å resolution: [any best results in 1-40 Å range]
- 2D micrograph modality microtubule segmentation will come soon!

- Robust and high-throughput semantic/instance segmentation of membranes:
Expand Down Expand Up @@ -63,6 +64,7 @@ What's new?
TARDIS-em v0.2.1 (2024-08):
* Improvement from Microtubule and Membrane prediction with updated models
* Added option for scripting TARDIS predictions
* TARDIS build in results visualization
* Bug fixes
* Documentation tutorials
* Pypi and Conda releases
Expand All @@ -82,20 +84,25 @@ TBD

3D prediction
^^^^^^^^^^^^^
Full tutorial: Full tutorial: `3D Microtubules Prediction <https://smlc-nysbc.github.io/TARDIS/usage/3d_mt.html>`__


Example:
""""""""

.. image:: resources/3d_mt.jpg

Data source: Dr. Gunar Fabig and Prof. Dr. Thomas Müller-Reichert, TU Dresden


Usage:
""""""

.. code-block:: bash
recommended usage: tardis_mt [-dir path/to/folder/with/input/tomogram]
advance usage: tardis_mt [-dir str] [-out str] [-ps int] [-ct float] [-dt float]
[-pv int] [-ap str] ...
[-pv int] [-px float] ...
Membrane Prediction
Expand Down
1 change: 1 addition & 0 deletions conda-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$PYTHON setup.py install # Python command to install the script.
5 changes: 5 additions & 0 deletions conda-build/conda_build_config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
name: conda-publish-env
python:
- 3.8
- 3.9
- 3.10
- 3.11
dependencies:
- python>=3.8
- pytorch>=1.12.0
Expand Down
11 changes: 5 additions & 6 deletions conda-build/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package:
name: "tardis-em"
version: {{ data.get(version) }}
version: {{ data.get['version'] }}

source:
git_url: https://github.com/SMLC-NYSBC/TARDIS.git
Expand Down Expand Up @@ -36,10 +36,9 @@ requirements:
build:
noarch: python
number: 0
script: "{{ PYTHON }} setup.py install --single-version-externally-managed --record=record.txt"

script: "python setup.py install --single-version-externally-managed --record=record.txt"

about:
home: https://github.com/SMLC-NYSBC/TARDIS
license: MIT
license_file: LICENSE
home: {{ data['url'] }}
license: {{ data['license'] }}
summary: {{ data['description'] }}
6 changes: 6 additions & 0 deletions docs/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ Step 3: Install TARDIS

The following command will install TARDIS and all its dependencies

.. code-block:: bash
pip install tardis-em
(Optional) Install from GitHub master branch:

.. code-block:: bash
cd TARDIS
Expand Down
Binary file modified docs/resources/2d_mem.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/resources/3d_mem.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/resources/3d_mt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 32 additions & 8 deletions docs/usage/2d_membrane.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,24 @@ Preparation
___________

Simply store all your micrographs in one folder. TARDIS will recognize all
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am].
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am, .npy].

`Tip:` In the case of REC/MAP/MRC files try to make sure that files have embedded
in the header pixel size information.
in the header pixel size information. You can check it with Imod :bash:`header`
in your bash terminal.

Prediction
__________

(Optional) Type the following to check if TARDIS is up-to-date and is working properly.
(Optional) Type the following to check if TARDIS is working properly.

`Tips:` If any error occurs, try using our `troubleshooting chapter <troubleshooting.html>`__.

.. code-block::
tardis
This will display the TARDIS interface and show available options or available updates.
This will display the TARDIS interface and show available options.

.. image:: ../resources/main_tardis.jpg
:width: 512
Expand All @@ -66,6 +67,8 @@ the folder with your data.
Running this will segment all micrographs in the indicated path. Predicted output
will be store in file format indicated in :bash:`-out <output_type>` [:ref:`see all -out options <out>`].

You can also segment individual file by replacing :bash:`-dir` with file not a folder location.

For example:

.. code-block::
Expand Down Expand Up @@ -128,10 +131,10 @@ with the explanation for their functionality:
csv coordinate file [ID, X, Y], stl [mesh grid], or None [no instance prediction].

- :guilabel:`default:` mrc_csv
- :guilabel:`Allowed options:` am_None, mrc_None, tif_None, None_am, am_am, mrc_am, tif_am,
None_amSG, am_amSG, mrc_amSG, tif_amSG, None_mrc, am_mrc, mrc_mrc, tif_mrc,
None_tif, am_tif, mrc_tif, tif_tif, None_csv, am_csv, mrc_csv, tif_csv,
None_stl, am_stl, mrc_stl, tif_stl
- :guilabel:`Allowed options:` am_None, mrc_None, tif_None, npy_None, None_am, am_am, mrc_am, tif_am, npy_am,
None_amSG, am_amSG, mrc_amSG, tif_amSG, npy_amSG, None_mrc, am_mrc, mrc_mrc, tif_mrc, npy_csv,
None_tif, am_tif, mrc_tif, tif_tif, npy_tif, None_csv, am_csv, mrc_csv, tif_csv, npy_csv,
None_stl, am_stl, mrc_stl, tif_stl, npy_stl, None_npy, am_npy, mrc_npy, tif_npy, npy_npy,

:bash:`-ps` or :bash:`--patch_size`: Window size used for prediction.
- :guilabel:`Example:` This will break the micrograph into smaller patches with 25% overlap.
Expand Down Expand Up @@ -174,6 +177,27 @@ with the explanation for their functionality:
- :guilabel:`default:` 1000
- :guilabel:`Allowed options:` Int value between 250 and 5000.

:bash:`-cc` or :bash:`--connect_cylinder`: Cylinder radius used to filter unconnected components.
- :guilabel:`Example:` To minimize false positives when linking membranes,
we limit the search area to a cylindrical radius specified in angstroms. For each spline,
we find the direction the filament end is pointing in and look for another
filament that is oriented in the same direction. The ends of these filaments
must be located within this cylinder to be considered connected.

- :guilabel:`default:` 40
- :guilabel:`Allowed options:` Float value between 0 - inf

:bash:`-cm` or :bash:`--connect_membranes`: Cylinder radius used to filter unconnected components.
- :guilabel:`Example:` To address the issue where membrane are mistakenly
identified as two different filaments, we use a filtering technique. This involves
identifying the direction each membranes end points and then linking any membranes
that are facing the same direction and are within a certain distance from each other,
measured in angstroms. This distance threshold determines how far apart two membranes can be,
while still being considered as a single unit if they are oriented in the same direction.

- :guilabel:`default:` 1000
- :guilabel:`Allowed options:` Float value between 0 - inf

:bash:`-dv` or :bash:`--device`: Define which device to use for inference.
- :guilabel:`Example:` You can use :bash:`-dv gpu` to use the first available gpu on your system.
You can also specify the exact GPU device with the number :bash:`-dv 0`, :bash:`-dv 1`, etc. where 0 is always the default GPU.
Expand Down
16 changes: 9 additions & 7 deletions docs/usage/3d_membrane.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ _______________
Preparation
___________
Simply store all your tomograms in one folder. TARDIS will recognize all
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am].
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am, .npy].

`Tip:` In the case of REC/MAP/MRC files try to make sure that files have embedded
in the header pixel size information.

Prediction
__________

(Optional) Type the following to check if TARDIS is up-to-date and is working properly.
(Optional) Type the following to check if TARDIS is working properly.

`Tips:` If any error occurs, try using our `troubleshooting chapter <troubleshooting.html>`__.

.. code-block::
tardis
This will display the TARDIS interface and show available options or available updates.
This will display the TARDIS interface and show available options.

.. image:: ../resources/main_tardis.jpg
:width: 512
Expand All @@ -65,6 +65,8 @@ the folder with your data.
Running this will segment all tomograms in the indicated path. Predicted output
will be store in file format indicated in :bash:`-out <output_type>` [:ref:`see all -out options <out>`].

You can also segment individual file by replacing :bash:`-dir` with file not a folder location.

For example:

.. code-block::
Expand Down Expand Up @@ -128,10 +130,10 @@ with the explanation for their functionality:
csv coordinate file [ID, X, Y, Z], stl [mesh grid], or None [no instance prediction].

- :guilabel:`default:` mrc_csv
- :guilabel:`Allowed options:` am_None, mrc_None, tif_None, None_am, am_am, mrc_am, tif_am,
None_amSG, am_amSG, mrc_amSG, tif_amSG, None_mrc, am_mrc, mrc_mrc, tif_mrc,
None_tif, am_tif, mrc_tif, tif_tif, None_csv, am_csv, mrc_csv, tif_csv,
None_stl, am_stl, mrc_stl, tif_stl
- :guilabel:`Allowed options:` am_None, mrc_None, tif_None, npy_None, None_am, am_am, mrc_am, tif_am, npy_am,
None_amSG, am_amSG, mrc_amSG, tif_amSG, npy_amSG, None_mrc, am_mrc, mrc_mrc, tif_mrc, npy_csv,
None_tif, am_tif, mrc_tif, tif_tif, npy_tif, None_csv, am_csv, mrc_csv, tif_csv, npy_csv,
None_stl, am_stl, mrc_stl, tif_stl, npy_stl, None_npy, am_npy, mrc_npy, tif_npy, npy_npy

:bash:`-ps` or :bash:`--patch_size`: Window size used for prediction.
- :guilabel:`Example:` This will break tomograms into smaller patches with 25% overlap.
Expand Down
8 changes: 5 additions & 3 deletions docs/usage/3d_mt.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ _______________
Preparation
___________
Simply store all your tomograms in one folder. TARDIS will recognize all
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am].
image file with the extension [.tif, .tiff, .rec, .map, .mrc, .am, .npy].

`Tip:` In the case of REC/MAP/MRC files try to make sure that files have embedded
in the header pixel size information.
Expand All @@ -55,15 +55,15 @@ And will use that file to compare both outputs.
Prediction
__________

(Optional) Type the following to check if TARDIS is up-to-date and is working properly.
(Optional) Type the following to check if TARDIS is working properly.

`Tips:` If any error occurs, try using our `troubleshooting chapter <troubleshooting.html>`__.

.. code-block::
tardis
This will display the TARDIS interface and show available options or available updates.
This will display the TARDIS interface and show available options.

.. image:: ../resources/main_tardis.jpg
:width: 512
Expand All @@ -82,6 +82,8 @@ the folder with your data.
Running this will segment all tomograms in the indicated path. Predicted output
will be store in file format indicated in :bash:`-out <output_type>` [:ref:`see all -out options <out>`].

You can also segment individual file by replacing :bash:`-dir` with file not a folder location.

For example:

.. code-block::
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ black>23.0.0

# Build package
setuptools>67.2.0
twine>=5.0.0

# Plots
matplotlib>3.5.2
Expand Down
Binary file modified resources/2d_mem.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/3d_mem.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/3d_mt.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ license = MIT
license_files = LICENSE
version = attr:tardis_em.__version__
classifiers =
Development Status :: 4 - Beta
Intended Audience :: Developers/Research
Development Status :: 5 - Production/Stable
Intended Audience :: Education
Environment :: Console
Environment :: GPU :: NVIDIA CUDA :: >=11.3
Environment :: GPU :: NVIDIA CUDA :: 11
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: 3.7
Expand Down
6 changes: 6 additions & 0 deletions tardis_em/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from tardis_em._version import version

__version__ = version

format_choices = [
f"{prefix}_{suffix}"
for prefix in ["None", "am", "mrc", "tif", "npy"]
for suffix in ["None", "am", "mrc", "tif", "npy", "amSG", "csv", "stl"]
]
2 changes: 1 addition & 1 deletion tardis_em/compare_spatial_graphs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
show_default=True,
)
@click.option(
"-o",
"-out",
"--output",
default=join(getcwd(), "output"),
type=str,
Expand Down
36 changes: 3 additions & 33 deletions tardis_em/predict_mem.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
from tardis_em.utils.predictor import GeneralPredictor
from tardis_em._version import version
from tardis_em.utils.errors import TardisError
from tardis_em.utils.ota_update import ota_update
from tardis_em import format_choices

# from tardis_em.utils.ota_update import ota_update
# ota = ota_update()
warnings.simplefilter("ignore", UserWarning)

Expand Down Expand Up @@ -67,38 +68,7 @@
"-out",
"--output_format",
default="mrc_csv",
type=click.Choice(
[
"None_am",
"am_am",
"mrc_am",
"tif_am",
"None_amSG",
"am_amSG",
"mrc_amSG",
"tif_amSG",
"None_mrc",
"am_mrc",
"mrc_mrc",
"tif_mrc",
"None_tif",
"am_tif",
"mrc_tif",
"tif_tif",
"None_csv",
"am_csv",
"mrc_csv",
"tif_csv",
"None_stl",
"am_stl",
"mrc_stl",
"tif_stl",
"None_stl",
"am_None",
"mrc_None",
"tif_None",
]
),
type=click.Choice(format_choices),
help="Type of output files. The First optional output file is the binary mask "
"which can be of type None [no output], am [Amira], mrc or tif. "
"Second output is instance segmentation of objects, which can be "
Expand Down
Loading

0 comments on commit 23afc60

Please sign in to comment.