Blood Smear Differential Demo

Ive been posting a for few years about working on a blood smear analysis tool using openflexure. After some trial and error and lots of advice from other forum members, I have an extension for the microscope v3 that is a kind of successor to:

I set it up to move outward in a spiral and center each of the white blood cells in the field to get an image with minimal chromatic aberration. Each cell image is then send to gui where you can reclassify and get a report of the results.

The method of capture is a work in progress. I didn’t have great results with the auto focus, so it often has to be repeated. Maybe because of the lack of sharp detail in red blood cells? As you can see in the video there is an excess of duplicate captures of the same white blood cell. It needs further expansion of the spiral distance to avoid duplicate white blood cells. The way I set up the centering has some inherent problems with a lack of identity for each object, so duplication is somewhat inevitable. In the future I probably have to switch to a object tracking method instead of only object detection to avoid this problem.

It is powered by two yolov5 models through the ultralytics pytorch models. One model identifies white blood cells even low quality images. It is trained on single class images, including out of focus images and cells on the periphery of the field with major chromatic aberration. This model is used to center the stage. A second model is classify the cells and is trained on centered quality images.

Demo Clip:

1 Like

Really cool @Nico!

How many images do you take in z? If you do a z-stack in each location can you then see which is the sharpest?

1 Like

Thanks

I just take one image once the autofocus is verified to meet a certain threshold.

Is there a z stack function?

I have trouble with repeatability of very low step movements. For example if I move up 20 times in increments of 50 steps. Then move down 1000 steps I do not end up at the same spot on the z axis. Not sure if this is expected behavior or signs of a defective motor?

A reversal in direction will always be affected by backlash, when the motor reverses direction it has to take up all the slack in the gears before there is motion again. If you overshoot so you always approach in the same direction this should wipe out the backlash.

The backlash will be reduced in the next version as we noticed that there was some backlash between the gear and the lead screw.

@JohemianKnapsody is there a built in way to do the z-stacks in v3, or is it currently sitting in a branch?

Thanks for the advice. I could try something like autofocus, move up 300 steps, then move down in increments of 30 steps 15 times and take an image at each location then find the sharpest image?

Hi Nico, Thanks for sharing on here, like I said this looks like a great project! Doing a smart z-stack is currently in a branch that’s nowhere near ready to merge, but when it is, it’ll speed things up a lot for you. Rather than autofocusing, moving away, then stacking back through focus (which will work, given enough time), smart stack deliberately undershoots during the autofocus, then carries on doing the z stack in the same direction. I think I could probably add this as a Thing for you to use without too much work, although I’d need @j.stirling’s input on best practices.

So what works best for you? Depends whether you’d want to wait on us, or add it yourself quickly and we can go through it later?

1 Like

Thanks Joe,

We did say that your experimental branches need splitting up into simple smaller merge requests for review and merge. So if you could split out the z-stack code into a branch, that may help @Nico, and any feedback from Nico will help as we review the code.

1 Like