Identify Dead Worms Error

Hi,

I am trying to repurpose some of the Worm Toolbox features to use in a zebra fish assay I am developing. My hope is to use the IdentifyDeadWorms module to help me identify healthy zebra fish, since in my assay the fish are straight when healthy but curl up when sick. I am able to get good primary object recognition and convert the object to an image as stated in the help manual, but when I run the IdentifyDeadWorms I get the following error. Any ideas?

Traceback (most recent call last):
File “/cc/release_10953/CellProfiler/cellprofiler/pipeline.py”, line 309, in run
File “/cc/release_10953/CellProfiler/cellprofiler/modules/identifydeadworms.py”, line 157, in run
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.5/scipy/ndimage/morphology.py”, line 394, in binary_erosion
File “/Applications/CellProfiler2.0.app/Contents/Resources/lib/python2.5/scipy/ndimage/morphology.py”, line 250, in _binary_erosion
MemoryError

Thanks,
-Joe

Hi Joe,

Could you upload your pipeline and an example image where this error occurs?

Regards,
-Mark

Hi Mark,

I’ve attached the pipeline that I have built and a sample image that I have been running through it.

Thanks for your help!

-Joe


2011-11-11_Zfish_Object_Identification_Pipeline.cp (5.9 KB)

I’ve managed to successfully get through IdentifyDeadWorms by adjusting the settings appropriately, with the width as 70 and the length as 100 based on your image. Be warned, this module can take a long time to process. If possible you may want to consider using the Resize module to downsample the output of ConvertObjectsToImage and using the IdentifyDeadWorms on the resized image.

Regards,
-Mark

Hi Mark,

Thank you for the tip. You are right, by adjusting the dimensions to 70 width 100 length, the pipeline runs to completion without error. However, I’m a little confused because I’m not sure what the Identify Dead Worms module is doing, I’ve attached an image of the output, and it looks very similar to the ‘Identify Primary Objects’ output. I was expecting this module to score which fish the algorithm thinks are dead worms and which it does not. Does this scoring have to happen elsewhere? Or are all the objects displayed ones it thinks are dead worms?

Thank you for your help,
-Joe


Hi,

A few more adjustments to your pipeline: Try adjusting the width to 5 and the length 75, and you should see a more understandable result. For the fish that are straight enough, you will see a colored object embedded within the shape (see screenshot). The object can be used as a seed for further object detection in IdentifySecondaryObjects. If you are interested in a simple count of straight objects, the module outputs that number as well.

Regards,
-Mark


Hi Joe,
I really like the idea of using the ‘FindDeadWorms’ module for Zebrafish, especially as I’ve been involved in developing the module :smile:. Do you have any images of dead fish for comparison? You may want to run some morphological closing on your binary images before searching for straight shapes as small holes within the binary image of the fish will prevent the straight template from fitting. Note that the longer the shape you try to fit within the objects is, the better discrimination you will get between straight and curled objects. I also agree with Mark that sub-sampling may be a good idea to make things run faster. I also added the ‘IdentifySecondaryObjects’ suggested by Mark in the attached pipeline (including subsampling and morphological closing). I’d love to hear how things work out for you!
Cheers
Carolina



2011-11-16_Zfish_Object_Identification_Pipeline.cp (6.88 KB)

Hi Carolina,

Thank you for the suggestions. Using the ‘Morph’ module to close the binary image objects and resizing the image definitely helps the pipeline run faster and smoother. It also solved an ‘array is too big’ error that I had been getting with some of the images.

I am running a treatment on some fish today and I will have some images to share in the next day or so. I really appreciate your interest. I think that the ‘Worm Toolbox’ you and your colleagues have developed could be very useful for zebra fish analysis.

Thanks,
-Joe

Hi Joe,
I’d love to bring some attention to the methods through a short joint technical image analysis paper on ‘critter classification’. Feel free to contact me at carolina@broadinstitute.org if you’re interested.
Cheers
Carolina