addpath /research/src/DNAdesign addpath /research/src/AFMutils % filepath = '/research/windows/backups/afm/d/Rizal/03-06-23/mov0623a.043' % rawim = showafm(filepath,0); % filepath = '/research/windows/backups/afm/d/Rizal/02-08-03/real0803.'; % rawim = showafm(sprintf('%s%03d',filepath, 032),0); % filepath = '~winfree/Research/DNA/AFM_old/data.rizal/02-07-20/QBOX.097'; % rawim = showafm(filepath, 0); filepath = '~winfree/Research/DNA/AFM_old/data.rizal/02-07-20/QBOX.091'; % filepath = '~winfree/Research/DNA/AFM_old/data.rizal/02-07-21/HIGHRES.007'; rawim = showafm(filepath, 0); figure (1) imagesc (rawim) colormap gray truesize title 'raw image' showafm(filepath,1); % adjust image so that all values are positive low = min(min(rawim)) high = max(max(rawim)) rawim = rawim - low; % rotate matrix by 90 degrees so that each former row is now a column temp = rot90(rawim, 1); % perform fft on each column ftemp = fft(temp); % apply some filter to the frequency domain % % attempt at a butterworth filter: failed. % d = fdesign.lowpass; % hd = butter(d); % ftemp = filter(hd, ftemp); ftemp(1,:) = 0; %ftemp(2,:) = ftemp(2,:) / 2; % perform inverse transform temp = ifft(ftemp); % rotate matrix by -90 degrees so that the matrix is restored temp = rot90(temp, -1); temp_real = real (temp); figure (2) imagesc (temp_real) colormap gray truesize title 'real portion' temp_mag = abs (temp); % high = max(max(temp_mag)) % temp_mag = high - temp_mag; figure (3) imagesc (temp_mag) colormap gray truesize title 'magnitude' high = max(max(temp_real)); temp_real = temp_real ./ high; high = max(max(temp_mag)); temp_mag = temp_mag ./ high; temp = temp_real + temp_mag; figure (4) imagesc (temp) colormap gray truesize title 'final result = real + mag' % try something else to remove differences between line intesities. %[r,c] = size(rawim); %temp = zeros([r,c]); %for i = 1:r % temp(r,:) = histeq(rawim(r,:)); %end %temp = histeq(temp); % fails miserably. t = graythresh(temp); temp = im2bw(temp, t); figure(5) imagesc(temp) colormap gray truesize title 'thresholded image' pause; close all;