-
Notifications
You must be signed in to change notification settings - Fork 0
/
abm_octave_2D.m
92 lines (79 loc) · 1.89 KB
/
abm_octave_2D.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
clear all;
close all;
pkg load image
sz = 200;
Grid = zeros(sz,sz);
cr = 7.5; % cell radius
ncy = 3;
c_idx = 1; %cell index
n_cell = 1;
%moore neighboorhood
row = ((1:sz).*ones(sz,1))';
col = (1:sz).*ones(sz,1);
%initialisation
Grid(sz/2,sz/2)=1;
lG = sz/2;
cG = sz/2;
%Il y a envrion 50 µL de volume et si on a 10 000 cellules par µL ça 500 000 cellules
% La puce peut normalement contenir environ 30 000 000 de cellues. Là on en met moins d'un million
%0.5*2*2*2*2
while(c_idx<10*sz)
idx = find(Grid!=0);
discrepancy=length(1:c_idx)-length(idx)
goal = 1:c_idx;
truth = sort(Grid(idx))';
imagesc(Grid!=0)
waitforbuttonpress
## %migration
## for j=1:24
## idx = find(Grid!=0);
## j;
## [r0 c0] = ind2sub([sz, sz],idx);
## %lG = round((sum(r0))/length(r0))
## %cG = round((sum(c0))/length(c0))
##
## % on bouge que celle du bord
## perim = im2double(bwperim(Grid));
## idx_p = find(perim!=0);
##
## for i = 1:length(idx_p)
## %bwperim(Grid)
## %waitforbuttonpress
## perim = im2double(bwperim(Grid));
## idx_p = find(perim!=0);
##
## [r c] = ind2sub([sz, sz],idx_p(i));
## pos = [r c]
## %Grid = migrate2D_chip(Grid,pos,c_idx,sz);
## %hold on;
## if(length(idx_p(i))>1)
## Grid = migrate2D_sphere(Grid,pos,c_idx,sz,100,100);
## endif
## %Grid
## %hold off;
## %imagesc(Grid!=0)
## %waitforbuttonpress
## endfor
## %imagesc(Grid!=0)
## %waitforbuttonpress
## endfor
for j = 1:24
Grid = migrate2D_sphere_ctr(Grid,lG,cG)
endfor
imagesc(Grid!=0)
waitforbuttonpress
% division loop
idx = find(Grid!=0);
for i = 1:length(idx)
idx(i);
pos(2) = col(idx(i));
pos(1) = row(idx(i));
pos;
Grid = divide2D(Grid,pos,c_idx+1,sz);
Grid;
c_idx = c_idx+1;
endfor
disp("end of loop")
imagesc(Grid!=0)
waitforbuttonpress
endwhile