IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
demo_raman_preprocess.m
Go to the documentation of this file.
1 %>@brief Pre-processing of Raman data: Wavelet-De-noising, Polynomial Baseline Correction, Vector Normalization
2 %>@file
3 %>@ingroup demo
4 
6 
7 % Wavelet de-noising
8 u = pre_wden();
9 u.waveletname = 'haar';
10 u.no_levels = 6;
11 u.thresholds = [0 0 0 20 20 100];
12 pre_wden01 = u;
13 
14 out = pre_wden01.use(ds01);
15 ds01_wden01 = out;
16 
17 
18 % Polynomial baseline correction
19 u = pre_bc_poly();
20 u.order = 5;
21 u.epsilon = 0;
22 u.contaminant_data = [];
23 u.contaminant_idxs = 1;
24 pre_bc_poly01 = u;
25 
26 out = pre_bc_poly01.use(ds01_wden01);
27 ds01_wden01_poly01 = out;
28 
29 
30 u = fsel();
31 u.v_type = 'rx';
32 u.flag_complement = 0;
33 u.v = [1725, 600];
34 fsel01 = u;
35 out = fsel01.use(ds01_wden01_poly01);
36 ds01_wden01_poly01_fsel01 = out;
37 
38 u = pre_norm_vector();
39 pre_norm_vector01 = u;
40 out = pre_norm_vector01.use(ds01_wden01_poly01_fsel01);
41 ds01_wden01_poly01_fsel01_vector01 = out;
42 
43 
44 
45 %%
46 
47 % Visualization
48 
49 fig_assert();
50 global SCALE FONTSIZE;
51 FONTSIZE = 14;
52 SCALE = 1.3;
53 
54 u = vis_alldata();
55 vis_alldata01 = u;
56 
57 figure;
58 
59 subplot(2, 2, 1);
60 vis_alldata01.use(ds01);
61 title('Raw Raman spectra');
62 legend off;
63 xlabel('');
64 
65 subplot(2, 2, 2);
66 vis_alldata01.use(ds01_wden01);
67 title('1. After Wavelet de-noising, 5^{th}-order polynomial baselines');
68 legend off;
69 h = plot(ds01_wden01.fea_x, (ds01_wden01.X-ds01_wden01_poly01.X)', 'LineWidth', scaled(1), 'Color', find_color(2));
70 hl = legend(h, {'Baselines'});
71 format_frank([], [], hl);
72 xlabel('');
73 ylabel('');
74 
75 subplot(2, 2, 3);
76 vis_alldata01.use(ds01_wden01_poly01);
77 title('2. After Polynomial baseline correction');
78 legend off;
79 
80 subplot(2, 2, 4);
81 vis_alldata01.use(ds01_wden01_poly01_fsel01_vector01);
82 title('3. After Cut 1725-600 cm^{-1} --> Vector normalization');
83 legend off;
84 ylabel('');
85 
86 maximize_window();
Feature Selection (FSel) class.
Definition: fsel.m:4
Wavelet De-noising block.
Definition: pre_wden.m:24
Visualization - All curves in dataset.
Definition: vis_alldata.m:2
Normalization - Vector Normalization.
Polynomial Baseline Correction.
Definition: pre_bc_poly.m:6
function fig_assert()
function load_data_raman_sample()