Skip to content

Commit

Permalink
update docs and minor tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
zsylvester committed Nov 22, 2024
1 parent 0f6b227 commit 533c616
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 41 deletions.
60 changes: 32 additions & 28 deletions docs/source/api_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,43 @@ API Reference
.. toctree::
:caption: API Reference

.. autofunction:: segmenteverygrain.predict_image
.. autofunction:: segmenteverygrain.predict_large_image
.. autofunction:: segmenteverygrain.predict_image_tile
.. autofunction:: segmenteverygrain.label_grains
.. autofunction:: segmenteverygrain.one_point_prompt
.. autofunction:: segmenteverygrain.two_point_prompt
.. autofunction:: segmenteverygrain.find_overlapping_polygons
.. autofunction:: segmenteverygrain.weighted_crossentropy
.. autofunction:: segmenteverygrain.plot_images_and_labels
.. autofunction:: segmenteverygrain.calculate_iou
.. autofunction:: segmenteverygrain.pick_most_similar_polygon
.. autofunction:: segmenteverygrain.sam_segmentation
.. autofunction:: segmenteverygrain.find_connected_components
.. autofunction:: segmenteverygrain.merge_overlapping_polygons
.. autofunction:: segmenteverygrain.rasterize_grains
.. autofunction:: segmenteverygrain.classify_points
.. autofunction:: segmenteverygrain.click_for_scale
.. autofunction:: segmenteverygrain.collect_polygon_from_mask
.. autofunction:: segmenteverygrain.compute_curvature
.. autofunction:: segmenteverygrain.convert_to_large_image_coords
.. autofunction:: segmenteverygrain.create_and_train_model
.. autofunction:: segmenteverygrain.create_labeled_image
.. autofunction:: segmenteverygrain.create_train_val_test_data
.. autofunction:: segmenteverygrain.extract_patch
.. autofunction:: segmenteverygrain.find_connected_components
.. autofunction:: segmenteverygrain.find_grain_size_classes
.. autofunction:: segmenteverygrain.find_overlapping_polygons
.. autofunction:: segmenteverygrain.get_area_weighted_distribution
.. autofunction:: segmenteverygrain.get_grains_from_patches
.. autofunction:: segmenteverygrain.label_grains
.. autofunction:: segmenteverygrain.load_and_preprocess
.. autofunction:: segmenteverygrain.merge_overlapping_polygons
.. autofunction:: segmenteverygrain.onclick
.. autofunction:: segmenteverygrain.onpress
.. autofunction:: segmenteverygrain.onclick2
.. autofunction:: segmenteverygrain.onpress2
.. autofunction:: segmenteverygrain.click_for_scale
.. autofunction:: segmenteverygrain.get_grains_from_patches
.. autofunction:: segmenteverygrain.plot_image_w_colorful_grains
.. autofunction:: segmenteverygrain.plot_grain_axes_and_centroids
.. autofunction:: segmenteverygrain.classify_points
.. autofunction:: segmenteverygrain.compute_curvature
.. autofunction:: segmenteverygrain.extract_patch
.. autofunction:: segmenteverygrain.convert_to_large_image_coords
.. autofunction:: segmenteverygrain.onclick_large_image
.. autofunction:: segmenteverygrain.one_point_prompt
.. autofunction:: segmenteverygrain.onpress
.. autofunction:: segmenteverygrain.onpress2
.. autofunction:: segmenteverygrain.patchify_training_data
.. autofunction:: segmenteverygrain.create_train_val_test_data
.. autofunction:: segmenteverygrain.create_and_train_model
.. autofunction:: segmenteverygrain.save_polygons
.. autofunction:: segmenteverygrain.pick_most_similar_polygon
.. autofunction:: segmenteverygrain.plot_grain_axes_and_centroids
.. autofunction:: segmenteverygrain.plot_histogram_of_axis_lengths
.. autofunction:: segmenteverygrain.plot_image_w_colorful_grains
.. autofunction:: segmenteverygrain.plot_images_and_labels
.. autofunction:: segmenteverygrain.predict_image
.. autofunction:: segmenteverygrain.predict_image_tile
.. autofunction:: segmenteverygrain.predict_large_image
.. autofunction:: segmenteverygrain.rasterize_grains
.. autofunction:: segmenteverygrain.read_polygons
.. autofunction:: segmenteverygrain.plot_histogram_of_axis_lengths
.. autofunction:: segmenteverygrain.sam_segmentation
.. autofunction:: segmenteverygrain.save_polygons
.. autofunction:: segmenteverygrain.two_point_prompt
.. autofunction:: segmenteverygrain.Unet
.. autofunction:: segmenteverygrain.weighted_crossentropy
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
project = 'segmenteverygrain'
copyright = '2024, Zoltan Sylvester'
author = 'Zoltan Sylvester'
release = '0.1.9'
release = '0.2.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
2 changes: 1 addition & 1 deletion segmenteverygrain/Segment_every_grain_colab.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.15"
"version": "3.8.20"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
8 changes: 1 addition & 7 deletions segmenteverygrain/Segment_every_grain_w_georeferencing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"cell_type": "markdown",
"id": "a3c1dfc6",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -127,7 +126,6 @@
"cell_type": "markdown",
"id": "968737c4",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -225,7 +223,6 @@
"cell_type": "markdown",
"id": "ab7201a5",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -316,7 +313,6 @@
"cell_type": "markdown",
"id": "768a05d2",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -592,7 +588,6 @@
"cell_type": "markdown",
"id": "039415c6",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -628,7 +623,6 @@
"cell_type": "markdown",
"id": "24f154fb",
"metadata": {
"jp-MarkdownHeadingCollapsed": true,
"tags": []
},
"source": [
Expand Down Expand Up @@ -1071,7 +1065,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.15"
"version": "3.8.20"
}
},
"nbformat": 4,
Expand Down
5 changes: 2 additions & 3 deletions segmenteverygrain/segmenteverygrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,6 @@ def Unet():

tf.keras.backend.clear_session()

# image = tf.keras.Input((256, 256, 3), name='input')
inputs = Input((256, 256, 3), name='input')

conv1 = Conv2D(16, (3,3), activation='relu', padding = 'same')(inputs)
Expand Down Expand Up @@ -1565,7 +1564,7 @@ def patchify_training_data(input_dir, patch_dir):
start_no = 0
for image in tqdm(images):
# Load the large image
large_image = tf.keras.preprocessing.image.load_img(image)
large_image = load_img(image)
# Convert the image to a tensor
large_image = tf.keras.preprocessing.image.img_to_array(large_image)
# Reshape the tensor to have a batch size of 1
Expand All @@ -1591,7 +1590,7 @@ def patchify_training_data(input_dir, patch_dir):
start_no = 0
for image in tqdm(labels):
# Load the large image
large_image = tf.keras.preprocessing.image.load_img(image)
large_image = load_img(image)
# Convert the image to a tensor
large_image = tf.keras.preprocessing.image.img_to_array(large_image)
large_image = large_image[:,:,0,np.newaxis] # only keep one layer and add a new axis
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="segmenteverygrain",
version="0.2.0",
version="0.2.1",
author="Zoltan Sylvester",
author_email="[email protected]",
description="a SAM-based model for segmenting grains in images of grains",
Expand Down

0 comments on commit 533c616

Please sign in to comment.