## 3 Implementation of The Proposed System
### Plant Electrical Data Online Analysis Method
#### 3.2.1 Web-Based Electrical Signals Extracting Method for Fluorescence Images
5. all extracted AP-like signals will be saved into a new PairRDD \(<\)key = filename + channel name, value = AP-like signal\(>\)  
Spark Master:
6. Use collect() method to collect all AP-like signals from each slave node. Then save them into HBase. ```

**Algorithm 2** Parallel extraction of all AP-like signals based on Spark

``` Spark Master:
1. Set parameters (CPU, memory and others) of Spark context. Create the SparkContext object SC. 2. By Calling the newAPIHadoopRDD method of SC, read template signals from the HBase transform it to a PairRDD\(<\)key = template number, value = the template signals \(>\)as a broadcast variable. Spark Slave(Parallel):
3. Read each AP-like signal from HBase as PairRDD\(<\)key = filename + channel name, value = AP-like signal\(>\). 4. For each AP-like signal compare with each template get the highest similarity coefficient, new PairRDD\(<\)key = template number, value = the highest similarity coefficient\(>\). 5. if the highest similarity coefficient is higher than 0.91. 6. the AP-like waveform is a AP. 7. if the highest similarity coefficient is low than 0.91. 8. the AP-like waveform is not a AP. **Spark Master:**
9. Use collect() method the collect all the result. add the new AP to the templates in HBase. The Visualization of Temporal and Spatial Distribution of Plant Electrical Signals  
The temporal and spatial visualization of plant electrical signals mainly refers to the temporal and spatial visualization of optical mapping data or MEA data. It's used to discover and understand the changes in the electrophysiological signals. The spatial-temporal dataset contains time and location information. Besides time and location information, other attributes are also included such as the amplitude information of the plant electrical signals. For different datasets, there are different in accuracy of time and location information. For example, generally, the sampling interval of the optical mapping data is 0.2 s or 1 s, and the time accuracy of the MEA data is 0.05 ms. And the different objective lens resolution determines the size of the fluorescence image field, and the size of the selected image area can also be set. The MEA electrode recording area in the 64 channels with MED64 is usually fixed at 3.55 mm by 3.55 mm. Position and time scale are factors that directly affect visualization. This visualization method requires to read the time series of all areas once and then display on a fluorescent image. When the sampling rate of the time series is low, the size of the displayed data is small and the browser load is light to render easily in a short time and the data transmit in a fast speed. However, when the time series sampling rate is very high, such as MEA data, the dataset is large, and then the sampling rate must be reduced in the background, only a small amount of time series are sent to the client for the visualization. In the visualization, the plant electrical signals need to be drawn. Generally, the number of time points of optical mapping are less than 1000; but the sampling rate of MEA recording data is very high, which results in a sharp increase in the number of time points. Therefore, in order to save the drawing time, the sampling rate needs to be reduced.