2000 set of nmr sequences contain noise not image to wavelet coefficient as a cnn input and the corresponding clean nmr sequences wavelet coefficient as the output in matlab

To convert NMR sequences into wavelet coefficients, use the MATLAB function wavedec() that performs a multilevel 1-D wavelet decomposition on the signal. Then use the obtained coefficients as input to a CNN in MATLAB.

Here is a sample code for preparing wavelet coefficients as input data for CNN and storing it for each NMR dataset:

main.m
% read your NMR noisy datasets
nmr_noisy_data = load('nmr_noisy_data.mat');
noisy_data = nmr_noisy_data.nmr_data; % assuming data in nmr_data key


% define parameters for wavelet decomposition
wname = 'db6'; % use Daubechies wavelet
levels = 3; % perform 3-level wavelet decomposition
% wavelet decomposition for each dataset
[n, m] = size(noisy_data); % number of sequences, and length of each sequence
coefficients_mat = zeros(n, levels*m); % matrix to hold coefficients
for i=1:n
   % perform 1-D wavelet decomposition
   [C, L] = wavedec(noisy_data(i,:),levels,wname);
   % concatenate all coefficients in a single row
   Coefficients_row = C(1:L(1));
   for j=2:levels+1
       Coefficients_row = [Coefficients_row C(L(j-1)+1:L(j))];
   end
   coefficients_mat(i,:) = Coefficients_row;
end

% store coefficients as input for CNN
save('input_coeffs.mat', 'coefficients_mat');
881 chars
25 lines

Similarly, you can prepare clean NMR sequences coefficients as output data for CNN by reading the clean data, performing wavelet transformation for each sequence, and then storing the coefficients.

main.m
% read your NMR clean datasets
nmr_clean_data = load('nmr_clean_data.mat');
clean_data = nmr_clean_data.nmr_data; % assuming data in nmr_data key

% define parameters for wavelet decomposition
wname = 'db6'; % use Daubechies wavelet
levels = 3; % perform 3-level wavelet decomposition
% wavelet decomposition for each dataset
[n, m] = size(clean_data); % number of sequences, and length of each sequence
coefficients_mat = zeros(n, levels*m); % matrix to hold coefficients
for i=1:n
   % perform 1-D wavelet decomposition
   [C, L] = wavedec(clean_data(i,:),levels,wname);
   % concatenate all coefficients in a single row
   Coefficients_row = C(1:L(1));
   for j=2:levels+1
       Coefficients_row = [Coefficients_row C(L(j-1)+1:L(j))];
   end
   coefficients_mat(i,:) = Coefficients_row;
end

% store coefficients as output for CNN
save('output_coeffs.mat', 'coefficients_mat');
882 chars
24 lines

Now you can use input and output coefficients matrices as inputs for your CNN in MATLAB.

gistlibby LogSnag