Skip to content

shapeevolution log

Jose Alonso (mac) edited this page May 1, 2020 · 2 revisions

Evolution of shape from cross correlation following

This log file explains the development of the script_evolveshape script file.

Initialisation

The script is initialised by running the single shape script

Alternatively, if the data is known and has been saved, the user could run the code:

initscript;
foldername = 'PATH/TO/DATA_mat_XCORR';
experimentName = 'clump8002-tr2.mat';

load(fullfile(foldername, experimentName));

Variables loaded into the workspace.

The variables loaded to the workspace are:

  • trackinfo. Contains all the information of the numebr of frames, track labels and segmentation labels.
  • knownfr and ukfr, which contain the known and unknown frames that will be analysed.

One must be really careful when loading these experiments, since the files tend to get really big (over 2GB for a subset of 80 images). Also, be sure to be using MATLAB's MAT file storing v7.3 or higher.

Evolution of shapes (in general)

The evolution of shapes will follow a similar workflow as the file script_shapeandsom.m, since that is the original attempt to follow a shape with cross correlation and the evolving it. In this work, the steps before evolving a shape will be more generic, so that more techniques can be applied.

The workflow for the evolution of a shape is as follows:

  • Move boundary: this is already done in each ukfr(jx).
  • Initialise method (SOM, activecontours, etc)
  • Evolve

To evolve one frame, we chose one of the ukfr and choosing one frame that comes after of the known frame knownfr. In the particular example of clump 8002, the range is from 1:80 for the value of jx. The code below exemplifies how ONE UnKnown frame is chosen:

ix =1; % this value comes from script_singleshape
jx = 8;
oneuk = ukfr(jx);

Self-organising maps (attempts and results)

This code uses the developments in the SOM repo. Clone or download it and add it to the Matlab PATH.

Input data

This will be the variable oneindata, which is a MX4 that contains:

Position Intensity values of the image at position [X Y]
[X Y] [R G]
The code to obtain it from the image, and a binary mask appears below:
mask = bb2mask(oneuk.movedbb, handles.rows, handles.cols);
nuclei = oneuk.dataL==trackinfo.seglabel(ix+jx);
mask = mask-bitand(mask, nuclei);
intensities = oneuk.dataGR.*mask;
oneindata = somGetInputData(intensities, oneuk.X);

Network topologies

There are two topologies tried in this code, one being a circle or ring topology, and the other one a grid. For both, the initial points of the network need to be provided.

The two variables that need to be defined are the initial position, pos, of the network nodes and the size of the network netsize.

Circle

In this topology, the variable pos will correspond to the positions [X Y] alongside the boundary of the moved boundary oneuk.movedboundy. The variable netsize corresponds to size(pos,1)

incr = 10;
pos = oneuk.movedboundy(1:incr:end,2:-1:1);
netsize = size(pos,1);
oneuk.OG =  somBasicNetworks('circle', netsize, pos);

Notice the variable incr, which takes defines how spaced the points in the network will be.

Grid

SOM training options and parameters.

These involve the number of iterations maxiter, the value of the step alphazero, the initial number of neighbours to be taken into account N0 as well as others. They are stored in a structure somopt and used when calling the function somTrainingPlus.

somopt.maxiter = 1000;
somopt.alphazero = 0.25;
somopt.alphadtype = 'none';
somopt.N0 = 5;
somopt.ndtype = 'exp2';
somopt.debugvar = false;
somopt.steptype = 'intensity';
somopt.gifname = [];

Outputs

  • Experiment 1
maxiter alphazero alphadtype N0 ndtype steptype incr
100.00 0.13 none 5.00 exp2 intensity 1.00
somcirc-ex1
  • Experiment 2
maxiter alphazero alphadtype N0 ndtype steptype incr
100.00 0.25 none 5.00 exp2 intensity 1.00
somcirc-ex1
  • Experiment 3
maxiter alphazero alphadtype N0 ndtype steptype incr
1000.00 0.13 none 8.00 exp2 intensity 10.00
somcirc-ex1
  • Experiment 4
maxiter alphazero alphadtype N0 ndtype steptype incr
500.00 0.25 none 5.00 exp2 intensity 8.00
somcirc-ex1
  • Experiment 5
maxiter alphazero alphadtype N0 ndtype steptype incr
500.00 0.13 none 5.00 exp2 intensity 20.00
somcirc-ex1

Problems found (discussion)

A number of problems were detected on the

  • Grid is hard to initialise to take advantage of the known frame shape.
  • Circle is hard to control.
  • Circle needs less points, but it still does not move as well, and some points do not get taken into consideration.

Active Contours (attempts and results)

In this section, the active contour shape evolution will be followed. In Matlab, the function activecontour will be used, which comes from the following references:

  1. T. F. Chan, L. A. Vese, Active contours without edges. IEEE Transactions on Image Processing, Volume 10, Issue 2, pp. 266-277, 2001
  2. V. Caselles, R. Kimmel, G. Sapiro, Geodesic active contours. International Journal of Computer Vision, Volume 22, Issue 1, pp. 61-79, 1997.
  3. R. T. Whitaker, A level-set approach to 3d reconstruction from range data. International Journal of Computer Vision, Volume 29, Issue 3, pp.203-231, 1998.

with the Sparse-Field level set method, similar to 3. is the one used. At its core, the function requires an image A and a binary mask bw which refers to the initial point of the evolution. The number of iterations used is also a parameter that can be set.

Active contours parameters

The function can be tweaked by using some Name-Value parameters that alter the evolution of the bw. The parameters tested for this development are;

  • method with the options 'Chan-Vese' or 'edge'.
  • 'ContractionBias': when positive, the contour is biased to contract while when negative it expands.
  • 'SmoothFactor' is a parameter that gives a degree of smoothness of the boundaries of segmented regions.

Experimentation

Random experiments

The method and its parameters were tested on a single cell.

  • Experiment 1
framesAhead method iter smoothf contractionbias
2.00 Chan-Vese 25.00 1.00 0.00
ac-ex1
+Experiment 2
framesAhead method iter smoothf contractionbias
8.00 Chan-Vese 25.00 1.00 0.00
ac-ex2
  • Experiment 3
framesAhead method iter smoothf contractionbias
8.00 Chan-Vese 100.00 2.00 0.00
ac-ex3

Manual experiments on eight unknown frames

The experiments presented are done by manually selecting the parameters of the activecontour function in MATLAB, and then selecting eight unknown frames after the known frame 418.

framesAhead method iter smoothf contractionbias
1.00 Chan-Vese 25.00 2.00 0.00
2.00 Chan-Vese 25.00 2.00 0.00
3.00 Chan-Vese 25.00 2.00 0.00
4.00 Chan-Vese 25.00 2.00 0.00
5.00 Chan-Vese 100.00 2.00 0.00
6.00 Chan-Vese 100.00 2.00 0.00
7.00 Chan-Vese 100.00 3.00 0.00
8.00 Chan-Vese 100.00 3.00 0.00

ac-1to8-exp

Manual experiments using a single set of parameters.

method iter smoothf contractionbias
Chan-Vese 100.00 2.00 0.00

ac-1to8-smaeparams-exp

Experiments on further frames detected correctly

Remember the graph presented before: corr-vs-dist Now the experiment will be run on the frames 435:442 with the same parameters as before:

method iter smoothf contractionbias
Chan-Vese 100.00 2.00 0.00

The results are: ac-17to24-sameparams-exp

One can see in the larger frame leaps jx>17 that the segmentation is qualitatively worse. Originally, the focus of this approach is to update the shape of the unknown frame at each point and take that information onto the next frame.

gif-of-single-cell

This initial test show promise, however, in this case, the known, knownfr and unknown ukfr were chosen based on leaps tj = t0+jx. A test trying to construct the frames at each time frame is necessary, in a way that only the information from the previous frame is carried out to the next one, this means: tj = t(j-1) + 1, t(j-1)=t(j-2)+1, ..., t2 = t1+1, t1=t0+1; where the ONLY completely known frame will be t0, and the rest will be constructed along the way.

This new development is referred to in the log file shapeevolution-iterative.md. This new log file refers to the code script_iterevolution.m.

Clone this wiki locally