/**************************************************************************** stage_1/sampler.cpp Usage: > ./sampler [CC_dim] [stdDev] [probability] [outDir] - [CC_dim] - the number of samples along any major axis on the Cartesian grid - the BCC dimensions are calculated so that BCC has 70% of samples of CC - [stdDev] - the standard deviation of the 0 meaned white Gaussian noise - [probability] - the probability that a sample becomes affected by salt & pepper noise - [outDir] - the folder in which samplings (datasets) are stored - Output in the [outDir] folder: 10 datasets in total - one set in bytes (*.vud), and one set in doubles (*.dat) file format: - pair of noise-free datasets - pair of datasets with gaussian noise for CC - pair of datasets with gaussian noise for BCC - pair of datasets with salt & pepper nosie for CC - pair of datasets with salt & pepper nosie for BCC ****************************************************************************/ /**************************************************************************** stage_1/denoise.cpp Usage: > ./denoise [dir] [filename] [noiseType] [gridType] [filterRadius] - [dir] - the folder where the noisy dataset is found - the folder where the denoised dataset is written to - [filename] - the name of the noisy dataset file - ".dat" is appended automatically. - [filename].dat must be a double-precision dataset - [noiseType] - 0: Salt & pepper noise - 1: Gaussian noise - [gridType] - 0: CC - 1: BCC - [filterRadius] - radius of the continuous spherical filter - Output the denoised dataset in: - [dir]/[filename]_denoise.dat ****************************************************************************/ stage_1/gaussianNoiseHistogram. % This program produces plots for 3 ways of generating white noise: % - Central Limit Theorem approach % - rejection sampling approach % - Matlab built in white noise generator (for comparison) % Central limit theorem approach: % - The Central Limit Theorem states that the sum of N random numbers % will approach normal distribution as N approaches infinity; N >= 30 % works well. % - I set N = 50. % Rejection sampling approach: % - dart throwing till a sample falls under the Gaussian envelope % - On average, need to cast 10 pairs of random numbers for each sample % - For each pair, need to evaluate the Gaussian 1D function (slow) % - So, noticeably slower than Central limit theorem approach % The goal of this program is to choose a white noise generation % approach that can be implemented in C, and which runs reasonably quickly. % The Central Limit Theorem approach satisfies that criterion. /**************************************************************************** stage_2/plotData.cpp Usage: > ./plotData [dir] [data_orig.dat] [data_noisy.dat] [plotData.dat] [noiseType] [gridType] [isWithBoundary] - [dir] - the folder where the datasets are found - the folder where the plot data is written to - [data_orig.dat] - name of noise-free dataset - [data_noisy.dat] - name of corresponding noisy dataset - [plotData.dat] - name of plot data file - [noiseType] - 0: Salt & pepper noise - 1: Gaussian noise - [gridType] - 0: CC - 1: BCC - [isWithBoundary] - 0: consider only interior samples - 1: consider all samples - output in: - [dir]/[plotData.dat] - data points in ASCII for plotting in Matlab - data file format - line 1: numCols numRows (i.e. 4 10) - subsequent numRows lines: 1 line (or row) per entry - each entry has format - filterRadius neighborhoodSize mean stdDev - i.e. 1.000 7 0.01 2.0 ****************************************************************************/ stage_2/plotData.m % This program traverses a list of hard-coded directories (dirs) and % makes use of the plot data files contained in those directories to % produce plots. % Please see plotData.cpp for a specification of the format of the data % files. % For each entry in the ASCII data file, extract two components to produce % a 2D plot, as follows: % - entry: filterRadius neighborhoodSize mean stdDev % - i.e. 1.000 7 0.01 2.0 % - extracted tuple: (filterRadius stdDev) % - i.e. (1.000 2.0) % One CC/BCC pair of these plots are overlayed for each noise type, % and for each noise level. % For each entry in the ASCII data file, extract two other components to % produce another 2D plot, as follows: % - entry: filterRadius neighborhoodSize mean stdDev % - i.e. 1.000 7 0.01 2.0 % - extracted tuple: (filterRadius neighborhoodSize) % - i.e. (1.000 7) % One CC/BCC pair of these plots are overlayed for each noise level. % Finally, the the plotted images (in .png format) are saved in the % directory ../images/stage_2/ /**************************************************************************** stage_2/plotNeighborhood.cpp Usage: > ./plotNeighborhood [numNeighborhoods] [out.dat] - [numNeighborhoods] - specifies the number of neighborhoods to plot data points for - [out.dat] - specifies the name of data file to be output - output in: - ./[out.dat] - data points in ASCII for plotting in Matlab - data file format - line 1: numCols numRows (i.e. 2 50) - subsequent numRows lines: 1 line (or row) per entry - each entry has format - cc_radius cc_neighborHoodsize - i.e. 1.000 7 - subsequent numRows lines: 1 line (or row) per entry - each entry has format - bcc_radius bcc_neighborhoodSize ****************************************************************************/ stage_2/plotNeighborhod.m % This program traverses a neighborhood data file int he current direcotry % and makes use of the plot data contained to produce a single plot. % produce plots. % Please see plotNeighborhood.cpp for a specification of the format of the % data file. % First read in the tuples (radius, neighborhoodSize) for CC, plot them. % Then read in the tuples (radius, neighborhoodSize) for BCC, overlay % the plot on the CC plot. % Finally, the the plotted image (in .png format) is saved in the % directory ../images/stage_2/