Software
This year, we write a series of software for our project including colony radius calculation software, mathematical model 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.
Procedures:
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.
Procedures:
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 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 of the colony motion simulation software.
The steps for using this program:
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 signal from computer is accessible to our cell. So we have designed a device to lead the formation of colony pattern. You can see our hardware part to see more detail. In order to demonstrate our device more conveniently, we build a device demo software to show our device.
This soft was made in blender which is is a professional free and open-source 3D computer graphics software product used for creating animated films, visual effects, art, 3D printed models, interactive 3D applications and video games. And it was output by blender add-on “Save As Game Engine Runtime” as an executable file. This software is only applicable to the windows system. You can click here to download this soft or click here to download source files.
Movie 1. Device demo
If you want to use it, the operation is as follows:
Double-clicking “hardware.exe” to run this software. Press “A” to rotate the scene to left and press “D” to rotate to right. Clicking mouse left button to open the door and clicking again to close it. Rolling up the mouse wheel to close to the scene or rolling down to away from the scene. Press “Esc” to quit the program.
5. The core BioPaFiAR software (Driver for the BioPaFiAR hardware device)
In this project, a light matrix projected from projector will be used to change the motion state of bacteria. And the light matrix is generated by computer which will collect colony image by camera. So we need a program to coordinate the work between the projector and camera. At first, the program can read image from camera. So we use opencv-python to control camera and process image. After read image from camera, we need separate colony from background. Because a huge reflection existing in dish’s wall will interfere the separation process, so we need to find a new way to separate it.
Guiding bacteria to form a specific pattern need to culture bacteria continually. In the meantime, in addition to the colony area, the illumination condition of the rest area is invariable. So we can get colony area by using the picture later to subtract the previous. Based on this thought, we will save a picture into memory before the colony appeared. After the colony appeared, we can read image from camera. Converting them to gray mode and thresholding them separately. Subtracting the former from the latter. Then we can get the colony. But in many times, the lack of resolution of camera may cause the beat noise. So we can use open operation to remove the noise.
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 extent edge. But how to combine with target image? Bitwise and operation can be used in dilated image and target image. then converting 255 values to green color and 0 values to red color and save it as an BGR image. Displaying the image in full screen, and projector will copy and project it onto colony.
Figure 4. BioPaFiAR software