danforthcenter / plantcv

Plant phenotyping with image analysis
Mozilla Public License 2.0
665 stars 265 forks source link

threshold.custom_range outputs and CMYK #1604

Open annacasto opened 1 month ago

annacasto commented 1 month ago

Describe the bug When we used pcv.threshold.custom_range and only defined one output (I think it's expecting 2), it didn't give an error, but it returns a tuple that you then can't use as a mask downstream. It's obviously not how the function is supposed to be used, but it was not intuitive that there was no error but the output of custom_range wasn't useable as a mask. custom_range also doesn't currently support CMYK colorspaces.

To Reproduce

  1. Read in a grayscale image.
  2. Convert to V channel in HSV colorspace.
  3. Threshold using threshold.custom_range but only define one output.
  4. Printing type(mask) shows "tuple" and there is no error about expecting 2 outputs.

Expected behavior I think generally pcv functions throw an error if a user mistakenly defines the wrong number of outputs for a function.

Local environment (please complete the following information):

Additional context Add any other context about the problem here.