Skip to content
Snippets Groups Projects
Commit 8a0cbd5c authored by ac_cx's avatar ac_cx
Browse files

channelLoG study

parent 3b275b88
Branches
No related tags found
No related merge requests found
......@@ -6,9 +6,11 @@ if isempty(Q)
algorithms=[];
return
end
algorithms=cellfun(@jsondecode,Q);
algorithms=cellfun(@jsondecode,Q,'UniformOutput',false);
for i=1:length(algorithms)
if isfield(algorithms(i),'function')
algorithms(i).function=str2func(algorithms(i).function(2:end-2));
if isfield(algorithms{i},'function')
algorithms{i}.function=str2func(algorithms{i}.function(2:end-2));
end
end
algorithms=[algorithms{:}];
\ No newline at end of file
......@@ -2,6 +2,10 @@ function segParams=getSegmentationParams(conn)
algs=Read.getAlgorithms(conn,'segment');
if ~isempty(algs)
if length(algs)>1
fprintf(2,'WARNING %s found multiple segmentations -- picking first',conn.DataSource);
algs=algs(1);
end
segParams=algs.params; % settings from db
else
segParams=[];
......
......
% add channel log to folder
% ROOT = '/g/leverjs/mcf10a_3d_final'
function setChannelLoGfolder(ROOT,featureParams)
%
if ~exist('featureParams','var')
featureParams.name='erkLoG';
featureParams.radius_um=4;
featureParams.channel=2;
featureParams.color='#ff00ff';
end
flist = dir(fullfile(ROOT,'/**/*.LEVER'));
% extracted via processJSON.m
logjs = ['{"name":"signalLoG","type":"feature","description":"dark nucleus detector",' ...
'"function":"+CellFeatures.channelLoG.m","commandHost":"matlab"}'];
logAlg = jsondecode(logjs);
logAlg.params=featureParams;
logjs = jsonencode(logAlg); % with params
targetChannel=2;
for ff=1:length(flist)
strDB=fullfile(flist(ff).folder,flist(ff).name);
[conn,CONSTANTS,segParams]=openDB(strDB);
nameCheck=strfind(lower({CONSTANTS.renderParams.name}),'erk');
if nameCheck{targetChannel}~=1
fprintf(2,'%s: erk name not set (%s)\n',strDB,CONSTANTS.renderParams(2).name);
continue
end
algs=Read.getAlgorithms(conn,'feature');
% already there?
parx={algs.params};
algCheck = cellfun(@(x) strcmp(x.name,'erkLoG'),parx);
if any(algCheck)
fprintf(1,'%s: found erkLoG algorithm, skipping insert\n',strDB);
else
cmd=['insert into tblAlgorithms(fqn,type,jsAlgorithmInfo) values (' ...
'''' logAlg.name ''', ''' logAlg.type ''', ''' logjs ''')'];
exec(conn,cmd);
end
Batch.batchFeatures(conn,CONSTANTS,28);
close(conn)
end
\ No newline at end of file
......@@ -10,7 +10,7 @@
% if you're at the bottom of a bowl, 2nd derivative is +
sz=200;
center=round(sz/2);
radius=10;
radius=20;
im=zeros([sz,sz]);
for y=1:size(im,1)
......@@ -18,24 +18,23 @@ for y=1:size(im,1)
d = sqrt((y-center)^2 + (x-center)^2);
if d<radius
im(y,x)=1;
% elseif d<radius+2
% im(y,x)=1;
end
end
end
im=imcomplement(im);
% clf;
strDB = '/f/leverjs/Olivier/Yannick/20210924/20210924_pos1.LEVER';
t=187;channelERK=2;
im=leversc.loadImage(strDB,t,channelERK);
im=mat2gray(im);
radius=3;
% imagesc(im)
rx = 1/sqrt(2) .* [radius,radius,0];
rx = 1/2 .* [radius,radius,0];
imf = HIP.LoG(im,rx,[]);
imc = Segment.separateLoG(imf);
figure;imagesc(imc);
[conn,CONSTANTS,segParams]=openDB(strDB);
cellList=Read.getCellsTime(conn,1,1,CONSTANTS);
hold on;for i=1:length(cellList),plot(cellList(i).surface(:,1),cellList(i).surface(:,2),'color','m'),end
\ No newline at end of file
clf;
plot(imf(center,:));
hold on
plot(im(center,:))
%
% imc = Segment.separateLoG(imf);
% figure;imagesc(imc);
% [conn,CONSTANTS,segParams]=openDB(strDB);
% cellList=Read.getCellsTime(conn,1,1,CONSTANTS);
% hold on;for i=1:length(cellList),plot(cellList(i).surface(:,1),cellList(i).surface(:,2),'color','m'),end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment