从电泳凝胶图像测量加权平均长度

Lee*_*nde 7 matlab image-processing

背景:

我的问题涉及从电泳凝胶中提取特征(见下文).在该凝胶中,从顶部装载DNA并使其在电压梯度下迁移.凝胶具有筛子,因此较小的分子比较长的分子迁移得更远,导致DNA长度分离.分子越高,它就越长.

题:

在该图像中,有9个泳道,每个泳道具有独立的DNA来源.我有兴趣测量每条车道的平均位置(y轴上的值).我对图像处理很陌生,但我知道MATLAB,我可以用R来解决这个问题.如果有人能告诉我如何找到每条车道的平均值,我真的很感激.

gel_image

Jon*_*nas 5

这是我的尝试.它要求凝胶很好(即直通道和凝胶不应旋转),但应该相当普遍地工作.请注意,需要调整两个与图像大小相关的参数,以使其适用于不同大小的图像.

%# first size-dependent parameter: should be about 1/4th-1/5th
%# of the lane width in pixels.
minFilterWidth = 10;

%# second size-dependent parameter for filtering the 
%# lane profiles
gaussWidth = 5;

%# read the image, normalize to 0...1
img = imread('http://img823.imageshack.us/img823/588/gele.png');
img = rgb2gray(img);
img = double(img)/255;

%# Otsu thresholding to (roughly) find lanes
thMsk = img < graythresh(img);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

%# count the mask-pixels in each columns. Due to 
%# lane separation, there will be fewer pixels
%# between lanes
cts = sum(thMsk,1);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

%# widen the local minima, so that we get a nice
%# separation between lanes
ctsEroded = imerode(cts,ones(1,minFilterWidth));

%# use imregionalmin to identify the separation 
%# between lanes. Invert to get a positive mask
laneMsk = ~repmat(imregionalmin(ctsEroded),size(img,1),1);
Run Code Online (Sandbox Code Playgroud)

带有用于分析的车道的图像

在此输入图像描述

%# for each lane, create an averaged profile
lblMsk = bwlabel(laneMsk);
nLanes = max(lblMsk(:));

profiles = zeros(size(img,1),nLanes);
midLane = zeros(1,nLanes);

for i = 1:nLanes
profiles(:,i) = mean(img.*(lblMsk==i),2);
midLane(:,i) = mean(find(lblMsk(1,:)==i));
end

%# Gauss-filter the profiles (each column is an
%# averaged intensity profile
G = exp(-(-gaussWidth*5:gaussWidth*5).^2/(2*gaussWidth^2));
G=G./sum(G);
profiles = imfilter(profiles,G','replicate'); %'
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

%# find the minima
[~,idx] = min(profiles,[],1);

%# plot
figure,imshow(img,[])
hold on, plot(midLane,idx,'.r')
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述