Skip to content

Commit

Permalink
Merge pull request #1339 from danforthcenter/acute-update-docs
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
nfahlgren authored Aug 21, 2023
2 parents 6b66c26 + 9c272ea commit aec06bc
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 69 deletions.
3 changes: 3 additions & 0 deletions docs/homology_acute.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ useful in parsing homolog_pts in downstream analyses

chain = raw angle scores for entire contour, used to visualize landmark clusters

verbose = supplemental file which stores coordinates, distance from
landmark cluster edges, and angle score for entire contour. Used in troubleshooting.

- **Parameters:**
- img - The original image, used for plotting purposes
- mask - Binary mask used to generate contour array (necessary for ptvals)
Expand Down
23 changes: 5 additions & 18 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<!--Color correction Tutorial-->
<div class="card" style="display:block">
<a target="_blank" href="" onclick="location.href=this.href.replace('tutorials', 'tutorials/transform_color_correction_tutorial');return false;">
<img src="https://github.com/danforthcenter/plantcv-binder/blob/master/notebooks/color_correction_tutorial/color_correction_tutorial_card.png?raw=true" alt="Color correction tutorial" width="600" height="auto">
<img src="https://github.com/danforthcenter/plantcv-tutorial-color-correction/blob/main/tutorial_card.png?raw=true" alt="Color correction tutorial" width="600" height="auto">
</a>
<div class="card-title">
<h6>Color Correction Tutorial</h6>
Expand All @@ -226,36 +226,23 @@
</div>
</div>

<!--Threshold tools Tutorial-->
<!--Segmentation Tutorials-->
<div class="card" style="display:block">
<a target="_blank" href="" onclick="location.href=this.href.replace('tutorials', 'tutorials/threshold_tutorial');return false;">
<img src="https://github.com/danforthcenter/plantcv-binder/blob/master/notebooks/threshold_tutorial/threshold_tutorial_card.png?raw=true" alt="Thresholding tutorial" width="600" height="auto">
<img src="https://github.com/danforthcenter/plantcv-tutorial-threshold/blob/main/tutorial_card.png?raw=true" alt="Segmentation tutorials" width="600" height="auto">
</a>
<div class="card-title">
<h6>Thresholding Tutorial</h6>
</div>
<div class="card-tags">
<span><strong>Tags</strong>: plant shoot, single plant, side-view, RGB, threshold methods</span>
</div>
</div>

<!--Updated Threshold Tools Tutorial-->
<div class="card" style="display:block">
<a target="_blank" href="" onclick="location.href=this.href.replace('tutorials', 'tutorials/threshold_tools_tutorial');return false;">
<img src="https://github.com/danforthcenter/plantcv-binder/blob/master/notebooks/new_mask_tutorial/mask_tutorial_card.jpg?raw=true" alt="Thresholding tools tutorial" width="600" height="auto">
</a>
<div class="card-title">
<h6>Tools for Thresholding Plant Data</h6>
</div>
<div class="card-tags">
<span><strong>Tags</strong>: plant shoot, single plant, side-view, RGB, threshold methods, binary mask</span>
<span><strong>Tags</strong>: plant shoot, single plant, side-view, RGB, threshold methods, seed, background subtraction, naive bayes, machine learning, segmentation</span>
</div>
</div>

<!--ROI Tutorial-->
<div class="card" style="display:block">
<a target="_blank" href="" onclick="location.href=this.href.replace('tutorials', 'tutorials/roi_tutorial');return false;">
<img src="https://github.com/danforthcenter/plantcv-binder/blob/master/notebooks/roi_tutorial/roi_tutorial_card.png?raw=true" alt="ROI tutorial" width="600" height="auto">
<img src="https://github.com/danforthcenter/plantcv-tutorial-roi/blob/main/tutorial_card.png?raw=true" alt="ROI tutorial" width="600" height="auto">
</a>
<div class="card-title">
<h6>Region of Interest Tutorial</h6>
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/homology_tutorial.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Tutorial: De novo homology assessment from landmark data

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-homology-tutorials/HEAD?filepath=index.ipynb) Check out the interactive tutorial!
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-homology-tutorials/HEAD?labpath=index.ipynb) Check out the interactive tutorial!

<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-homology-tutorials/blob/main/index.ipynb" width="100%" height="1500px"></iframe>
18 changes: 16 additions & 2 deletions docs/tutorials/roi_tutorial.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## Tutorial: Region of Interest Tutorial

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-binder.git/master?filepath=notebooks/roi_tutorial/roi_package.ipynb) Check out our interactive ROI tutorial!
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-tutorial-roi/HEAD?labpath=table_of_contents.ipynb) Check out our interactive ROI tutorials!

<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-binder/blob/master/notebooks/roi_tutorial/roi_package.ipynb" width="100%" height="1500px"></iframe>
## Table of Contents for ROI tutorials
1. [Rectangle ROI](#rectangle)
2. [Multi ROI](#rectangle)
3. [Automatic Grid ROIs](#rectangle)
4. [Circle ROI](#circle)
5. [Custom Polygon ROI](#custom)

### Rectangle/Mutli/Auto_Grid Region of Interest <a name="rectangle"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-roi/blob/main/notebooks/roi-rectangle-tutorial.ipynb" width="100%" height="1500px"></iframe>

## Circle Region of Interest <a name="circle"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-roi/blob/main/notebooks/roi-circle-tutorial.ipynb" width="100%" height="1500px"></iframe>

## Custom Polygon Region of Interest <a name="custom"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-roi/blob/main/notebooks/custom-roi-tutorial.ipynb" width="100%" height="1500px"></iframe>
2 changes: 1 addition & 1 deletion docs/tutorials/sorghum_morphology_tutorial.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Tutorial: Sorghum Shape and Morphology Analysis


[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-binder.git/master?filepath=notebooks/new_side_view_morphology_tutorial/morphology_analysis_side_view_workflow.ipynb) Check out our interactive sorghum shape and morphology tutorial!
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-binder.git/master?labpath=notebooks/new_side_view_morphology_tutorial/morphology_analysis_side_view_workflow.ipynb) Check out our interactive sorghum shape and morphology tutorial!

<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-binder/blob/master/notebooks/new_side_view_morphology_tutorial/morphology_analysis_side_view_workflow.ipynb" width="100%" height="1500px"></iframe>
6 changes: 0 additions & 6 deletions docs/tutorials/threshold_tools_tutorial.md

This file was deleted.

30 changes: 27 additions & 3 deletions docs/tutorials/threshold_tutorial.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
## Tutorial: Thresholding Tutorial
## Tutorial: Segmentation Tutorial

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-binder.git/master?filepath=notebooks/threshold_tutorial/threshold.ipynb) Check out our interactive thresholding tutorial!
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-tutorial-threshold/HEAD?labpath=index.ipynb) Check out our interactive thresholding tutorial!

<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-binder/blob/master/notebooks/threshold_tutorial/threshold.ipynb" width="100%" height="1500px"></iframe>
## Table of Contents for segmentation tutorials
1. [Thresholding](#thresholding)
2. [Edge Detection](#edges)
3. [Supervised Machine Learning](#naivebayes)
4. [Unsupervied Machine Learning](#kmeans)
5. [Background Subtraction](#background)
6. [Dual Thresholding](#dual)

### Thresholding <a name="thresholding"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/01.thresholding.ipynb" width="100%" height="1500px"></iframe>

### Edge Detection <a name="edges"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/02.edge-detection.ipynb" width="100%" height="1500px"></iframe>

### Supervised Machine Learning <a name="naivebayes"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/03.supervised-machine-learning.ipynb" width="100%" height="1500px"></iframe>

### Unsupervised Machine Learning <a name="kmeans"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/04.unsupervised-machine-learning.ipynb" width="100%" height="1500px"></iframe>

### Background Subtraction <a name="background"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/05.background-subtraction.ipynb" width="100%" height="1500px"></iframe>

### Dual Thresholding <a name="dual"></a>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-threshold/blob/main/modules/06.2d-thresholding.ipynb" width="100%" height="1500px"></iframe>
4 changes: 2 additions & 2 deletions docs/tutorials/transform_color_correction_tutorial.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Tutorial: Color Correction Workflow

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-binder.git/master?filepath=notebooks/color_correction_tutorial/color_correct_tutorial.ipynb) Check out our interactive color correction tutorial!
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/danforthcenter/plantcv-tutorial-color-correction.git/main?labath=index.ipynb) Check out our interactive color correction tutorial!

<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-binder/blob/master/notebooks/color_correction_tutorial/color_correct_tutorial.ipynb" width="100%" height="1500px"></iframe>
<iframe src="https://nbviewer.jupyter.org/github/danforthcenter/plantcv-tutorial-color-correction/blob/main/index.ipynb" width="100%" height="1500px"></iframe>
42 changes: 6 additions & 36 deletions plantcv/plantcv/homology/acute.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ def acute(img, mask, win, threshold):
:param mask: numpy.ndarray
:param win: int
:param threshold: int
:return homolog_pts:
:return homolog_pts: numpy.ndarray
:return start_pts: numpy.ndarray
:return stop_pts: numpy.ndarray
:return ptvals: list
:return chain: lsit
:return verbose_out: list
"""
# Find contours
contours, hierarchy = _cv2_findcontours(bin_img=mask)
Expand Down Expand Up @@ -80,12 +85,6 @@ def acute(img, mask, win, threshold):
p23 = np.sqrt((pt_a[0][0]-pt_b[0][0])*(pt_a[0][0]-pt_b[0][0])+(pt_a[0][1]-pt_b[0][1])*(pt_a[0][1]-pt_b[0][1]))
dot = (p12*p12 + p13*p13 - p23*p23)/(2*p12*p13)

# Used a random number generator to test if either of these cases were possible but neither is possible
# if dot > 1: # If float exceeds 1 prevent arcos error and force to equal 1
# dot = 1
# elif dot < -1: # If float exceeds -1 prevent arcos error and force to equal -1
# dot = -1

ang = math.degrees(math.acos(dot))
# print(str(k)+' '+str(dot)+' '+str(ang))
chain.append(ang)
Expand All @@ -96,10 +95,6 @@ def acute(img, mask, win, threshold):
if float(link) <= threshold:
index.append(c) # Append positions of acute links to index

# acute_pos = obj[index] # Extract all island points blindly
#
# float(len(acute_pos)) / float(len(obj)) # Proportion of informative positions

if len(index) != 0:

isle = []
Expand Down Expand Up @@ -160,31 +155,6 @@ def acute(img, mask, win, threshold):
else:
ptvals.append('NaN') # If no values can be retrieved (small/collapsed contours)
vals = []

# Identify pixel coordinate to use as pseudolandmark for island
# if len(isle[x]) == 1: # If landmark is a single point (store position)
# if debug == True:
# print('route A')
# pt = isle[x][0]
# max_dist.append([isle[x][0], '-', chain[isle[x][0]]])
# # print pt
# elif len(isle[x]) == 2: # If landmark is a pair of points (store more acute position)
# if debug == True:
# print('route B')
# pt_a = chain[isle[x][0]]
# pt_b = chain[isle[x][1]]
# print(pt_a, pt_b)
# if pt_a == pt_b:
# pt = isle[x][0] # Store point A if both are equally acute
# max_dist.append([isle[x][0], '-', chain[isle[x][0]]])
# elif pt_a < pt_b:
# pt = isle[x][0] # Store point A if more acute
# max_dist.append([isle[x][0], '-', chain[isle[x][0]]])
# elif pt_a > pt_b:
# pt = isle[x][1] # Store point B if more acute
# max_dist.append([isle[x][1], '-', chain[isle[x][1]]])
# print pt

if len(island) >= 3: # If landmark is multiple points (distance scan for position)
if params.debug is not None:
print('route C')
Expand Down

0 comments on commit aec06bc

Please sign in to comment.