CellProfiler / CellProfiler-plugins

Community-contributed and experimental CellProfiler modules.
http://plugins.cellprofiler.org/
56 stars 67 forks source link

Transform processing error using 'Haar Wavelet transform' choice #111

Closed imoutsatsos closed 3 years ago

imoutsatsos commented 3 years ago

Trying to execute a CHARM pipeline using CP v4.0.6 running on windows. This is a CHARM pipeline originally developed under CP v2.2 and contains several transform modules. The modules have been updated from the most recent version of the 'CellProfiler-plugins' git repository and seem to work until I try to apply a 'Haar Wavelet transform'

The pipeline then throws the following error:

image

The CP console reports more error details. image

DavidStirling commented 3 years ago

Looks like an integer division error on this line:

https://github.com/CellProfiler/CellProfiler-plugins/blob/8cec9ae4b8219cfe2a518ed1837b8e037804ac11/CellProfiler4_AutoConvert/transformfilters.py#L300

Would you be able to try changing it to m=len(colin)//2? You may want to do the same on Line 310.

imoutsatsos commented 3 years ago

@DavidStirling thanks for the feedback. I got a bit confused though. Are you suggesting changing from 'rownin' to 'colin' for 300 and 310 in addition to introducing integer division (using //) Originally I was only trying to correct for the python type error. Not sure I understand what the other changes would do. Similar divisions also occur on other lines (2 for 'rowin' L300, L364 and 2 for 'colin' L310, L354) Please, advise. Thanks

DavidStirling commented 3 years ago

@imoutsatsos Sorry, my mistake - I'd originally copied L310 as the example. The change is the operator, not the variable.

The issue here is that in Python 2 the / operator would perform integer division (5 / 2 = 2), whereas in Python 3 this produces a float (5 / 2 = 2.5). In Python 3 integer division can be performed using the // operator instead. The int statements in your original PR also work, but it's more efficient to just replace the operator.

DavidStirling commented 3 years ago

Fixed by #113