-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
executable file
·163 lines (147 loc) · 7.99 KB
/
main.cpp
File metadata and controls
executable file
·163 lines (147 loc) · 7.99 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/****************************************************************************
**
** Copyright (C) 2010-2012 Fabien Bessy.
** Contact: fabien.bessy@gmail.com
**
** This file is part of project Ofeli.
**
** http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
** You may use this file under the terms of the CeCILL license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Fabien Bessy and its Subsidiary(-ies) nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
**
****************************************************************************/
//! \file main.cpp
//! \brief Ofeli
//! \author Fabien Bessy
//! \version 1.0.7
//! \date August 2012
/*! \mainpage Developer's documentation
*
* \section intro_sec Introduction
*
* <p>Ofeli, as an acronym for <b>O</b>pen, <b>F</b>ast and <b>E</b>fficient <b>L</b>evel set
<b>I</b>mplementation, demonstrates how to operate an image
segmentation algorithm of Y. Shi and W. C. Karl <b>[1],</b> using a
discrete approach for the approximation of level-set-based
curve evolution (implicit active contours).</p>
<p>This is a novel (2005) and fast algorithm without the need
of solving partial differential equations (PDE) while preserving the
advantages of level set methods, such as the automatic handling of
topological changes. Considerable speedups (×100) have been
demonstrated as compared to PDE-based narrow band level-set implementations.</p>
<p>The Home Page of Ofeli can be found at : http://code.google.com/p/ofeli/ .</p>
* \section structure_sec Structure
*
* In this project, the <b>G</b>raphical <b>U</b>ser <b>I</b>nterface (GUI) is clearly separated of the image processing part.
*
* GUI part :
* - file imageviewer.cpp file with the class ofeli::ImageViewer (dependant of framework Qt 5.0, QtCore and QtWidgets modules)
* - file pixmapwidget.cpp with the class ofeli::PixmapWidget (dependant of framework Qt 5.0, QtCore and QtWidgets modules)
*
* Image processing part :
* - file linked_list.tpp with the class ofeli::list
* - file activecontour.cpp with the class ofeli::ActiveContour
* - file ac_withoutedges.cpp with the class ofeli::ACwithoutEdges
* - file ac_withoutedges_yuv.cpp with the class ofeli::ACwithoutEdgesYUV
* - file geodesic_ac.cpp with the class ofeli::GeodesicAC
* - file hausdorff_distance.cpp with the class ofeli::HausdorffDistance
* - file filters.cpp with the class ofeli::Filters (dependant of library Boost 1.52 for the random variables)
*
*
* \section reusability_sec Reusability
*
* <p>This Qt project is built as an application and not as a static or shared library. So if you are interested to use this C++ code, especially for the image processing part of the project,
* you must just include this file(s) thanks to the preprocessor directive in your file(s). After you must just pass to each constructor an input argument pointer on a row-wise image data buffer and for the class ACwithoutEdgesYUV, a pointer on a RGB interleaved data buffer (R1 G1 B1 R2 G2 B2 ...).</p>
* <p>If you prefer a command-line interface or if you are interested in a tracking example of this algorithm, you can find a fork of this project interfaced with Matlab (MEX-file). Each constructor takes an input pointer on a column-wise image data buffer and for the class ACwithoutEdgesYUV, a pointer on a RGB planar data buffer (R1 R2 R3 ... G1 G2 G3 ... B1 B2 B3 ...).</p>
*
*
* \section license_sec License
*
* This software is distributed under the <a href='http://www.cecill.info/licences/Licence_CeCILL_V2-en.html'>CeCILL license version 2</a> <a href='http://www.cecill.info/licences/Licence_CeCILL_V2-fr.html'> (link to the french version here)</a>.
*
* \section acknowl_sec Acknowledgments
*
* Thanks to :
* - J. Olivier, R. Boné, J-M. Girault, F. Amed, A. Lissy, C. Rouzière, L. Suta.
* - <i>pattern recognition and image analysis research team</i>, <i>computer science laboratory</i>,
* <i>François Rabelais University</i>.
* - students and professors of the MSc in medical imaging.
<hr></hr>
* \section ref_sec References
<p><b>[1]</b> Y. Shi, W. C. Karl - <a href='https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0Bzx5IoqehNE_MGIwYmUwYzctYTRkMC00ODMwLWI3YmUtNTFjYThlMTBkOTIy&hl=en&authkey=CPT1xeYN'>A real-time algorithm for the approximation of level-set based curve evolution</a> - <i>IEEE Trans. Image Processing</i>, vol. 17, no. 5, May 2008</p>
<p><b>[2]</b> T. F. Chan, L. A. Vese - <a href='https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0Bzx5IoqehNE_NWY5ZGMyMmYtNzkwNi00NjI0LWE4ZGMtODllZTVmZWQ5NGRm&hl=en&authkey=CNfMkNEI'>Active contours without edges</a> - <i>IEEE Trans. Image Processing</i>, vol. 10, no. 2, Feb 2001</p>
<p><b>[3]</b> V. Caselles, R. Kimmel, G. Sapiro - <a href='https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0Bzx5IoqehNE_ZWEzNzk2ZjgtNzlkMi00NDY0LTkzZjQtYWQ5N2EyNDA5NGE3&hl=en&authkey=CKi1w7cE'>Geodesic active contours</a> - <i>International Journal of Computer Vision</i>, 22(1), 61–79 (1997)</p>
<p><b>[4]</b> P. Perona, J. Malik - <a href='https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0Bzx5IoqehNE_NmJmZWZkM2ItN2ZhZS00NjA4LTk3Y2UtNTNmYzkxYjFjNjU4&hl=en&authkey=CPDnxN8H'>Scale-space and edge detection using anistropic diffusion</a> - <i>IEEE Trans. Pattern Analysis and Machine Intelligence</i>, vol. 12, no. 17, Jul 1990</p>
*/
#include <QApplication>
#include <QCoreApplication>
#include "imageviewer.hpp"
int main(int argc, char *argv[])
{
// to have the windows theme
//QApplication::setStyle(new QWindowsStyle);
QTextCodec::setCodecForLocale( QTextCodec::codecForName("UTF-8") );
//QTextCodec::setCodecForCStrings( QTextCodec::codecForName("UTF-8") );
//QTextCodec::setCodecForTr( QTextCodec::codecForName("UTF-8") );
QApplication app(argc, argv);
QSettings settings("Bessy", "Ofeli");
int language = settings.value("language",0).toInt();
QTranslator translator_qt_widget;
QTranslator translator_ofeli;
QString locale;
switch( language )
{
case 0 :
{
locale = QLocale::system().name().section('_', 0, 0);
break;
}
case 1 :
{
locale = QString("en");
break;
}
case 2 :
{
locale = QString("fr");
break;
}
default :
{
locale = QString("en");
}
}
translator_qt_widget.load( QString("qt_") + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath) );
app.installTranslator(&translator_qt_widget);
translator_ofeli.load( QString(":Ofeli_") + locale );
app.installTranslator(&translator_ofeli);
ofeli::ImageViewer imageViewer;
imageViewer.show();
return app.exec();
}