Updating PlantCV

The general procedure for updating PlantCV if you are using the master branch cloned from the danforthcenter/plantcv repository is to update your local repository and reinstall the package.

If you are not sure that you have cloned the danforthcenter/plantcv repository and are on the master branch, here is how you can tell:

cd plantcv

git remote -v

# You should see something like:
# origin    https://github.com/danforthcenter/plantcv.git (fetch)

git status

# You should see:
# On branch master
# nothing to commit, working directory clean

If the above is true, updating can be done simply by:

git pull

python setup.py install

# Or with sudo if needed

If you have put the cloned plantcv repository folder in your PYTHONPATH then pulling alone is enough to update.

Updating from v1 to v2

The setuptools installation method was not available in PlantCV v1, so users put the plantcv/lib directory in their custom PYTHONPATH. In PlantCV v2, the plantcv library directory is no longer in the lib directory, now it is in the main repository folder (plantcv/plantcv). If you want to continue to have plantcv in your PYTHONPATH you will need to update by simply removing lib from the path. You can also remove the lib folder after pulling the new version. Git will automatically remove the *.py files but because we do not track the *.pyc files they will remain behind and can technically be imported, which can cause confusion.

For Linux/Unix, PYTHONPATH can be edited in ~/.bash_profile, ~/.bashrc, ~/.profile, ~/.cshrc, ~/.zshrc, etc. For Windows, right-click on My Computer/This PC and select Properties > Advanced system settings > Environmental Variables... and edit the User variables entry for PYTHONPATH.

Also note that the method for parallelizing PlantCV has changed, please see the new parallel processing documentation for more details.

Updating to v3

In addition to new features a major goal ov PlantCV v3 is to make PlantCV functions a little bit easier to use. We hope you agree the changes detailed below succeed in that goal, but if you have any questions or concerns please feel free to open an issue on GitHub or contact us directly.

In order to support the installation of optional add-on subpackages, we converted PlantCV to a namespace package. To achieve this new functionality, existing functions had to be moved into a subpackage to maintain easy importing. To maintain previous behavior, PlantCV analysis scripts simply need to have updated PlantCV import syntax. So if you were previously doing something like:

import plantcv as pcv

You would now do this instead:

from plantcv import plantcv as pcv

Another feature we will be rolling out for PlantCV v3 an update to the existing package API. The goal is to make each PlantCV function easier to use by reducing the number of inputs and outputs that need to be configured (without losing functionality) and by making input parameters more consistently named and clearly defined where input types matter (e.g. instead of just img it could be rgb_img, gray_img, or bin_img for RGB, grayscale, or binary image, respectively).

In PlantCV v3.0dev2 onwards, all functions were redesigned to utilize a global parameters class to inherit values for standard inputs like debug and device so that these values will not need to be explicitly input or output to/from each function. An instance of the class Params as params is created automatically when PlantCV is imported and it can be imported to set global defaults. For example, to change debug from None to 'plot' or 'print' you can now just add one line to the top of your script or notebook to change the behavior of all subsequent function calls:

from plantcv import plantcv as pcv
pcv.params.debug = "plot"

Therefore, all function calls need to be updated to remove the device input and output variables and the debug input variable. For example:

from plantcv import plantcv as pcv
pcv.params.debug = "plot"

img, img_path, img_filename = pcv.readimage("image.png")

gray_img = pcv.rgb2gray_hsv(img, "s")

bin_img = pcv.threshold.binary(gray_img, 100, 255)

For more information, see the Params documentation.

Below is an overview of all updates that are required to convert a pre-v3.0dev2 function call to a post-v3.0dev2 function call. See the individual function help pages for more details on the input and output variable types.

plantcv.acute

plantcv.acute_vertex

plantcv.adaptive_threshold

plantcv.analyze_nir_intensity

plantcv.analyze_bound

plantcv.analyze_bound_horizontal

plantcv.analyze_bound_vertical

plantcv.analyze_color

plantcv.analyze_object

plantcv.apply_mask

plantcv.auto_crop

plantcv.background_subtraction

plantcv.binary_threshold

plantcv.cluster_contour_splitimg

plantcv.cluster_contours

plantcv.crop_position_mask

plantcv.define_roi

plantcv.dilate

plantcv.distance_transform

plantcv.erode

plantcv.fill

plantcv.find_objects

plantcv.flip

plantcv.fluor_fvfm

plantcv.gaussian_blur

plantcv.get_nir

plantcv.hist_equalization

plantcv.image_add

plantcv.invert

plantcv.landmark_reference_pt_dist

plantcv.laplace_filter

plantcv.logical_and

plantcv.logical_or

plantcv.logical_xor

plantcv.median_blur

plantcv.naive_bayes_classifier

plantcv.object_composition

plantcv.otsu_auto_threshold

plantcv.output_mask

plantcv.plot_hist

plantcv.plot_image

plantcv.readimage

plantcv.rectangle_mask

plantcv.report_size_marker_area

plantcv.resize

plantcv.rgb2gray

plantcv.rgb2gray_hsv

plantcv.rgb2gray_lab

plantcv.roi.circle

plantcv.roi.ellipse

plantcv.roi.from_binary_image

plantcv.roi.rectangle

plantcv.roi_objects

plantcv.rotate

plantcv.rotate_img

plantcv.scale_features

plantcv.scharr_filter

plantcv.shift_img

plantcv.sobel_filter

plantcv.threshold.binary

plantcv.threshold.gaussian

plantcv.threshold.mean

plantcv.threshold.otsu

plantcv.threshold.triangle

plantcv.transform.apply_transformation_matrix

plantcv.transform.calc_transformation_matrix

plantcv.transform.correct_color

plantcv.transform.get_color_matrix

plantcv.transform.get_matrix_m

plantcv.transform.load_matrix

plantcv.transform.save_matrix

plantcv.triangle_auto_threshold

plantcv.watershed_segmentation

plantcv.white_balance

plantcv.x_axis_pseudolandmarks

plantcv.y_axis_pseudolandmarks