EvolutionSnake3D

Compute the evolution of a Snake Model in 3D.

Contents

Syntax.

V = EvolutionSnake3D(image, face, vertex);
V = EvolutionSnake3D(image, face, vertex, ...);

Description.

V = EvolutionSnake3D(image, face, vertex); returns mesh provided by the snake evolution model on the image initialized with face, vertex.

Examples.

% Loading path.
addpath('functions')
addpath('data')

% Clear variables en close all the window
clear, close, clc

% Compile the mex file
try
   cd functions
   mex baInterp3mex.cpp
   cd ..
catch
   disp('compilation failed. Programm will run in Matlab-only mode. ')
end
Building with 'Xcode Clang++'.
MEX completed successfully.

Uncomment the configuration you wish to try

%configuration=1; % Black cube
%configuration=2; % Black oval
%configuration=3; % Black ovals
%configuration=4; % Lungs
configuration=5; % All of them


%%%%%%%%%%%%%%%%%%%

* Black cube

%%%%%%%%%%%%%%%%%%%
if  (configuration ==1 || configuration ==5)

    % Create the image
    image=blackCube();

    % Prepare the initial mesh (center= (30,30,30) and radius=5
    [vertex0,face0]=trisphere(5, 5, 30, 30, 30);
    face=face0;vertex=vertex0;

    % Snake computation
    EvolutionSnake3D(image,face,vertex);
    axis equal
    view(-14.4,13.2);
end

%%%%%%%%%%%%%%%%%%%

* Black oval (elipsoid)

%%%%%%%%%%%%%%%%%%%
if  (configuration ==2 || configuration ==5)
    % Create the image
    image=blackOval();

    % Prepare the initial mesh (center= (30,30,30) and radius=5
    [vertex0,face0]=trisphere(5, 5, 30, 30, 30);
    face=face0;vertex=vertex0;

    % Snake computation
    EvolutionSnake3D(image,face,vertex);
    axis equal
    view(-14.4,13.2);
end

%%%%%%%%%%%%%%%%%%%

* Black ovals (Two perpendicular elipsoids)

%%%%%%%%%%%%%%%%%%%
if  (configuration ==3 || configuration ==5)
    % Create the image
    image=blackOvals();

    % Prepare the initial mesh (center= (30,30,30) and radius=5
    [vertex0,face0]=trisphere(5, 5, 30, 30, 30);
    face=face0;vertex=vertex0;

    % Snake computation
    EvolutionSnake3D(image,face,vertex);
    axis equal
    view(-14.4,13.2);
end

%%%%%%%%%%%%%%%%%%%

* Lungs (from CT scan)

%%%%%%%%%%%%%%%%%%%
if  (configuration ==4 || configuration ==5)
    % Create the image
    load lung.mat

    % Prepare the initial mesh (center= (15,30,30) and radius=6
    [vertex0,face0]=trisphere(5, 5, 15, 30, 30);
    face=face0;vertex=vertex0;

    % Snake computation
    EvolutionSnake3D(image,face,vertex,...
        'lambda', 900,...
         'Verbose','on');

    axis equal
    view(-14.4,13.2);
end

Input arguments.