2000 nmr sequences contain noise wavelet coefficient as a cnn input and the corresponding clean nmr sequences wavelet coefficient as the output in matlab
Load and preprocess the data:
main.m
% set the path to the folder containing the raw datapath = 'path/to/folder';
% create a datastore to efficiently read and process the datads_noisy = imageDatastore(path, 'FileExtensions', '.mat', 'ReadFcn', @load);
% update the datastore read function to extract the wavelet coefficientsds_noisy.ReadFcn = @(x) wcodemat(x.noisy,255);
% repeat for the clean datads_clean = imageDatastore(path, 'FileExtensions', '.mat', 'ReadFcn', @load);
ds_clean.ReadFcn = @(x) wcodemat(x.clean,255);
% define data splits for training/validation/testing[ds_noisy_train,ds_noisy_val,ds_noisy_test] = splitEachLabel(ds_noisy,0.7,0.15,0.15);
[ds_clean_train,ds_clean_val,ds_clean_test] = splitEachLabel(ds_clean,0.7,0.15,0.15);
% get predictions on the test setpredicted_clean = predict(net,ds_noisy_test);
% visualize some example resultsidx = randperm(numel(ds_noisy_test.Files),5);
fori = 1:5% load the noisy and ground-truth clean images noisy = read(ds_noisy_test(idx(i)));
clean = read(ds_clean_test(idx(i)));
% reshape the predicted image to match the original size pred = reshape(predicted_clean(:,:,:,idx(i)),[size(ds_noisy_test.Files{1},1) size(ds_noisy_test.Files{1},2)]);
% visualize the results subplot(1,3,1); imshow(noisy,[]); title('Noisy');
subplot(1,3,2); imshow(clean,[]); title('Ground truth');
subplot(1,3,3); imshow(pred,[]); title('Predicted');
pause;
end