This year, we wrote a series of software for our project including colony radius calculation software, mathematical modelling software, device demo software and the core BioPaFiAR software (driver for the BioPaFiAR hardware device). Now we will introduce them one by one.
1. Colony radius calculation software
In this project, the specific pattern of bacteria is formed by controlling the motility of bacteria. So the first step of this project is validating the difference of motility. In experiment, the motility can be represented by the size of bacteria colony. So we write a sequential photography program, and it can be used to take a photo every 15 minutes combined with Raspberry Pi computer. After getting these pictures, we need to measure the diameter of colony. If measured manually, it will be a huge amount of workload. So we write a Python program to help us.
It is semi-automatic software and can be used in sequential photography. When this program is running, you can see the GUI like Figure 1A; the Python shell window is also useful for you to see the measure result (Figure 1B). You need two pictures as the input to this program. The first picture is the starting point in the picture sequences and the second picture is one you want to measure.
Warning: camera and the target object cannot be moved after shooting begins and the ambient light must be Invariant.
Figure 1. Colony radius calculation software.
1. After running this program, click the min track bar and move the mouse. You can see that the following window will change. The white parts are colonies. Move the track bar until the colony you want to measure looks the best (clearest).
2. After the adjustment, click the left mouse button and move mouse to choose the colony you want. The selection box is a green box.
3. After choosing a colony, the area will be shown in the litter window. If there is no other colony in the window, you can press “Enter” to calculate the diameter of the colony. The result will be shown in the Python shell window. See Figure 1B.
4. Press “Esc” to quit this program.
You can click here to download this software.
2. Motility dynamic model software
Based on the dynamic model, we package the modeling program into a software with a GUI. The program is coded using Python 2.7 and the GUI is created using traits/traitsUI. The image processing is performed using OpenCV-python interface and the result is displayed by Mayavi. Figure 2 shows the GUI of this software.
Figure 2. Motility dynamic model software.
1. Run this software.
2. Click the yellow folder shape icon in the back of “Choose File” to select a target image.
3. Adjust the parameter values including k, r, ps and time.
4. Choose a display mode (2D or 3D).
5. Click “ok” button to solve PDE. The result will be shown in the bottom window. If you are interested in this program, you can download it by clicking here.
3. Colony motion simulation software
We used cellular automaton model to simulate the bacteria colony pattern formation to guide experiment design in our project. The software for cellular automaton modelling was developed based on the platform of Matlab 2014a. The GUI of this software is shown in Figure 3 and its usage is as the following steps.
Figure 3. The GUI for the colony motion simulation software.
The steps for using this software:
1. Open the program.
2. Click the "load" button in the interface and import your target image.
3. Select a point in the area of the target image as the initial location of the bacteria.
4. Click the "run" button to start the program.
5. Click the "stop" button to suspend the program and view the current running status.
6. You can also select another position to inoculate during running, so that the shape of the colony can grow into the target image faster.
7. Click the "quit" button to exit the program.
4. Device demo software
Putting the bacteria in our AR environment, a system is needed to ensure the light signals from a computer is accessible to our cells. So we have designed a device to guide the formation of bacteria colony pattern. You can see our hardware part for more details. For people to better understand our device, we build a device demo software.
This software was developed in Blender which is is a professional free and open-source 3D computer graphics software used for creating animated films, visual effects, art design, 3D printing models, interactive 3D applications and video games. The device demo software was output by a Blender add-on “Save As Game Engine Runtime” as an executable file. This software can only be run in the Microsoft Windows system. You can click here to download this software or click here to download the source files.
Movie 1. Hardware device demo.
If you want to use it, the operation steps are as follows:
Double-click “hardware.exe” to run this software. Press “A” to rotate the scene to the left and press “D” to rotate it to the right. Click mouse left button to open the door and click again to close it. Roll up the mouse wheel to get closer to the scene or roll down to get away from the scene. Press “Esc” to quit the program.
5. The core BioPaFiAR software (Driver for the BioPaFiAR hardware device)
In this project, light signals from the projector will be used to change the motion state of bacteria. And the light signals are generated by a computer which also collects the bacteria colony image by a camera. So, we need a program to coordinate the work between projector and camera. At first, the program can read the image from the camera. We use OpenCV-python to control camera and process the image. After reading image from the camera, we need to separate the colony from background. Because the huge amount of reflected light from the dish wall will interfere the separation process, we need to find a new way to do it.
Guiding bacteria to form a specific pattern needs to culture bacteria continually. Meanwhile, besides the colony area, the illumination condition of the rest area is invariable. So, we can get the image of colony area by subtracting the previous picture from the subsequent picture. Based on this idea, we save a picture into computer memory before the colony appears; when the colony appears, we can get a image from the camera; convert them to gray mode and separate them by proper threshold; subtract the former from the latter; then we can get the colony. Usually, we need to remove some noises induced by the camera during insufficient lighting.
After the above treatment, we can get a black and white image. We can use canny algorithm to detect edge and use dilation operator to expand edge. But how to combine with the target image? Bitwise "and" operation can be used in the dilated image and the target image. Then, we convert the 255 values (white part in the image) to green color and 0 values (black part in the image) to red color, and save it as an RGB image. The resultant image is displayed in the full screen mode, and the projector will copy and shed it onto the bacteria colony in he culture medium.
Figure 4. Illustration for the working process of the BioPaFiAR software.