Resize objects problem when odd number of pixels

I have quite large images to analyse in 3D, so to improve analysis time I have been using the resize module (0.5x as suggested in the tutorial However, when the original image has an odd number of pixels in a dimension (i.e, 1170x971 vs 1170x972) you can not overlay the resized objects (2x) on the original image:

Failed to run module OverlayObjects
Traceback (most recent call last):
File “CellProfiler\cellprofiler\gui\”, line 2887, in do_step
File “CellProfiler\cellprofiler\”, line 2022, in run_module
File “CellProfiler\cellprofiler\modules\”, line 70, in run
File “CellProfiler\cellprofiler\”, line 961, in run
File “CellProfiler\cellprofiler\modules\”, line 67, in
File “CellProfiler\cellprofiler\”, line 974, in overlay_labels
File “site-packages\skimage\color\”, line 114, in label2rgb
File “site-packages\skimage\color\”, line 159, in _label2rgb_overlay
ValueError: image and label must be the same shape

I figure it has rounded the pixels on the initial resize and then doubling this factor in the resizeObjects module always leads to an even pixel count. Is there a workaround to this or will I need to ensure all my images have an even pixel count on the XY axes?


Resize and ResizeObjects will allow you to specify the output dimensions, so you could set it manually to 1170x971.

Thanks for the feedback. This strategy would not work when dealing with multiple images of different pixel sizes though. Is there a workaround to this for batch processing?
I may just have to skip the resize function if not.

You can resize images (though I don’t believe objects, yet) to be the same size as some other image- ie back to the original input image. If you want, you can make a request for that functionality to be added to ResizeObjects here.