Skip to content

Commit e3ccc42

Browse files
authored
Merge pull request #1346 from danforthcenter/release-4.0
Release 4.0
2 parents ce8c0fa + aec06bc commit e3ccc42

File tree

544 files changed

+12790
-7584
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

544 files changed

+12790
-7584
lines changed

.all-contributorsrc

+11
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,17 @@
513513
"doc",
514514
"test"
515515
]
516+
},
517+
{
518+
"login": "dhiraj-ms",
519+
"name": "Dhiraj Srivastava",
520+
"avatar_url": "https://avatars.githubusercontent.com/u/39856917?v=4",
521+
"profile": "https://github.com/dhiraj-ms",
522+
"contributions": [
523+
"code",
524+
"doc",
525+
"test"
526+
]
516527
}
517528
],
518529
"contributorsPerLine": 7,

.github/workflows/continuous-integration.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: Install dependencies
3232
run: |
3333
python -m pip install --upgrade pip
34-
pip install flake8 pytest pytest-cov
34+
pip install flake8 pytest pytest-cov ipython
3535
pip install -r requirements.txt
3636
- name: Lint with flake8
3737
run: |
@@ -42,7 +42,7 @@ jobs:
4242
- name: Test and generate coverage report
4343
# Run coverage analysis on pytest tests
4444
run: |
45-
python setup.py install
45+
pip install .
4646
py.test --cov-report=xml --cov=plantcv tests/
4747
- name: Upload coverage to Codecov
4848
uses: codecov/codecov-action@v3

.github/workflows/publish-package.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Install dependencies
2424
run: |
2525
python -m pip install --upgrade pip
26-
pip install pytest
26+
pip install pytest pytest-cov ipython
2727
pip install -r requirements.txt
2828
- name: Cross-platform tests
2929
run: |

LICENSE

+373-21
Large diffs are not rendered by default.

MANIFEST.in

-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,3 @@ include versioneer.py
22
include plantcv/plantcv/_version.py
33
include requirements.txt
44
include LICENSE
5-
include plantcv-train.py
6-
include plantcv-utils.py
7-
include plantcv-workflow.py

README.md

+7-6
Large diffs are not rendered by default.

docs/CONTRIBUTING.md

+77-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
# How to contribute
1+
# Table of Contents for Contibution
2+
1. [Overview of Contribution](#overview)
3+
2. [Creating Issues](#creatingissues)
4+
3. [Contributing Text or Code](#textcode)
5+
* [Set-Up Development Environment](#devenvironmment)
6+
* [Clone the Source Code](#clone)
7+
* [Install PlantCV dependencies](#install)
8+
* [Create a Branch](#branch)
9+
* [Work and Commit](#commit)
10+
* [Testing and documenting your code](#testdoc)
11+
* [Publish and Create Pull Request](#publish)
12+
4. [Guidelines for New Features](#newfeatures)
13+
* [New Function Style Guide](#style)
14+
5. [Instructions for Adding A New Tutorial](#tutorial)
15+
* [Create Your Tutorial Repository](#repo)
16+
* [Add Your Tutorial to the Gallery Wall](#gallery)
17+
18+
## Overview Of What To Contribute <a name="overview"></a>
219

320
This document aims to give an overview of how to contribute to PlantCV.
421
We encourage contributions in a variety of forms. There are
@@ -14,10 +31,11 @@ There are many ways to contribute:
1431
* Add unit tests
1532
* Revise existing code
1633
* Add or revise documentation
34+
* Add, update, or revise a use-case tutorial
1735

1836
If you need any help, please contact us.
1937

20-
## Creating Issues
38+
## Creating Issues <a name="creatingissues"></a>
2139

2240
- Make sure you have a GitHub account.
2341
- Search GitHub and Google to see if your issue has already been reported
@@ -27,21 +45,19 @@ If you need any help, please contact us.
2745
- Make sure you fill in the earliest version that you know has the issue.
2846
- Where applicable, provide the full workflow prior to the error and the image getting analyzed.
2947

30-
## Contributing Text or Code
31-
32-
### Overview
48+
## Contributing Text Or Code <a name="textcode"></a>
3349

3450
When you add a significant **new feature**, please create an issue
3551
first, to allow others to comment and give feedback.
3652

37-
When you have created a new feature or other changes to existing
53+
**Adding Or Changing Code** When you have created a new feature or other changes to existing
3854
code, create a 'pull request'.
3955

40-
**Branching and Pull Requests**: All contributors to PlantCV code or documentation are required to use the
56+
**Branching And Pull Requests**: All contributors to PlantCV code or documentation are required to use the
4157
*feature branch workflow* (below) in order to allow pull
4258
requests, automated testing, and code review.
4359

44-
### Setting up a development environment
60+
### Setting Up A Development Environment <a name="devenvironmment"></a>
4561

4662
!!! note
4763
Before setting up a development environment, choose between one of two methods for working with the PlantCV
@@ -50,18 +66,18 @@ requests, automated testing, and code review.
5066
request to be added as a collaborator on the PlantCV repository so that you can work with it directly instead of
5167
having to manage a separate repository.
5268

53-
#### Clone the source code from GitHub
69+
#### Clone The Source Code From GitHub <a name="clone"></a>
5470

5571
After choosing a method above for accessing PlantCV source code, create a clone of the source code GitHub repository
5672
using one of the methods described in the
5773
[GitHub cloning a repository guide](https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/cloning-a-repository).
5874

59-
#### Install PlantCV dependencies
75+
#### Install PlantCV Dependencies <a name="install"></a>
6076

6177
We recommend using `conda` to set up a virtual environment for developing PlantCV. Instructions can be found in the
6278
[installation documentation](installation.md#installation-from-the-source-code).
6379

64-
#### Create a branch to do your work
80+
#### Create A Branch To Do Your Work <a name="branch"></a>
6581

6682
The PlantCV default branch is protected and does not allow direct modification. A better practice is to
6783
[create a branch](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-branches)
@@ -70,12 +86,12 @@ number. This makes it easier to find out the issue you are trying to solve and h
7086
the branch. Calling a branch my-work is confusing. Names of branch can not have a space, and should be replaced with
7187
a hyphen.
7288

73-
#### Work and commit
89+
#### Work And Commit <a name="commit"></a>
7490

7591
Do your work and commit as you see fit to check your work into your branch. Descriptive commit messages and
7692
descriptions are helpful for understanding the purpose of changes.
7793

78-
#### Testing and documenting your code
94+
#### Testing And Documenting Your Code <a name="testdoc"></a>
7995

8096
In addition to adding a new feature, test your code thoroughly:
8197

@@ -87,18 +103,18 @@ the coverage the more likely we are to catch problematic pull requests). To incl
87103
tests (to make sure they aren't broken by future pull requests) we need a 'unit test' or set of 'unit tests' (if you
88104
need more than one test to cover function options).
89105

90-
Existing unit tests can be found in `tests/tests.py` as examples.
91-
The data to support unit tests can be found in the `tests/*data/` directories.
106+
Existing unit tests can be found in `tests/` as examples.
107+
The data to support unit tests can be found in the `tests/testdata/` directory.
92108

93-
If you are updating existing code, make sure that the `test.py`
94-
script passes on the function you modified. Testing locally can be done with pytest:
109+
If you are updating existing code, make sure that the test(s) pass on the function you modified.
110+
Testing locally can be done with pytest:
95111

96112
```bash
97-
pytest tests/tests.py
113+
py.test --cov=plantcv
98114

99115
# Or you can just run a subset of tests to save time
100116
# This will run all tests with "analyze" in the test name
101-
pytest tests/tests.py -k analyze
117+
py.test --cov=plantcv -k analyze
102118

103119
```
104120

@@ -108,11 +124,11 @@ be added to the `mkdocs.yml` file. You can test that your new documentation can
108124
mkdocs from the root of your local plantcv repository.
109125

110126
```bash
111-
mkdocs build --theme readthedocs --site-dir _site
127+
mkdocs serve --theme readthedocs
112128

113129
```
114130

115-
#### Publish your branch to GitHub and create a Pull Request
131+
#### Publish Your Branch To GitHub And Create A Pull Request <a name="publish"></a>
116132

117133
[Publishing your branch](https://docs.github.com/en/free-pro-team@latest/desktop/contributing-and-collaborating-using-github-desktop/managing-branches#publishing-a-branch)
118134
to GitHub will make it available for creating a pull request between the updates and the default branch of PlantCV.
@@ -128,7 +144,7 @@ will automatically update when the branch is updated. Once tests pass, coverage
128144
review is approved, the branch will be merged with the default branch and the updates are now part of the latest
129145
version of PlantCV!
130146

131-
### Guidelines for adding new features
147+
### Guidelines For Adding New Features <a name="newfeatures"></a>
132148

133149
In general, new contributions to PlantCV should benefit multiple users
134150
and extend the image processing or trait analysis power of PlantCV.
@@ -147,7 +163,7 @@ We do hope that if you are contributing new methods to PlantCV, you are also con
147163
tests for your functions (described below), because you understand your code/functionality best. If you have questions
148164
or need help don't hesitate to ask [here](https://github.com/danforthcenter/plantcv/issues).
149165

150-
#### New function style guide
166+
#### New function Style Guide <a name="styleguide"></a>
151167

152168
Include commenting whenever possible.
153169

@@ -263,6 +279,44 @@ def new_function_calling_plantcv(img):
263279

264280
```
265281

282+
### Instructions for Adding A New Tutorial <a name="tutorial"></a>
283+
284+
We are always looking for new examples of how people are applying
285+
PlantCV to their research. You can send us a Jupyter Notebook and any required sample data or
286+
you can directly contrubute your tutorial. These instructions also apply to updating existing tutorials
287+
that might break wth new versions of PlantCV.
288+
289+
#### Create Your Tutorial Repository <a name="repo"></a>
290+
291+
1. Create a new repository on GitHub (Please consider creating your repo within an instituional account rather than a personal account e.g. Danforth Center). The name should start with plantcv-tutorial. When you make this repo you can use the option to import the tutorial template from `https://github.com/danforthcenter/plantcv-tutorial-template`
292+
293+
2. If you don't import the tutorial template when you make your repo intitally you can clone the [tutorial template repository](https://github.com/danforthcenter/plantcv-tutorial-template) and copy the files and folders from the template repository to your tutorial repository
294+
295+
3. Update the `README` and `index.ipynb` files with your tutorial content, including data (make sure you are updating or using the correct documentation branch, e.g. release-4.0)
296+
297+
4. Add an image called `tutorial_card.png` to the repo, this will be used on the gallery webpage. The image should be approximately square and have a width of 200px.
298+
299+
5. Follow the instructions to create a Binder button in the readme
300+
301+
6. Commit the changes to your tutorial github repository
302+
303+
7. Go to your repo online and test the 'Launch Binder' button for your repo
304+
305+
#### Add Your Tutorial To the PlantCV Tutorial Gallery <a name="gallery"></a>
306+
307+
1. In your PlantCV repo make a new branch (make sure your branch is based off the version you are working on e.g. release-4.0)
308+
309+
2. Go to `/plantcv/docs/tutorials.md`, add a section for your new tutorial or update the binder links and link to your tutorial wall image
310+
311+
3. Either go to `/plantcv/docs/tutorials/'yourtutorialname'` and update the binder links and nb viewer links for your tutorial or go to `/plantcv/docs/tutorials/`
312+
and add a doc with your tutorial name (use an exisiting tutorial as an example)
313+
314+
4. While in your plantcv directory check the build of the documentation on the command line by the command:
315+
```
316+
mkdocs serve --theme readthedocs
317+
```
318+
5. If everything looks okay then commit changes and make a pull request (make sure that pull request is for the for version you are working on).
319+
266320
### Thanks
267321

268322
Parts of this contribution guide are based on the

docs/Points.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
## Interactive Point Annotation Tool
2+
3+
Using [Jupyter Notebooks](jupyter.md) it is possible to interactively click to collect coordinates from an image, which can be used in various downstream applications. Left click on the image to collect a point. Right click removes the
4+
closest collected point.
5+
6+
**plantcv.Points**(*img, figsize=(12, 6)*)
7+
8+
**returns** interactive image class
9+
10+
- **Parameters:**
11+
- img - Image data
12+
- figsize - Interactive plot figure size (default = (12,6))
13+
14+
- **Attributes:**
15+
- points - Coordinates (x,y) of the collected points as a list of tuples
16+
17+
- **Context:**
18+
- Used to define a list of coordinates of interest.
19+
- For example the [`pcv.roi.custom`](roi_custom.md) function defines a polygon Region of Interest based on a list of vertices, which can be labor intensive to define but is streamlined with the ability to click for point collection.
20+
- The list of vertices output has also shown to be helpful while using [pcv.roi.multi](roi_multi.md) in cases where centers are defined with a custom list of vertices.
21+
- **Example use:**
22+
- Below
23+
24+
25+
```python
26+
from plantcv import plantcv as pcv
27+
28+
# Create an instance of the Points class
29+
marker = pcv.Points(img=img, figsize=(12,6))
30+
31+
# Click on the plotted image to collect coordinates
32+
33+
# Use the identified coordinates to create a custom polygon ROI
34+
roi_contour, roi_hierarchy = pcv.roi.custom(img=img, vertices=marker.points)
35+
36+
```
37+
38+
**Selecting Coordinates**
39+
40+
![screen-gif](img/documentation_images/annotate_Points/custom_roi.gif)
41+
42+
**Resulting ROI**
43+
44+
![Screenshot](img/documentation_images/annotate_Points/custom_roi.jpg)
45+
46+
47+
**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/classes.py)

docs/acute_vertex.md

-47
This file was deleted.

docs/analysis_approach.md

+9-11
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ to demonstrate how modules can be used. Keep in mind that modules can be linked
4242
configurations to meet image processing goals so the tutorials simply examples of a few approaches:
4343

4444
* [VIS Image Workflow](tutorials/vis_tutorial.md)
45-
* [NIR Image Workflow](tutorials/nir_tutorial.md)
45+
* [Grayscale Image processing](tutorials/grayscale_tutorial.md)
4646
* [PSII Workflow](tutorials/psII_tutorial.md)
4747
* [VIS / NIR Dual Workflow](tutorials/vis_nir_tutorial.md)
4848
* [Multi Plant Tutorial](tutorials/multi-plant_tutorial.md)
@@ -97,16 +97,13 @@ likely be some 'noise' (non-target-object spots) in the image. Those can be fill
9797
#####Region of Interest
9898

9999
* To further isolate an object from surrounding background a region of interest can be used to select the region of
100-
the image that contains the target object. To do this you first [detect all the objects](find_objects.md) in the image,
101-
then define the [region of interest](roi_rectangle.md), then determine if the objects are within, touching, or outside of
102-
the region of interest with the [`roi_objects` function](roi_objects.md).
100+
the image that contains the target object. To do this you first define the [region of interest](roi_rectangle.md), then filter
101+
the objects that are within, touching, or outside of the region of interest with the [`roi.filter` function](roi_filter.md).
103102

104103
#####Connecting Objects or Splitting Objects
105104

106105
* Once the target object or objects are segmented you then need to decide if it is desirable to connect or split the
107106
objects.
108-
* Even if there is a single plant in an image it may be detected as multiple objects, in which case it may need to be
109-
joined or composed together using the [object composition function](object_composition.md).
110107
* If there are multiple plants in an object and you would like to analyze them individually (get shape parameters for
111108
each plant for example) then there are functions in PlantCV to split the image apart so there is a single target object
112109
in each sub-image. For more information on this process see the [Multi Plant Tutorial](tutorials/multi-plant_tutorial.md).
@@ -115,13 +112,14 @@ in each sub-image. For more information on this process see the [Multi Plant Tut
115112

116113
These are the general categories of object analysis that are available in PlantCV
117114

118-
* Object shape parameters: see the [analyze shape](analyze_shape.md) and [analyze bound](analyze_bound_horizontal.md) functions.
119-
* Object color or other signal intensity values: see the [analyze color](analyze_color.md),
120-
[analyze NIR](analyze_NIR_intensity.md), [analyze thermal](analyze_thermal_values.md),
121-
and [analyze FvFm](photosynthesis_analyze_fvfm.md) functions.
115+
* Object shape parameters: see the [analyze.size](analyze_size.md), [analyze.bound_horizontal](analyze_bound_horizontal2.md),
116+
and [analyze.bound_vertical](analyze_bound_vertical2.md) functions.
117+
* Object color or other signal intensity values: see the [analyze.color](analyze_color2.md),
118+
[analyze.grayscale](analyze_grayscale.md), [analyze.thermal](analyze_thermal.md),
119+
and [analyze.yii](analyze_yii.md) functions.
122120
* Object classification (For example, classification of disease symptoms, identification of organ structures
123121
[naive-bayesian multiclass mode](naive_bayes_multiclass.md)).
124-
* Object hyperspectral parameters: see the [analyze spectral](analyze_spectral.md) and [analyze index](analyze_index.md) functions.
122+
* Object hyperspectral parameters: see the [analyze.spectral_reflectance](analyze_spectral_reflectance.md) and [analyze.spectral_index](analyze_spectral_index.md) functions.
125123
* Morphological parameters: see the [morphology tutorial](tutorials/morphology_tutorial.md) for examples of characteristics such as stem height,
126124
leaf length, and leaf angle.
127125

0 commit comments

Comments
 (0)