Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge with Tristan's fork #3

Open
wants to merge 117 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
1db39c3
adding files for the skeleton of the classes and test
troussil Mar 1, 2012
519794f
adding image of distances as input parameter + little functions for g…
troussil Mar 1, 2012
872a43d
init point set before FMM from the frontier
troussil Mar 1, 2012
574176d
FMM to get a band of points around the frontier
troussil Mar 1, 2012
c1eaa5a
sorting according to the zero-crossing time
troussil Mar 2, 2012
6569c99
small changes; flip and surfel update remain to do
troussil Mar 2, 2012
f5bb78f
flip done
troussil Mar 2, 2012
01969ec
working on updating bel
troussil Mar 2, 2012
196ca03
vrac: pb in the comparison
troussil Mar 2, 2012
641b521
using zero-crossing time instead of velocity
troussil Mar 5, 2012
6485a2c
ok for balloon force (reverse sign for Godunov scheme)
troussil Mar 5, 2012
9913f49
MCM
troussil Mar 5, 2012
c9cbe60
new tries with local approach for MCM
troussil Mar 7, 2012
09a2d7b
MCM again with distance map updated in the course of the computation
troussil Mar 7, 2012
9261525
removing sign error
troussil Mar 8, 2012
c61186b
ok, topological pb implies ASSERT inner point with positive distance,…
troussil Mar 9, 2012
94137e4
small changes for testing
troussil Mar 13, 2012
9f790e4
changes for the predicate: from one argument (point) to two (point, l…
troussil Mar 21, 2012
5b5aef6
adjusting with-Cairo ifdef
troussil Mar 29, 2012
a7c1763
Merge branch 'master' into localLevelSet
troussil Mar 29, 2012
5963355
trying renormalize the implicit function
troussil Mar 29, 2012
a9fcdb3
little bug correction in distance renormalization
troussil Mar 30, 2012
ce3482a
hide trace in local level set method
troussil Mar 30, 2012
04fd087
topological predicate introduction
troussil Mar 30, 2012
687e1dd
solving bug in point predicate from labels
troussil Apr 2, 2012
52a4d4d
removing obsolete file
troussil Apr 2, 2012
175eb27
test with image by STL Vector instead of image by STL Map
troussil Apr 2, 2012
f845dd1
many tests... (topo pred and diff operators)
troussil Apr 3, 2012
3e0f147
small changes in WeickertKuhneEvolver and deformation3d
troussil Apr 3, 2012
a3abfad
Merge branch 'master' into localLevelSet
troussil Apr 3, 2012
a641dda
Merge branch 'master' of github.com:troussil/digitalSnow
troussil Apr 3, 2012
4cb38d4
Merge branch 'master' into localLevelSet
troussil Apr 3, 2012
5aacdea
bug in domain reference fixed
troussil Apr 3, 2012
d4fb861
improvement of the curvature/normal 3d display
troussil Apr 4, 2012
d1d2504
build error corrected
troussil Apr 4, 2012
b90a0a7
build error fixed
troussil Apr 4, 2012
c584eb3
trying something
troussil Apr 4, 2012
3c5263b
trying isSimple method of digital objects
troussil Apr 4, 2012
6cc93dd
refactoring of SimplePointHelper
troussil Apr 5, 2012
25fad12
pointer instead of reference for the underlying image in SimplePoint…
troussil Apr 5, 2012
d2e37b3
test when there are more than 3 region in SimplePointHelper
troussil Apr 5, 2012
21706c8
Merge branch 'localLevelSet' of github.com:troussil/digitalSnow into …
troussil Apr 5, 2012
1169ca3
several bug fixed
troussil Apr 5, 2012
4a80294
adding test in 2d : bad results
troussil Apr 5, 2012
19cac4e
renaming testLocalDeformation
troussil Apr 6, 2012
1b1227c
small change
troussil Apr 6, 2012
f455c56
new tests: adding time step + removing distance values normalization,…
troussil Apr 6, 2012
db580b5
cleaning and improving deformation3d
troussil Apr 6, 2012
907fc92
adding partition evolver (tested in 3d on binary images)
troussil Apr 6, 2012
427e064
cleaning and improving deformation2d
troussil Apr 6, 2012
9946ab2
partition 2d (only tested on binary images)
troussil Apr 6, 2012
3d5db9b
test partition 2d
troussil Apr 9, 2012
1462b68
test partition 2d
troussil Apr 9, 2012
009f844
small bug
troussil Apr 16, 2012
9819546
providing FMM and differential operators source files for an easier use
troussil Apr 16, 2012
f019a33
in FrontierEvolver, FMM is now not limited to the 2 adjacent regions…
troussil Apr 17, 2012
8af2e27
checking surfels for all frontiers of the partition during the flips
troussil Apr 17, 2012
71deb1e
nothing better + bug double free
troussil Apr 18, 2012
bb24374
cleaning (bug may come from DGtal - SurfelNeigborhood - to correct la…
troussil Apr 19, 2012
6799754
FMM in domain instead of bounded within two adjacent regions
troussil Apr 19, 2012
52cc594
removing parameter 'maximal width' in FrontierEvolver
troussil Apr 19, 2012
03eb5d9
private method for retreiving candidate to flip
troussil Apr 19, 2012
e539bc8
private method for updating the distance function
troussil Apr 19, 2012
b92fb93
private method for updating the label image
troussil Apr 19, 2012
7374d1d
cleaning topological predicate in FrontierEvolver
troussil Apr 19, 2012
e8aebb5
extension speed
troussil Apr 19, 2012
e0cfa52
still pb that comes from the way that FMMPointFunctor deals with val…
troussil Apr 19, 2012
98f3e57
little bug correction in CascadingPredicates
troussil Apr 20, 2012
24d75f6
cleaning FMM in initNarrowBand in FrontierEvolver2
troussil Apr 20, 2012
6b384fd
try with FMM within the two adjacent regions
troussil Apr 20, 2012
9afaaef
new procedure for tracking the starting surfel in the digital frontier
troussil Apr 23, 2012
e9c947a
adding file for the generation of simple test partitions
troussil Apr 23, 2012
cf56fa2
bug fix on updateFrontier (set surfel outside of the loop)
troussil Apr 24, 2012
60d9379
displaying 3d partitions
troussil Apr 24, 2012
e45f3b8
QGL snapshot
troussil Apr 24, 2012
e1926af
try: 3d to 2d with QGL Viewer + cleaning display functions
troussil Apr 25, 2012
f222fce
snapshot with QGL viewer ok
troussil Apr 25, 2012
8f66eef
adding an orientation to move the camera in QGL snapshots
troussil Apr 25, 2012
c99da24
adding an orientation to move the camera in QGL snapshots (correction)
troussil Apr 25, 2012
9286d2a
improvement of the QGLviewer snapshot mechanism
troussil Apr 26, 2012
5386ad9
commit the work done in April
troussil Jul 10, 2012
00be2ed
small changes
troussil Jul 12, 2012
88cff8e
adding multi phase field
troussil Jul 12, 2012
48c83b3
fixing build/test issues
troussil Jul 12, 2012
e8e9483
evolution with respect to DGtal: adding include
troussil Apr 19, 2013
5c7d767
evolution with respect to DGtal: distance transform and PointVector o…
troussil Apr 19, 2013
c008185
evolution with respect to DGtal: fixing distance transform
troussil Apr 19, 2013
7f545c7
evolution with respect to DGtal: vol writer
troussil Apr 19, 2013
6875144
evolution with respect to DGtal: missing namespaces added
troussil Apr 19, 2013
f81238a
update from DGtal + row-major order for fftw
troussil Jun 25, 2014
6016842
bug fixin diffusion by FFT for non-rectangular images
troussil Jul 2, 2014
06166f9
pull from paritionEvolverPhaseField branch
rolanddenis Jan 9, 2015
1da4419
pull from master branch
rolanddenis Jan 9, 2015
8e39d10
evolutions with respect to DGtal
rolanddenis Jan 9, 2015
855b9ef
add option for multiPhaseField method
rolanddenis Jan 9, 2015
d5b1e0d
rollback of a workaround due to an old bug in DGtal
rolanddenis Jan 12, 2015
9dd984c
constructing viewer with KSpace, or updating embedders when possible …
rolanddenis Jan 12, 2015
6516201
Correcting segfault in QApplication initialization
rolanddenis Jan 12, 2015
168cd3e
Correcting snapshot bug
rolanddenis Jan 15, 2015
9ddd226
re-indenting deformation3d
rolanddenis Jan 19, 2015
4f98b78
Adding multiPhaseField in deformation3d.
rolanddenis Jan 19, 2015
55660fd
correcting multiple phase bug (1st draft)
rolanddenis Jan 20, 2015
d1ff6c8
test of re-enabling conservation volume
rolanddenis Jan 20, 2015
15a4280
Refactoring options management. More comments.
rolanddenis Jan 20, 2015
d66d253
Adding volume calculation for multi phase.
rolanddenis Jan 21, 2015
ccc9f1d
Reporting value update at end of explicit operator.
rolanddenis Jan 22, 2015
43efd36
New volume calculation (draft)
rolanddenis Jan 22, 2015
7e8a7b3
Adding a VTK writer for images. C++11 enabled.
rolanddenis Jan 23, 2015
89e6f17
VTKWrite: concept based overloading for operator<<
rolanddenis Jan 23, 2015
b476ee5
Adding .ih syntax highlighting in GitHub
rolanddenis Jan 23, 2015
1d04462
Adding support for binary VTK legacy format
rolanddenis Jan 23, 2015
b97b053
Adding VTK export for multi phase-field.
rolanddenis Jan 27, 2015
faddb12
Merging 2D & 3D code.
rolanddenis Jan 27, 2015
8250904
Reverting a debug comment.
rolanddenis Jan 27, 2015
93b94dc
Cleaning old file. Roll-backs the profile.
rolanddenis Jan 28, 2015
41277eb
Relaxing images concept checking for VTK export.
rolanddenis Apr 8, 2015
a021455
Fixing lack of DGtal:: before HyperRectDomain ...
rolanddenis Apr 8, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.ih linguist-language=C++
2 changes: 2 additions & 0 deletions deformations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build*/
**/*.swp
273 changes: 273 additions & 0 deletions deformations/3dVolProjector.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
/**
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
**/
/**
* @file visuDistanceTransform.cpp
* @ingroup Examples
* @author Bertrand Kerautret (\c [email protected] )
* LORIA (CNRS, UMR 7503), University of Nancy, France
*
* @date 2011/01/04
*
* An example file named qglViewer.
*
* This file is part of the DGtal library.
*/

///////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <sstream>
#include <iomanip>

// Qt
#include <QApplication>
#include <QCoreApplication>

#include "DGtal/base/Common.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"


using namespace std;
using namespace DGtal;
using namespace Z3i;

#include "deformationDisplay3d.h"

/////////////////////
#include <boost/program_options/options_description.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/program_options/variables_map.hpp>

namespace po = boost::program_options;

int displayOneFile(
const string& inputFilename,
const string& outputBasename,
const int& offset = 0, const double& step = 0)
{
//image reading
typedef ImageSelector<Domain, unsigned char>::Type Image;
Image image = VolReader<Image>::importVol( inputFilename );

QCoreApplication* application = QCoreApplication::instance();
Viewer3D<> viewer;

//display
// displayPartition(viewer, image);
Domain domain(image.domain());

GradientColorMap<long> colorMap( 0, 510 );
colorMap.addColor(Color::Yellow);
colorMap.addColor(Color::Blue);
colorMap.addColor(Color::Red);
colorMap.addColor(Color::Green);

for(Domain::ConstIterator it = domain.begin(), itend=domain.end(); it!=itend; ++it){
unsigned char val= image( *it );
Color c = colorMap( val );
if(val > 0){
viewer << CustomColors3D(c, c);
viewer << *it;
}
}

viewer.show();
viewer << Viewer3D<>::updateDisplay;

// Prepare snapshot and connect it to drawFinished signal
// Ref: http://www.libqglviewer.com/refManual/classQGLViewer.html#a1cf2ffb973b096b249dc7e90327a2a8e
viewer.setSnapshotFileName(outputBasename.c_str());
viewer.setSnapshotFormat("PNG");
QObject::connect( &viewer, SIGNAL(drawFinished(bool)), &viewer, SLOT(saveSnapshot(bool)) );

// Camera Configuration
if (!viewer.restoreStateFromFile())
{
string s = viewer.stateFileName().toStdString();
trace.emphase() << " file " << s
<< " not found "
<< std::endl;
}

if ( (offset != 0)&&(step != 0) )
{
viewer.camera()->setOrientation( -(offset*step), 0.0);
viewer.showEntireScene();
}

// Render
viewer.updateGL();


{//rename snapshot
std::stringstream olds;
olds << viewer.snapshotFileName().toStdString()
<< "-" << setfill('0') << std::setw(4)
<< (viewer.snapshotCounter()-1) << ".png";
string oldf = olds.str();
std::stringstream news;
news << outputBasename << ".png";
string newf = news.str();
if (rename (oldf.c_str(), newf.c_str()) == -1)
trace.info() << "renaming " << oldf << " into "
<< newf << " failed " << std::endl;
}

/*
{//rename state file
string oldf = viewer.stateFileName().toStdString();
std::stringstream news;
news << ".qglviewer" << (QGLViewer::QGLViewerIndex(&viewer)+1) << ".xml";
string newf = news.str();
if (rename (oldf.c_str(), newf.c_str()) == -1)
trace.info() << "renaming " << oldf << " into "
<< newf << " failed " << std::endl;
}
*/

return 0;
}

int main( int argc, char** argv )
{
// Init Qt with command-line parameters
QApplication application(argc, argv);

// parse command line ----------------------------------------------
po::options_description general_opt("Allowed options are: ");
general_opt.add_options()
("help,h", "display this message")
("output-file,o", po::value<string>()->default_value("interface"), "output file(s) basename" )
("input-file,i", po::value<std::string>(), "volume file" )
("multi-input,mi", po::value<std::string>(), "volume files basename " )
("start,s", po::value<int>()->default_value(1), "starting number (for option -mi)" )
("end,e", po::value<int>()->default_value(2), "ending number, not included (for option -mi)" )
("angle-step,a", po::value<int>()->default_value(360), "angle step as a fraction of 2PI (0 disables this feature)" )
("number,n", po::value<int>()->default_value(90), "number of angle steps when moving camera" );
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, general_opt), vm);
po::notify(vm);
if(vm.count("help")||argc<=1)
{
std::cout << "Usage: " << argv[0] << " [input-file]\n"
<< "Display volume file as a set of digital frontiers"
<< general_opt << "\n";
return 0;
}

//files
if (!(vm.count("output-file")))
trace.info() << "output file begin with : interface" << std::endl;
string outputBasename = vm["output-file"].as<std::string>();


if(vm.count("input-file"))
{
if (vm.count("multi-input"))
{
trace.error() << " Cannot use both input options in the same time "
<< endl;
return 1;
}
string inputFilename = vm["input-file"].as<std::string>();

if(vm.count("angle-step"))
{
int den = vm["angle-step"].as<int>();
double angleStep = (den == 0)?0.0:( (2.0*M_PI)/((double) den) );
int n = vm["number"].as<int>();
for (int i = 0; i < n; ++i)
{
trace.info() << i << std::endl;
std::stringstream so;
so << outputBasename << setfill('0') << std::setw(4)
<< i;

displayOneFile(inputFilename, so.str(), i+1, angleStep);
}

{//rename state file
std::stringstream olds;
olds << ".qglviewer" << n << ".xml";
string oldf = olds.str();
string newf = ".qglviewer.xml";
if (rename (oldf.c_str(), newf.c_str()) == -1)
trace.info() << "renaming " << oldf << " into "
<< newf << " failed " << std::endl;
}

}
else
{
displayOneFile(inputFilename, outputBasename);

{//rename state file
string oldf = ".qglviewer1.xml";
string newf = ".qglviewer.xml";
if (rename (oldf.c_str(), newf.c_str()) == -1)
trace.info() << "renaming " << oldf << " into "
<< newf << " failed " << std::endl;
}
}
}
else
{
if (vm.count("multi-input"))
{
string inputBasename = vm["multi-input"].as<std::string>();

int den = vm["angle-step"].as<int>();
double angleStep = (den == 0)?0.0:( (2.0*M_PI)/((double) den) );

int start = vm["start"].as<int>();
int end = vm["end"].as<int>();
for (int i = start; i != end; ++i)
{
std::stringstream si;
si << inputBasename << setfill('0') << std::setw(4)
<< i << ".vol";
trace.info() << si.str() << std::endl;
std::stringstream so;
so << outputBasename << setfill('0') << std::setw(4)
<< i;

displayOneFile(si.str(), so.str(), i+1, angleStep);

}


{//rename state file
std::stringstream olds;
olds << ".qglviewer" << (end-start) << ".xml";
string oldf = olds.str();
string newf = ".qglviewer.xml";
if (rename (oldf.c_str(), newf.c_str()) == -1)
trace.info() << "renaming " << oldf << " into "
<< newf << " failed " << std::endl;
}

}
else
{
trace.error() << " No file name defined" << endl;
return 1;
}
}


return 0;
}
9 changes: 6 additions & 3 deletions deformations/3dVolViewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <QtGui/qapplication.h>

#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/io/readers/VolReader.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
Expand All @@ -53,6 +54,9 @@ namespace po = boost::program_options;

int main( int argc, char** argv )
{
// Qt init with command-line parameters
QApplication application(argc, argv);

// parse command line ----------------------------------------------
po::options_description general_opt("Allowed options are: ");
general_opt.add_options()
Expand Down Expand Up @@ -82,8 +86,7 @@ int main( int argc, char** argv )
int thresholdMax = vm["thresholdMax"].as<int>();
unsigned char transp = vm["transparency"].as<uint>();

QApplication application(argc,argv);
Viewer3D viewer;
Viewer3D<> viewer;
viewer.setWindowTitle("simple Volume Viewer");
viewer.show();

Expand All @@ -108,6 +111,6 @@ int main( int argc, char** argv )
viewer << *it;
}
}
viewer << Viewer3D::updateDisplay;
viewer << Viewer3D<>::updateDisplay;
return application.exec();
}
Loading