Introduction

Terahertz (THz) radiation provides nondestructive testing by probing molecular vibrations, including molecular rotations, low-frequency bond vibrations, crystalline phonon vibrations, hydrogen bond stretches, and distortions [1]. Pulsed wave and continuous wave (CW) systems are two main types of instruments in the THz region. THz CW imaging is a compact, simple, and fast system, but the costs of these advantages are loss of depth, high resolution, and frequency domain information [2, 3]. As a typical pulsed wave system, THz time-domain system allows for the collection of a wide range of physical and chemical information about objects [3], thus, it is more applicable to study food and agricultural products. THz time-domain spectroscopic and imaging systems have attracted wide attention on biomedicine [4, 5], agri-food [6,7,8,9,10,11,12], and material recognition [13]. Compared with visible, near-infrared (NIR), or Fourier transformed infrared (FTIR) instruments, which have been widely used in previous research, THz time-domain system has a higher signal to noise ratio and can characterize thicker biological samples in transmission mode, since many non-polar and non-metallic substances are transparent to THz radiation.

Sunflower seed is a nutritive food and an important oilseed for edible oil production [14, 15]. The plumpness and weight of kernel are important indicators reflecting the seed yield and oil quality [16]. Conventional seed phenotyping primarily involves manual measurement or extraction of morphological features from two-dimensional, which fails to capture the three-dimensional (3D) characteristics and internal morphology of the seeds [17]. Considering the characteristics of the THz time domain system, it has the potential to provide technological support for seed quality control. However, most of the experimental demonstrations in relation to THz time domain imaging for seed research were performed in two spatial dimensions [6, 16, 18], and the structure information of intact seeds cannot be displayed and analysed in three spatial dimensions.

The computed tomography (CT) system presents a clear option for acquiring three-dimensional (3D) information. For instance, X-ray CT has been widely used to classify the quality of pepper seeds [19], visualize the 3D internal structure of seeds [20], and phenotype the morphological features of seeds [17]. THz computed tomography (CT), as a powerful extended mode of the THz imaging system, is another good option. THz time domain CT system has been applied to investigate dried human bones [21] and other artificial materials [22]. For the THz CW CT system, related researches focus on folded paper and scroll [23] and chicken ulna [24]. The kernel algorithm for object reconstruction of most studies is inverse Radon transform [25], denoted filtered back projection algorithm [26]. The projection processing before reconstruction is normally conducted due to the effect of THz point spread function (PSF) which can be expressed as a 3D Gaussian distribution [27, 28].

At present, no study is available in using THz CT system for quality evaluation of agri-food samples, thus, investigating THz time domain CT system for sunflower seed quality evaluation has wider significance. In the current study, a THz time domain CT system was customized for evaluating the 3D plumpness and kernel weight of sunflower seeds. These two properties of intact sunflower seeds are hard to be evaluated by optical sensing methods in other electromagnetic regions due to the low transmissivity.

Specifically, a series of THz images (projections) of the sunflower seed on a rotation stage were captured by the transmission mode THz time domain imaging system from different angles. These projections were preprocessed and then modelled by the inverse Radon transform to reconstruct the volumetric image of intact sunflower seed. The volume ratio of the whole seed to the kernel was calculated as the plumpness, and the correlation between the kernel weight and sum of kernel intensities was studied. To evaluate the performance of quantitative analysis on kernel weights and plumpness, 20 sunflower seeds were sampled, which is larger than the sample sets used in most of previous THz CT research [21,22,23,24]. This is the first application of applying THz CT systems to agri-food research, and we hope to provide inspiration for future research in related fields.

Materials and methods

Sunflower seed samples

Twenty dry sunflower seeds were used for the current study (Thompson & Morgan, Ipswich, United Kingdom). They were stored in dry and dark container with room temperature about 20 °C before sampling. Intact seeds and corresponding kernels were weighed after sampling and shown in Table 1. It should be noted that the methods described in present are calibration-free for both weight and plumpness analysis, thus a large number of samples is unnecessary to create a training and a test set. In addition, the number of samples used for THz CT study is normally less than 10 due to the limitation of sampling time [21,22,23,24]. Therefore, 20 sunflower seeds are sufficient for present modelling.

Table 1 Weight of sunflower seeds

THz time domain CT system

Figure 1 shows the schematic drawing of the current CT system based on a transmission mode THz time-domain spectrosocpy (Menlo Systems, Munich, Germany). The output of a femtosecond laser pulse is split into a pump beam and a probe beam using a beam splitter. The pump beam with a bias voltage was used to generate THz radiation through the THz emitter (location is − 210 mm on \(z\)-axis). The generated THz beam was then collimated and focused on the THz detector (location is 190 mm on \(z\)-axis) by using four TPX lenses (locations are − 175, − 55, 60, and 155 mm on \(z\)-axis). The probe beam was routed through a delay section and used to detect the THz beam in the THz detector. The difference between the THz beam path and the probe beam path was used to sample the THz path in the time domain (0 to 360 ps). The centre of the rotation stage (Thorlabs, New Jersey, United States) was located on the focal point (0 mm on the \(z\)-axis) between TPX lenses 1 and 2, where the sample was placed. All above-mentioned units were fixed on an optical rail with scale (Thorlabs, New Jersey, United States). The sunflower seed sample was glued to the centre of rotation stage with blu tack (Bostik, Colombes, France). The rotation stage manually rotated around its centre point (\(\theta\) is the angle of rotation) and automatically moved along the \(x\)-axis and \(y\)-axis (perpendicular to the focal point), which was controlled by a mechanical shifter.

Fig. 1
figure 1

Schematic drawing of set-up apparatus for THz time domain CT system

Imaging procedure

To perform a three-dimensional reconstruction of a sunflower seed, the two-dimensional THz transmission projection in x-axis and y-axis of the sample were recorded with a constant scanning interval of 0.4 mm in both two directions (Fig. 2). This procedure was repeated for 10 projections from 0 to 90° spaced 10° apart. The width (along the \(x\)-axis) of each projection was set to 39 scans/15.6 mm (the centre of the rotation is the 20th scan) for all samples. The length (along the \(y\)-axis) was set according to sample height to reduce scanning time. The obtained THz time domain images were converted into THz frequency domain images by applying fast Fourier transform. The intensity image \(I\) of the sample was calculated as:

$$I\left( v \right) = 1 - \left| {\frac{E\left( v \right)}{{E_{r} \left( v \right)}}} \right|,$$
(1)

where \(v\) is the frequency, \(E\left(v\right)\) is the electric field image of the sample, and \({E}_{r}\left(v\right)\) is the electric field of the reference, which was set as the maximum value of the \(E\left(v\right)\) (a pixel in the air part of images), and \(\left|\bullet \right|\) denotes the absolute value.

Fig. 2
figure 2

The procedure of sunflower seed reconstruction based on THz time domain CT system (a case at frequency of 1.2 THz)

Projection preprocessing

The THz Gaussian PSF makes the obtained projection blurred and can affect the quality of subsequent reconstruction of volumetric images, thus, it is important to eliminate the influence of PSF in object reconstruction [29]. The blurred projection can be regarded as the convolution result of real projection and PSF, thus, all projections were deconvolved by regularized filter algorithm in the present study (Fig. 2). The region of interest (ROI) was segmented by setting a threshold value (0.47).

Volumetric image reconstruction

Radon transform described in Fig. 3 was widely used for THz CT systems and the formula at a certain \(z\) was defined as [25]:

$$I_{y} \left( {x,\theta } \right) = \int {\int\limits_{ - \infty }^{ + \infty } {f_{y} \left( {x^{\prime},y^{\prime}} \right)\delta \left( {x - x^{\prime}\cos \theta - y^{\prime}\sin \theta } \right)dx^{\prime}dy^{\prime},} }$$
(2)

where \({I}_{z}\left(x,\theta \right)\) is the projection at angle \(\theta ,f_{y} \left( {x^{\prime},y^{\prime}} \right)\) is the object function or the volumetric image at \(z\), and \(\updelta\) is the Dirac impulse. The inverse Radon transform, or the filtered back projection algorithm was performed to recover the volumetric image from the projections. The inversion filters each projection in the Fourier domain to increase geometric details. Second, it computes each \(f_{y} \left( {x^{\prime},y^{\prime}} \right)\) value as a sum of filtered projections [28]. After reconstruction all \(f_{y} \left( {x^{\prime},y^{\prime}} \right)\) across \(y\)-axis, the 3D volumetric image \(V\) of sunflower seed can be obtained (Fig. 2). To simplify subsequent analysis, the output sizes along all three dimensions were set as \(40\times 40\times 40\) (\(x\times z\times y\)) and gaps due to different sizes of projection were padded with zero. All programs described in this section were written by the authors in MATLAB R2021b® (The MathWorks Inc., Natick, MA, USA).

Fig. 3
figure 3

The principle of Radon transform

Results

Volumetric image reconstructed

The seed and kernel can be segmented by setting threshold values, which were 1.2 and 1.45 respectively, for the reconstructed volumetric image (Fig. 2). These two threshold values were selected by manually identifying two sudden rises in the number of voxelks (\(y\)-axis) using the histogram of volumetric image, with an intensity value (\(x\)-axis) resolution of 0.05. The two sudden rise refered to corresponded to the boundaries between three distinct parts of a volumetric image: air, shell, and kernel. The part of the seed in contact with the rotation stage, the blu tack, can affect subsequent quality evaluation of sunflower seed. Besides, some non-kernel parts inside the seed with high absorption also need to be removed. Therefore, the base part of the seed was removed directly (the cutting index along \(y\)-axis was set as 4), and the inner parts except kernel (the biggest part) were removed according to the order of corresponding volumes.

Nevertheless, the direct removal of the base part obviously reduced the volume of the seed, which affected the accuracy of the plumpness analysis. The missing bottom of the seed was assumped to be a raised smooth surface determined by the edge points near the excised surface (blue points in Figs. 4, 5), thus, a surface based on quadratic equation in two variables (surface in Fig. 4) was fitted to fill the missing part of seeds. The surface can be described as:

$$y = \beta_{1} + \beta_{2} z + \beta_{3} z^{2} + \beta_{4} x + \beta_{5} x^{2} + \beta_{6} z \cdot x,$$
(3)

where \({\beta }_{1},{\beta }_{2},\dots ,{\beta }_{6}\) are fitted coefficients, \(x\), \(y\), and \(z\) are coordinates in 3D space. The fitted surface and the excised surface form a volumetric part, which can fill the bottom part of the seed (Fig. 4).

Fig. 4
figure 4

Combined measurement process: a baseline adjustment in the coordinate system, b remove outlier based on radians, and c final calculation

Fig. 5
figure 5

Surface fitting for bottom part

Due to the high position of the kernels on the \(y\)-axis inside seeds, even if a few kernels were attached to the base part, the effect of base cutting was negligible. Figure 6 shows several reconstructed volumetric images of sunflower seed at frequency of 1.2 THz, in which shapes and structures of sunflower seeds are well presented.

Fig. 6
figure 6

Reconstructed volumetric images of sunflower seed at frequency of 1.2 THz

Plumpness analysis

The present 3D plumpness was defined as the ratio of kernel volume to seed volume. The volume is the total number of voxels higher than threshold values (1.2 and 1.45 for seed and kernel, respectively) in the processed volumetric images. Since voxels were regarded as cubes during volume calculation, thus the small size of original volumetric images might cause inaccurate results. Therefore, sizes of volumetric image along all three dimensions were tripled by using the cubic interpolation, and re-scaled volumetric images contains 27 times of cubes with than corresponding original images. The obtained results of plumpness, seed volume and kernel volume are 30.83 ± 6.55%, 53.37 ± 20.93 mm3, and 175.16 ± 64.39 mm3, respectively (Table 2). The plumpness results of all 20 sunflower seeds obtained by THz CT volumetric images (3D plumpness) and RGB images (2D plumpness) were shown in Fig. 7. The 2D plumpness was obtained by calculating the ratio of number of kernel pixels to that of whole seed pixels in RGB images, and the result was 43.27 ± 8.16% (Fig. 8, Table 2). The ROIs of seed and kernel were segmented by setting threshold values, which was shown in Fig. 9. All values of 3D plumpness are lower than that of 2D plumpness (Fig. 7), which is consistent with the expected difference between volume and area. In other words, 3D plumpness is a better indicator of the seed quality than 2D plumpness, since it considers the thickness variation between the seed and its kernel. Even so, the distributions for both 3D and 2D plumpness were similar (Fig. 7).

Table 2 Quality evaluation results of sunflower seeds obtained by THz CT
Fig. 7
figure 7

3D plumpness obtained by the THz CT system and 2D plumpness obtained by the RGB images

Fig. 8
figure 8

Correlation between kernel weight and sum value of voxels

Fig. 9
figure 9

Image segmentation of kernel and seed for calculating 2D plumpness

Kernel weight analysis

Similar to the plumpness analysis, sizes of volumetric image along all three dimensions were tripled for calculating the sum intensity value of all voxels in kernel part. The threshold value for kernel segmentation was also set to 1.45. The result shown in Table 2 is 82.69 ± 36.35. The correlation at frequency of 1.2 THz (Fig. 8) between sum intensity values of all voxels in kernel part \(p\) and real kernel weights \(m\) was investigated and can be described as:

$$m = 0.39412p + 9.729$$
(4)

The correlation coefficient (R) is 0.89 at 1.2 THz. R values at 0.8, 0.9, 1.0, 1.09, 1.2, and 1.3 THz are shown in Fig. 10, and all of them are higher than 0.85. It should be noted that the higher the frequency the higher the resolution of THz images due to the shrink of PSF [30]. Hence, the frequency of 1.2 THz was chosen to reconstruct the image of sunflower seeds (Figs. 2, 4, and 6) because it ensures both prediction accuracy and the display of the finest details.

Fig. 10
figure 10

Correlation coefficients between sum values of kernel voxels and kernel weight at different frequencies

These results indicate that THz CT is a useful nondestructive tool to evaluate kernel weight of intact sunflower seed. In addition, the high correlation between real weights and sum intensity value of all voxels also indicated that the reconstructed volumetric images of sunflower seeds were reliable.

Discussion

The plumpness and kernel weight of sunflower seed were evaluated by a customized THz time domain CT system. Compared with previous sunflower seed plumpness research based on THz time domain imaging system [16], the THz CT system takes “plumpness of thickness” into account, which makes the results more accurate and enables the shape and defect of the kernels to be better displayed. The sum intensity value of all voxels in kernel part was shown to be correlated with kernel weight (R = 0.89 at 1.2 THz). Thus, it can be used as a quality indicator of sunflower seed for future study. Although only one frequency was selected for present study, the obtained volumetric images actually have four dimensions (\(x\), \(y\), \(z\), and frequency). The information in the frequency domain can be used to build calibration models, thus, it is feasible to draw the 3D distribution of chemical content in the sunflower seed volumetric images. Previous research only focus on mapping 2D distribution of chemical content on sunflower seed THz images [6]. In addition to chemical components, sunflower seed volumetric images obtained by the THz CT system are also suitable for analysing mechanical-structure properties. For example, in Yang et al. [31]’s study, if their simplified sunflower seed model is replaced by the model obtained by the THz CT system, it is obvious that the relevant analysis will be more accurate. Compared with X-ray CT systems, which were widely used in previous studies [17, 19, 20], THz time domain CT systems are non-ionizing, which makes it safer to biological samples, and the measurement cost of THz is lower [30].

Nevertheless, the application of THz time domain CT systems in agri-food quality evaluation is still limited by two factors. The first factor is the diffraction effects and Fresnel losses experienced by the propagation of the THz beam through the sample [32]. The second factor is the long scanning time since the volumetric image reconstruction requires projection at multiple angles, while THz time domain imaging systems can only adopt pixel-to-pixel mode [33]. Although the number of samples in present study is larger than that number of samples in most of previous THz CT research [21,22,23,24], the time for one sampling is still very long. Specifically, the imaging time for one projection is around 9 min, thus for one volumetric image, the total sampling time is about 1.5 h. To solve these challenges, the hardware should be developed to achieve simultaneous parallel measurement of pixel data and reducing data acquisition time [33]. Besides, filtered back projection algorithm was used to reconstruct the volumetric images in many previous studies [24, 34], and other reconstruction algorithms such as simultaneous algebraic reconstruction technique (SART), the ordered subsets expectation maximization (OSEM) [28], and refractive Index Matching [35] should be tested and developed to eliminate the effects of PSF.

Conclusions

We introduced a THz time domain CT system for evaluating plumpness and kernel weight of sunflower seed. The reconstructed volumetric images presented shapes and structures of sunflower seeds well. The correlation between sum intensity value of all kernel voxels and the kernel weight suggests that THz CT can be used as a nondestructive tool to evaluate kernel weight of intact sunflower seed. Compared 2D plumpness obtained by RGB images, the 3D plumpness can better reflect the seed quality because it takes the thickness difference between seed and kernel into account. The quantitative anlaysis for both kernel weights and 3D plumpness is calibration-free, which makes it possible to study the small amount of samples, avoiding the long sampling time of THz CT imaging associated with large numbers of samples. At present, no study is available in using THz CT system for quantitative evaluation of agri-food samples, thus, we hope that present study can provide inspiration for future research in related fields.