├── CImg.h
├── COPYING
├── Makefile.am
├── Makefile.bak
├── Makefile.in
├── README.txt
├── aclocal.m4
├── ar-lib
├── bin
├── rdf.ini.bak
└── tracker.ini.bak
├── compile
├── config.guess
├── config.h.in
├── config.sub
├── configure
├── configure.ac
├── depcomp
├── graphic
├── lifFile.cpp
├── lifFile.hpp
├── lifTracker.cpp
├── lifTracker.hpp
├── mains
│ ├── aquireWisdom.cpp
│ ├── data2img.cpp
│ ├── lifTest.cpp
│ ├── tracker.cpp
│ └── tracker.ini
├── radiiTracker.cpp
├── radiiTracker.hpp
├── serieTracker.cpp
├── serieTracker.hpp
├── tinyxml
│ ├── readme.txt
│ ├── tinystr.cpp
│ ├── tinystr.h
│ ├── tinyxml.cpp
│ ├── tinyxml.h
│ ├── tinyxmlerror.cpp
│ └── tinyxmlparser.cpp
├── tracker.cpp
└── tracker.hpp
├── install-sh
├── lib
├── RStarTree
│ ├── RStarBoundingBox.h
│ ├── RStarTree.h
│ └── RStarVisitor.h
├── boo_data.cpp
├── boo_data.hpp
├── dynamicClusters.cpp
├── dynamicClusters.hpp
├── dynamicParticles.cpp
├── dynamicParticles.hpp
├── fields.cpp
├── fields.hpp
├── files_series.cpp
├── files_series.hpp
├── index.cpp
├── index.hpp
├── particles.cpp
├── particles.hpp
├── periodic.cpp
├── periodic.hpp
├── traj.cpp
└── traj.hpp
├── liveTrack
├── FFT.cpp
└── liveTrack2D.cpp
├── ltmain.sh
├── m4
├── libtool.m4
├── ltoptions.m4
├── ltsugar.m4
├── ltversion.m4
└── lt~obsolete.m4
├── mains
├── ISF.cpp
├── MSD.cpp
├── all_bonds.cpp
├── avpos.cpp
├── bonds.cpp
├── boo.cpp
├── boo5.cpp
├── boo_flip.cpp
├── cage2vtk.cpp
├── cgVoro.cpp
├── cutter.cpp
├── dat2vtk.cpp
├── dhlngb.cpp
├── drift.cpp
├── dynamics.cpp
├── g6.cpp
├── linkboo.cpp
├── linker.cpp
├── lostngb.cpp
├── percolation.cpp
├── rdf.cpp
├── sp5c.cpp
├── totalRdf.cpp
└── traj2vtk.cpp
├── missing
├── multiscale
├── Debug
│ ├── makefile
│ ├── objects.mk
│ ├── sources.mk
│ ├── src
│ │ └── subdir.mk
│ ├── subdir.mk
│ └── test
│ │ └── subdir.mk
├── RStarTree
│ ├── RStarBoundingBox.h
│ ├── RStarTree.h
│ └── RStarVisitor.h
├── Release
│ ├── makefile
│ ├── objects.mk
│ ├── sources.mk
│ ├── src
│ │ └── subdir.mk
│ ├── subdir.mk
│ └── test
│ │ └── subdir.mk
├── main.cpp
├── src
│ ├── center.hpp
│ ├── deconvolution.cpp
│ ├── deconvolution.hpp
│ ├── lifFile.cpp
│ ├── lifFile.hpp
│ ├── locatorfromlif.cpp
│ ├── locatorfromlif.hpp
│ ├── multiscalefinder.cpp
│ ├── multiscalefinder.hpp
│ ├── octavefinder.cpp
│ ├── octavefinder.hpp
│ ├── reconstructor.cpp
│ ├── reconstructor.hpp
│ ├── traj.cpp
│ └── traj.hpp
├── test
│ ├── deconvolution.cpp
│ ├── lif.cpp
│ ├── lifTrack.cpp
│ ├── main.cpp
│ ├── oneD.cpp
│ ├── overlap.cpp
│ ├── reconstruction.cpp
│ ├── threeD.cpp
│ ├── trajectories.cpp
│ └── twoD.cpp
└── test_input
│ ├── 3d_6_0.54_0.dat
│ ├── Gel_3_9_15_decon2.lif
│ ├── Playing_JH2.lif
│ ├── Z_elong.raw
│ ├── Z_preblur.raw
│ ├── gel.raw
│ ├── poly00_phi05.dat
│ ├── real.blob
│ └── real2.blob
├── python
├── boo
│ └── boo.py
└── colloids
│ ├── __init__.py
│ ├── clouds.py
│ ├── colors.py
│ ├── count_nuclei.py
│ ├── cython
│ ├── boo.ipynb
│ ├── periodic.ipynb
│ ├── periodic.pyx
│ ├── setup.py
│ └── structure_factor.pyx
│ ├── ddm.py
│ ├── depreciated
│ ├── __init__.py
│ └── boo.py
│ ├── dillute_raw.npy
│ ├── displ2D.py
│ ├── experiment.py
│ ├── h52traj.py
│ ├── lif.py
│ ├── lif2vtk.py
│ ├── lifTest.py
│ ├── microrheology.py
│ ├── notebooks
│ ├── CrockerGrier.ipynb
│ ├── Deconvolution.ipynb
│ ├── Multiscale.html
│ ├── Multiscale.ipynb
│ ├── Multiscale.md
│ ├── Radii of gyration.ipynb
│ ├── droplets.jpg
│ └── phase diagram.ipynb
│ ├── particles.py
│ ├── periodic.py
│ ├── phase.py
│ ├── phaseCorrelation.py
│ ├── povray.py
│ ├── progressbar.py
│ ├── spectrum.py
│ ├── statistics.py
│ ├── test_particles.py
│ ├── track.py
│ ├── track_droplet.py
│ ├── track_orange.py
│ ├── traj2h5.py
│ ├── truc.py
│ ├── voro.py
│ └── vtk.py
├── test
├── main.cpp
├── serietracker.cpp
└── tracker.cpp
├── test_input
├── TSerie_t000.tif
├── ZSerie_z00.tif
├── ZSerie_z01.tif
├── ZSerie_z02.tif
├── ZSerie_z03.tif
├── ZSerie_z04.tif
├── ZSerie_z05.tif
├── ZSerie_z06.tif
├── ZSerie_z07.tif
├── ZSerie_z08.tif
├── ZSerie_z09.tif
├── ZSerie_z10.tif
├── ZSerie_z11.tif
├── ZSerie_z12.tif
├── ZSerie_z13.tif
├── ZSerie_z14.tif
├── ZSerie_z15.tif
├── ZTSerie_z00_t000.tif
├── ZTSerie_z01_t000.tif
├── ZTSerie_z02_t000.tif
├── ZTSerie_z03_t000.tif
├── ZTSerie_z04_t000.tif
├── ZTSerie_z05_t000.tif
├── ZTSerie_z06_t000.tif
├── ZTSerie_z07_t000.tif
├── ZTSerie_z08_t000.tif
├── ZTSerie_z09_t000.tif
├── ZTSerie_z10_t000.tif
├── ZTSerie_z11_t000.tif
├── ZTSerie_z12_t000.tif
├── ZTSerie_z13_t000.tif
├── ZTSerie_z14_t000.tif
├── ZTSerie_z15_t000.tif
└── single_image.tif
├── tracker.cbp.linux
└── tracker.cbp.win
/Makefile.am:
--------------------------------------------------------------------------------
1 | ACLOCAL_AMFLAGS = -I m4
2 |
3 | lib_LTLIBRARIES = libcolloids.la libcolloids-graphic.la
4 |
5 | include_HEADERS = lib/boo_data.hpp lib/fields.hpp lib/particles.hpp lib/dynamicClusters.hpp lib/files_series.hpp lib/periodic.hpp lib/dynamicParticles.hpp lib/index.hpp lib/traj.hpp graphic/lifFile.hpp graphic/lifTracker.hpp graphic/radiiTracker.hpp graphic/serieTracker.hpp graphic/tracker.hpp
6 |
7 | libcolloids_la_SOURCES = lib/boo_data.cpp lib/fields.cpp lib/particles.cpp lib/dynamicClusters.cpp lib/files_series.cpp lib/periodic.cpp lib/dynamicParticles.cpp lib/index.cpp lib/traj.cpp lib/boo_data.hpp lib/fields.hpp lib/particles.hpp lib/dynamicClusters.hpp lib/files_series.hpp lib/periodic.hpp lib/dynamicParticles.hpp lib/index.hpp lib/traj.hpp lib/RStarTree/RStarBoundingBox.h lib/RStarTree/RStarTree.h lib/RStarTree/RStarVisitor.h
8 |
9 | LDADD = libcolloids.la
10 | AM_CPPFLAGS = -I$(srcdir)/lib -I$(srcdir)/graphic -DTIXML_USE_STL
11 | bin_PROGRAMS = all_bonds bonds boo boo_flip cage2vtk cutter dat2vtk dhlngb drift dynamics g6 ISF linkboo linker lostngb MSD percolation rdf sp5c totalRdf traj2vtk periodic_rdf periodic_boo periodic_g6 $(binvoro) aquireWisdom tracker tests
12 |
13 | EXTRA_PROGRAMS = cgVoro periodic_cgVoro
14 | periodic_boo_CPPFLAGS = $(AM_CPPFLAGS) -Duse_periodic
15 | periodic_rdf_CPPFLAGS = $(AM_CPPFLAGS) -Duse_periodic
16 | periodic_g6_CPPFLAGS = $(AM_CPPFLAGS) -Duse_periodic
17 | cgVoro_CPPFLAGS = $(AM_CPPFLAGS) -I$(VORO_SRC)
18 | periodic_cgVoro_CPPFLAGS = $(cgVoro_CPPFLAGS) -Duse_periodic
19 |
20 | all_bonds_SOURCES = mains/all_bonds.cpp
21 | bonds_SOURCES = mains/bonds.cpp
22 | boo_SOURCES = mains/boo.cpp
23 | periodic_boo_SOURCES = mains/boo.cpp
24 | boo_flip_SOURCES = mains/boo_flip.cpp
25 | cage2vtk_SOURCES = mains/cage2vtk.cpp
26 | cgVoro_SOURCES = mains/cgVoro.cpp
27 | periodic_cgVoro_SOURCES = mains/cgVoro.cpp
28 | cutter_SOURCES = mains/cutter.cpp
29 | dat2vtk_SOURCES = mains/dat2vtk.cpp
30 | dhlngb_SOURCES = mains/dhlngb.cpp
31 | drift_SOURCES = mains/drift.cpp
32 | dynamics_SOURCES = mains/dynamics.cpp
33 | g6_SOURCES = mains/g6.cpp
34 | periodic_g6_SOURCES = mains/g6.cpp
35 | ISF_SOURCES = mains/ISF.cpp
36 | linkboo_SOURCES = mains/linkboo.cpp
37 | linker_SOURCES = mains/linker.cpp
38 | lostngb_SOURCES = mains/lostngb.cpp
39 | MSD_SOURCES = mains/MSD.cpp
40 | percolation_SOURCES = mains/percolation.cpp
41 | rdf_SOURCES = mains/rdf.cpp
42 | periodic_rdf_SOURCES = mains/rdf.cpp
43 | sp5c_SOURCES = mains/sp5c.cpp
44 | totalRdf_SOURCES = mains/totalRdf.cpp
45 | traj2vtk_SOURCES = mains/traj2vtk.cpp
46 |
47 | cutter_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB)
48 |
49 |
50 | libcolloids_graphic_la_SOURCES = graphic/lifFile.cpp graphic/lifFile.hpp graphic/lifTracker.cpp graphic/lifTracker.hpp graphic/radiiTracker.cpp graphic/radiiTracker.hpp graphic/serieTracker.cpp graphic/serieTracker.hpp graphic/tracker.cpp graphic/tracker.hpp graphic/tinyxml/tinystr.h graphic/tinyxml/tinyxmlerror.cpp graphic/tinyxml/tinyxmlparser.cpp graphic/tinyxml/tinystr.cpp graphic/tinyxml/tinyxml.cpp graphic/tinyxml/tinyxml.h
51 |
52 | LDADD += libcolloids-graphic.la
53 |
54 | aquireWisdom_SOURCES = graphic/mains/aquireWisdom.cpp
55 | tracker_SOURCES = graphic/mains/tracker.cpp
56 |
57 | tracker_LDFLAGS = $(BOOST_LDFLAGS) $(BOOST_PROGRAM_OPTIONS_LIB)
58 |
59 | tests_SOURCES = test/main.cpp test/tracker.cpp test/serietracker.cpp
60 | LDADD += -lboost_unit_test_framework
61 |
--------------------------------------------------------------------------------
/Makefile.bak:
--------------------------------------------------------------------------------
1 | # generated by cbp2makefile.py
2 | # see http://pix.test.at/wiki/cbp2makefile for more info
3 |
4 | #directory tree related. Must be adapted for each machine
5 | OUTPUT_DIR = /home/mathieu/bin/
6 | #OUTPUT_DIR = ./
7 | #BOOST_DIR = /home/mathieu/boost
8 | BOOST_DIR = /usr/local/boost
9 | VORO_DIR = /home/mathieu/src/voro++/src
10 | CIMG_DIR = /home/mathieu/src/CImg-1.3.1
11 |
12 | #complier related
13 | CPP = icpc
14 | CXXFLAGS += -O3 -Wall -I $(BOOST_DIR) -I$(VORO_DIR) -I$(CIMG_DIR) -DTIXML_USE_STL -Dcimg_use_tiff -Dcimg_use_fftw3 -DINSTAL_PATH=\"$(OUTPUT_DIR)\" -DTRACKER_N_THREADS=6
15 | LDFLAGS += -L$(OUTPUT_DIR) -L/home/lib
16 | ifeq ($(CPP),icpc)
17 | CXXFLAGS += -w1 -xT -parallel -use-intel-optimized-headers -L$(MKLPATH) $(MKLPATH)/libmkl_solver_lp64.a -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread
18 | endif
19 |
20 | #OS related
21 | OS=nux
22 | LIB_BASE_NAME = particles
23 | GRAPHIC_LIB_BASE_NAME = graphic_$(LIB_BASE_NAME)
24 | ifeq ($(OS),win)
25 | SONAME = $(LIB_BASE_NAME).dll
26 | GRAPHIC_SONAME = $(GRAPHIC_LIB_BASE_NAME).dll
27 | EXT = .exe
28 | MKDIR_COMMAND =
29 | else
30 | SONAME = lib$(LIB_BASE_NAME).so
31 | GRAPHIC_SONAME = lib$(GRAPHIC_LIB_BASE_NAME).so
32 | EXT =
33 | MKDIR_COMMAND = -p
34 | endif
35 | LIB_NAME = $(OUTPUT_DIR)$(SONAME)
36 | LIB_GRAPHIC_NAME = $(OUTPUT_DIR)$(GRAPHIC_SONAME)
37 | LIBS += -l$(LIB_BASE_NAME)
38 | LIBS_GRAPHIC = $(LIBS) -lgdi32 -ltiff -lfftw3f -lboost_program_options -lX11
39 | #GRAPHIC_FLAGS = -Dcimg_use_tiff -Dcimg_use_fftw3 -DINSTAL_PATH=\"$(OUTPUT_DIR)\"
40 |
41 | #following option is -DLINUX even under MinGW
42 | CXXFLAGS += -DLINUX
43 | OBJ_OUTPUT = objs/
44 |
45 |
46 | SRC := $(wildcard *.cpp)
47 | HEADERS := $(wildcard *.hpp)
48 | OBJ := $(addprefix $(OBJ_OUTPUT), $(SRC:.cpp=.o) )
49 | TARGETS := $(notdir $(basename $(wildcard mains/*.cpp)))
50 |
51 | SRC_PERIODIC := rdf.cpp boo.cpp
52 | OBJ_PERIODIC := $(addprefix $(OBJ_OUTPUT)mains/periodic_, $(SRC_PERIODIC:.cpp=.o) )
53 | TARGETS_PERIODIC := $(addprefix periodic_, $(basename $(SRC_PERIODIC)))
54 |
55 | SRC_GRAPHIC := $(wildcard graphic/*.cpp)
56 | HEADER_GRAPHIC := $(wildcard graphic/*.hpp)
57 | OBJ_GRAPHIC := $(addprefix $(OBJ_OUTPUT), $(SRC_GRAPHIC:.cpp=.o) )
58 | TARGETS_GRAPHIC := $(notdir $(basename $(wildcard graphic/mains/*.cpp)))
59 |
60 | SRC_TINYXML := $(addprefix tinyxml/, tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp tinystr.cpp)
61 | OBJ_TINYXML := $(addprefix $(OBJ_OUTPUT), $(SRC_TINYXML:.cpp=.o) )
62 |
63 | all: library graphiclibrary $(TARGETS) $(TARGETS_PERIODIC)
64 |
65 | library: $(LIB_NAME)
66 |
67 | graphiclibrary: $(LIB_GRAPHIC_NAME) $(LIB_NAME)
68 |
69 | $(LIB_NAME): $(OBJ)
70 | -@mkdir $(MKDIR_COMMAND) $(OUTPUT_DIR)
71 | @$(CPP) -o $@ -shared $(CXXFLAGS) $^
72 |
73 | $(LIB_GRAPHIC_NAME): $(OBJ_GRAPHIC) $(OBJ_TINYXML)
74 | -@mkdir $(MKDIR_COMMAND) $(OUTPUT_DIR)
75 | @$(CPP) -o $@ -shared $^ $(LDFLAGS) $(LIBS_GRAPHIC) $(GRAPHIC_FLAGS)
76 |
77 | #making the target "c:/bin/target.exe" a dependency of the target "target"
78 | $(foreach tar,$(TARGETS) $(TARGETS_PERIODIC) $(TARGETS_GRAPHIC),$(eval $(tar): $(OUTPUT_DIR)$(tar)$(EXT)) )
79 |
80 | #linking of each target
81 | $(foreach tar,$(TARGETS) $(TARGETS_PERIODIC),$(eval $(OUTPUT_DIR)$(tar)$(EXT): $(OBJ_OUTPUT)mains/$(tar).o $(LIB_NAME) ; $(CPP) -o $$@ $$< $(LDFLAGS) $(LIBS) $(CXXFLAGS)))
82 | $(foreach tar,$(TARGETS_GRAPHIC),$(eval $(OUTPUT_DIR)$(tar)$(EXT): $(OBJ_OUTPUT)graphic/mains/$(tar).o graphiclibrary; $(CPP) -o $$@ $$< $(LDFLAGS) $(GRAPHIC_FLAGS) $(LIBS_GRAPHIC) -l$(GRAPHIC_LIB_BASE_NAME)))
83 |
84 | $(OBJ_OUTPUT)%.o: %.cpp $(HEADERS)
85 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)
86 | @$(CPP) -o $@ -c $< -fPIC $(CXXFLAGS)
87 |
88 | $(OBJ_OUTPUT)graphic/%.o: graphic/%.cpp %.hpp $(HEADERS)
89 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)graphic
90 | @$(CPP) -o $@ -c $< -fPIC $(CXXFLAGS) $(GRAPHIC_FLAGS)
91 |
92 | $(OBJ_OUTPUT)mains/%.o: mains/%.cpp
93 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)mains
94 | @$(CPP) -o $@ -c $< $(CXXFLAGS) $(GRAPHIC_FLAGS)
95 |
96 | $(OBJ_OUTPUT)graphic/mains/%.o: graphic/mains/%.cpp $(HEADERS)
97 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)graphic/mains
98 | @$(CPP) -o $@ -c $< $(CXXFLAGS) $(GRAPHIC_FLAGS)
99 |
100 | $(OBJ_OUTPUT)mains/periodic_%.o: mains/%.cpp
101 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)mains
102 | @$(CPP) -o $@ -c $< $(CXXFLAGS) -Duse_periodic
103 |
104 | $(OBJ_OUTPUT)tinyxml/%.o: tinyxml/%.cpp
105 | -@mkdir $(MKDIR_COMMAND) $(OBJ_OUTPUT)tinyxml
106 | @$(CPP) -o $@ -c $< -fPIC $(CXXFLAGS) $(GRAPHIC_FLAGS)
107 |
108 | clean: cleanlibrary cleangraphiclibrary $(addprefix clean, $(TARGETS) $(TARGETS_PERIODIC))
109 |
110 | cleanlibrary:
111 | -@rm -rf $(OBJ_OUTPUT)*.o
112 |
113 | cleangraphiclibrary: cleantinyxml
114 | -@rm -rf $(OBJ_OUTPUT)graphic/*.o
115 |
116 | cleantinyxml:
117 | -@rm -rf $(OBJ_OUTPUT)tinyxml/*.o
118 |
119 | #cleaning each target
120 | $(foreach tar,$(TARGETS) $(TARGETS_PERIODIC),$(eval clean$(tar): cleanlibrary; -@rm -rf $(OBJ_OUTPUT)mains/$(tar).o) )
121 | $(foreach tar,$(TARGETS_GRAPHIC),$(eval clean$(tar): cleanlibrary cleangraphiclibrary; -@rm -rf $(OBJ_OUTPUT)graphic/mains/$(tar).o) )
122 |
123 | mrproper: clean
124 | -@($(foreach tar, $(TARGETS) $(TARGETS_PERIODIC), rm -rf $(OUTPUT_DIR)$(tar)$(EXT) &&) rm -rf $(LIB_NAME))
125 |
126 |
127 |
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | **********
2 | *COLLOIDS*
3 | **********
4 |
5 | Description
6 |
7 | Colloids is a C++ library to process both experimental and simulation data of colloidal particles.
8 | The main features are
9 |
10 | * particle tracking from confocal microscopy images
11 | * analysis of local structure and dynamics of particles (from simulations or experiments)
12 |
13 |
14 | Project Homepage
15 |
16 | The project has a homepage which can be found at https://github.com/MathieuLeocmach/colloids/wiki
17 |
18 | Copyright and License
19 |
20 | Copyright 2008,2009 Mathieu Leocmach
21 |
22 | This file is part of Colloids.
23 |
24 | Colloids is free software: you can redistribute it and/or modify
25 | it under the terms of the GNU General Public License as published by
26 | the Free Software Foundation, either version 3 of the License, or
27 | (at your option) any later version.
28 |
29 | Colloids is distributed in the hope that it will be useful,
30 | but WITHOUT ANY WARRANTY; without even the implied warranty of
31 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 | GNU General Public License for more details.
33 |
34 | You should have received a copy of the GNU General Public License
35 | along with Colloids. If not, see .
36 |
37 |
38 | Aknowledge please
39 |
40 | Please cite Colloids and it's author(s) in any scientific publication using this software.
41 |
42 | The code in itself has a DOI number so you can cite it. Bibtex entry could be something like
43 |
44 | @misc{
45 | Leocmach2015,
46 | title={The colloid toolkit},
47 | url={http://dx.doi.org/10.5281/zenodo.31286},
48 | DOI={10.5281/zenodo.31286},
49 | author={Mathieu Leocmach},
50 | year={2015}
51 | }
52 |
53 | The multiscale algorithm is described in
54 |
55 | @Article{Leocmach2013,
56 | author ="Leocmach, Mathieu and Tanaka, Hajime",
57 | title ="A novel particle tracking method with individual particle size measurement and its application to ordering in glassy hard sphere colloids",
58 | journal ="Soft Matter",
59 | year ="2013",
60 | volume ="9",
61 | issue ="5",
62 | pages ="1447-1457",
63 | publisher ="The Royal Society of Chemistry",
64 | doi ="10.1039/C2SM27107A",
65 | }
66 |
67 |
68 | Contact
69 | Mathieu LEOCMACH, Institut Lumière Matière, UMR-CNRS 5306, Lyon, France
70 | mathieu.leocmach AT polytechnique.org
71 |
--------------------------------------------------------------------------------
/ar-lib:
--------------------------------------------------------------------------------
1 | /usr/share/automake-1.14/ar-lib
--------------------------------------------------------------------------------
/bin/rdf.ini.bak:
--------------------------------------------------------------------------------
1 |
2 | tsize=1
3 | toffset=0
4 | nbdigit_t=0
5 | inputPath = c:/data/kawasaki_output/gauss_
6 |
7 |
8 | nbDiameterCutOff=6
9 | Nbins=100
10 | radius = 5
--------------------------------------------------------------------------------
/bin/tracker.ini.bak:
--------------------------------------------------------------------------------
1 | # Tracking configuration
2 | input=C:/Code_data/YLP4 100% H+1/crystal1_z000_ch00.tif
3 | outputPath = C:/Code_output/YLP4 100% H+1/crystal1_
4 | displayRadius = 4.8
5 | radiusMin = 3.48
6 | radiusMax = 64
7 | zradiusMin = 3.48
8 | zradiusMax = 64
9 | threshold = 90
10 |
11 | # Specific to file serie mode
12 | channel = 1
13 | xsize = 256
14 | ysize = 256
15 | zsize = 128
16 | tsize = 1
17 | zoffset = 0
18 | toffset = 0
19 | voxelWidth = 1
20 | voxelDepth = 1
21 |
22 |
--------------------------------------------------------------------------------
/compile:
--------------------------------------------------------------------------------
1 | /usr/share/automake-1.14/compile
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.ac by autoheader. */
2 |
3 | /* define if the Boost library is available */
4 | #undef HAVE_BOOST
5 |
6 | /* define if the Boost::PROGRAM_OPTIONS library is available */
7 | #undef HAVE_BOOST_PROGRAM_OPTIONS
8 |
9 | /* Define to 1 if you have the header file. */
10 | #undef HAVE_DLFCN_H
11 |
12 | /* Define to 1 if you have the header file. */
13 | #undef HAVE_INTTYPES_H
14 |
15 | /* Define to 1 if you have the `fftw3f' library (-lfftw3f). */
16 | #undef HAVE_LIBFFTW3F
17 |
18 | /* Define to 1 if you have the `fftw3f_threads' library (-lfftw3f_threads). */
19 | #undef HAVE_LIBFFTW3F_THREADS
20 |
21 | /* Define to 1 if you have the `m' library (-lm). */
22 | #undef HAVE_LIBM
23 |
24 | /* Define to 1 if you have the 'pthread' library (-lpthread). */
25 | #undef HAVE_LIBNCURSES
26 |
27 | /* Define to 1 if you have the `X11' library (-lX11). */
28 | #undef HAVE_LIBX11
29 |
30 | /* Define to 1 if you have the header file. */
31 | #undef HAVE_MEMORY_H
32 |
33 | /* Define to 1 if you have the header file. */
34 | #undef HAVE_PTHREAD_H
35 |
36 | /* Define to 1 if you have the header file. */
37 | #undef HAVE_STDINT_H
38 |
39 | /* Define to 1 if you have the header file. */
40 | #undef HAVE_STDLIB_H
41 |
42 | /* Define to 1 if you have the header file. */
43 | #undef HAVE_STRINGS_H
44 |
45 | /* Define to 1 if you have the header file. */
46 | #undef HAVE_STRING_H
47 |
48 | /* Define to 1 if you have the header file. */
49 | #undef HAVE_SYS_STAT_H
50 |
51 | /* Define to 1 if you have the header file. */
52 | #undef HAVE_SYS_TYPES_H
53 |
54 | /* Define to 1 if you have the header file. */
55 | #undef HAVE_UNISTD_H
56 |
57 | /* Define to the sub-directory in which libtool stores uninstalled libraries.
58 | */
59 | #undef LT_OBJDIR
60 |
61 | /* Name of package */
62 | #undef PACKAGE
63 |
64 | /* Define to the address where bug reports for this package should be sent. */
65 | #undef PACKAGE_BUGREPORT
66 |
67 | /* Define to the full name of this package. */
68 | #undef PACKAGE_NAME
69 |
70 | /* Define to the full name and version of this package. */
71 | #undef PACKAGE_STRING
72 |
73 | /* Define to the one symbol short name of this package. */
74 | #undef PACKAGE_TARNAME
75 |
76 | /* Define to the home page for this package. */
77 | #undef PACKAGE_URL
78 |
79 | /* Define to the version of this package. */
80 | #undef PACKAGE_VERSION
81 |
82 | /* Define to 1 if you have the ANSI C header files. */
83 | #undef STDC_HEADERS
84 |
85 | /* Version number of package */
86 | #undef VERSION
87 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | #note: need autoconf and autoconf-archive installed
2 | AC_INIT([colloids], [1.0], [mathieu@iis.u-tokyo.ac.jp])
3 | AC_CANONICAL_HOST
4 | AC_CONFIG_MACRO_DIR([m4])
5 | AM_INIT_AUTOMAKE([subdir-objects foreign -Wall -Werror])
6 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
7 | AC_LIBTOOL_WIN32_DLL
8 |
9 | AC_PROG_CXX
10 | AC_LANG([C++])
11 | AC_CONFIG_SRCDIR([lib/particles.hpp])
12 | AC_CONFIG_HEADERS([config.h])
13 | #AC_CONFIG_SUBDIRS([mains graphic])
14 | AC_CONFIG_FILES([Makefile])
15 | LT_INIT
16 | AM_MAINTAINER_MODE([disable])
17 | #AX_MAINTAINER_MODE_AUTO_SILENT
18 |
19 | dnl get the flags
20 | CXXFLAGS="${CXXFLAGS=}"
21 | dnl this macro is used to get the arguments supplied
22 | dnl to the configure script (./configure --enable-debug)
23 | dnl Check if we have enable debug support.
24 | AC_MSG_CHECKING(whether to enable debugging)
25 | debug_default="no"
26 | AC_ARG_ENABLE(debug, [ --enable-debug=[no/yes] turn on debugging
27 | [default=$debug_default]],, enable_debug=$debug_default)
28 | dnl Yes, shell scripts can be used
29 | if test "x$enable_debug" = "xyes"; then
30 | CXXFLAGS="$CXXFLAGS -g -DDEBUG"
31 | AC_MSG_RESULT(yes)
32 | else
33 | CXXFLAGS="$CXXFLAGS -O3 -Wall -DNDEBUG"
34 | AC_MSG_RESULT(no)
35 | fi
36 |
37 | #Try to recognize the architecture
38 | AX_GCC_ARCHFLAG([yes], [CXXFLAGS="$CXXFLAGS $ax_cv_gcc_archflag"])
39 |
40 | lt_enable_auto_import=""
41 | case "$host_os" in
42 | mingw* | cegcc*)
43 | LDFLAGS="$LDFLAGS -Wl,--enable-auto-import -lgdi32"
44 | esac
45 | AC_SUBST(lt_enable_auto_import)
46 |
47 |
48 | AX_BOOST_BASE([1.35], , AC_MSG_ERROR('boost >1.35 is needed to calculate spherical harmonics'))
49 | AX_BOOST_PROGRAM_OPTIONS
50 |
51 | if test "x$want_boost" = "xno"; then
52 | AC_MSG_ERROR('boost >1.35 is needed to calculate spherical harmonics. Use --with-boost and --with-boost-program-options.')
53 | fi
54 |
55 | AC_CHECK_HEADER([CImg.h], , AC_MSG_ERROR('CImg >1.32 is needed'))
56 |
57 | AX_COUNT_CPUS
58 | CPPFLAGS="$CPPFLAGS -DTRACKER_N_THREADS=$CPU_COUNT"
59 |
60 | AC_OPENMP
61 | if test "$OPENMP_CXXFLAGS" != ""; then
62 | CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
63 | CPPFLAGS="$CPPFLAGS -Dcimg_use_openmp"
64 | fi
65 |
66 | # Checks for pthread.
67 | AC_CHECK_HEADERS([pthread.h], [
68 | AC_CHECK_LIB(pthread, pthread_create, [
69 | LIBS="$LIBS -lpthread"
70 | AC_DEFINE(HAVE_LIBNCURSES, 1, [Define to 1 if you have the 'pthread' library (-lpthread).])
71 | ])
72 | ])
73 |
74 | if test "$PTHREAD_LIBS" != ""; then
75 | LIBS="$PTHREAD_LIBS $LIBS"
76 | CXXFLAGS="$CXXFLAGS $PTHREAD_CXXFLAGS"
77 | CC="$PTHREAD_CC"
78 | fi
79 |
80 | #FFTW
81 | AC_CHECK_HEADER([fftw3.h], , AC_MSG_ERROR('FFTW >3 is needed'))
82 | AC_CHECK_LIB([fftw3f], [fftwf_free])
83 | #Under windows, fftw thread's functions are included into the main library, thus this will fail silently
84 | AC_CHECK_LIB([fftw3f_threads], [fftwf_init_threads])
85 |
86 | #Display Unix
87 | AC_CHECK_LIB([X11], [XOpenDisplay])
88 | #No need to check the display on Windows: the API is automatically linked
89 | #AC_CHECK_LIB([gdi32],[GetPixel])
90 | #Math library
91 | AC_CHECK_LIB([m], [sqrt])
92 |
93 | AC_ARG_WITH(voro-src, [ --with-voro-src=DIR Voro++ source files are in DIR])
94 | if test $with_voro_src; then
95 | AC_CHECK_FILE(
96 | [$with_voro_src/voro++.cc],
97 | [
98 | voro=true
99 | AC_SUBST(VORO_SRC, $with_voro_src)
100 | AC_SUBST(binvoro, "cgVoro periodic_cgVoro")
101 | ],
102 | [AC_MSG_ERROR("No voro++.cc at the indicated path")]
103 | )
104 | fi
105 | AM_CONDITIONAL([WANT_VORO],[test x$voro = xtrue])
106 |
107 | AC_OUTPUT
108 |
--------------------------------------------------------------------------------
/graphic/lifTracker.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 | * \file lifTracker.hpp
20 | * \brief glue between Tracker and LifFile
21 | * \author Mathieu Leocmach
22 | * \version 0.1
23 | * \date 22 december 2009
24 | *
25 | *
26 | */
27 |
28 | #include
29 | #include "lifTracker.hpp"
30 |
31 | using namespace std;
32 | using namespace Colloids;
33 |
34 | /** @brief Constructor from an existant LifFile object */
35 | LifTracker::LifTracker(LifSerie &serie, const size_t ch, const unsigned fs)
36 | {
37 | this->serie = &serie;
38 | setChannel(ch);
39 | tracker = new Tracker(getTrackerDims(), fs);
40 | tracker->fortran_order=true;
41 | this->centers=0;
42 | unsetThreshold();
43 | setTimeStep(0);
44 | return;
45 | }
46 |
47 | /** @brief chooseChannel */
48 | void LifTracker::chooseChannel()
49 | {
50 | channel = getLif().chooseChannel();
51 | }
52 |
53 | /** @brief set the current time step */
54 | void LifTracker::setTimeStep(size_t t)
55 | {
56 | this->iterator = serie->begin(t);
57 | this->time_step = t;
58 | if(centers)
59 | {
60 | Particles* old_centers = this->centers;
61 | this->centers = 0;
62 | delete old_centers;
63 | }
64 | tracker->fillImage_charToUchar(this->iterator);
65 | }
66 |
67 |
68 |
69 |
70 | /** @brief Fill the tracker's image with the next time step */
71 | LifTracker & LifTracker::operator++()
72 | {
73 | if(!quiet()) cout<<"to t="<iterator != std::istreambuf_iterator())
75 | this->iterator = tracker->fillImage_charToUchar(this->iterator);
76 | if(centers)
77 | {
78 | Particles* old_centers = this->centers;
79 | this->centers = 0;
80 | delete old_centers;
81 | }
82 | this->time_step++;
83 | return *this;
84 | }
85 |
86 |
87 |
88 |
89 | /** @brief get the dimensions according to the content of the lif serie
90 | Convert the dimension order from row major (Leica files) to column major (c order)
91 | If less than 3 dimensions, the first(s) dimension(s) is/are set to 1.
92 | That way (last dim != 1), real to complex FFT is efficient.
93 | */
94 | boost::array LifTracker::getTrackerDims() const
95 | {
96 | boost::array dims = {{1,1,1}};
97 | vector fortran_order_dims = getLif().getSpatialDimensions();
98 | copy(
99 | fortran_order_dims.begin(),
100 | fortran_order_dims.end(),
101 | dims.rbegin()
102 | );
103 | return dims;
104 | }
105 |
106 |
107 | /** @brief get the dimensions according to the content of the lif serie
108 | Convert the dimension order from row major (Leica files) to column major (c order)
109 | If less than 3 dimensions, the first(s) dimension(s) is/are set to 1.
110 | That way (last dim != 1), real to complex FFT is efficient.
111 | */
112 | /*boost::array LifTracker2D::getTrackerDims() const
113 | {
114 | boost::array dims = {1,1,1};
115 | vector fortran_order_dims = getLif().getSpatialDimensions();
116 | fortran_order_dims.back()=1;
117 | copy(
118 | fortran_order_dims.begin(),
119 | fortran_order_dims.end(),
120 | dims.rbegin()
121 | );
122 | return dims;
123 | }*/
124 |
125 |
126 |
127 |
--------------------------------------------------------------------------------
/graphic/lifTracker.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 | * \file lifTracker.hpp
20 | * \author Mathieu Leocmach
21 | * \version 0.1
22 | * \date 22 december 2009
23 | *
24 | *
25 | */
26 |
27 | #ifndef lif_tracker_H
28 | #define lif_tracker_file_H
29 |
30 | #include "tracker.hpp"
31 | #include "lifFile.hpp"
32 | namespace Colloids{
33 | /** \brief glue between Tracker and LifFile
34 | Can be used as a stadard InputIterator
35 | */
36 | class LifTracker : public TrackerIterator
37 | {
38 | LifSerie *serie;
39 | std::istreambuf_iterator iterator;
40 |
41 | public:
42 | explicit LifTracker(LifSerie &serie, const size_t ch=0, const unsigned fs=FFTW_ESTIMATE);
43 | /** \brief default constructor that should be used only to get an "end" iterator*/
44 | LifTracker end(){return LifTracker(getLif().getNbTimeSteps());};
45 | bool reachedEnd(){return getTimeStep()>=getLif().getNbTimeSteps();};
46 |
47 | LifSerie& getLif() const {return *serie;};
48 |
49 | void chooseChannel();
50 | void setTimeStep(size_t t);
51 | double getZXratio(){return serie->getZXratio();};
52 |
53 | LifTracker& operator++();
54 | bool operator==(const LifTracker& rhs) {return time_step==rhs.time_step && serie==rhs.serie;}
55 | bool operator!=(const LifTracker& rhs) {return time_step!=rhs.time_step;}
56 |
57 |
58 | private:
59 | LifTracker(const size_t end_step) : iterator(){time_step = end_step;};
60 | boost::array getTrackerDims() const;
61 | std::streampos tellg(){return serie->tellg();}
62 |
63 | };
64 |
65 | /** \brief A slice by slice version of the previous
66 | */
67 | /*class LifTracker2D : public LifTracker
68 | {
69 | public:
70 | explicit LifTracker2D(LifSerie &serie, const size_t ch=0, const unsigned fs=FFTW_ESTIMATE) : LifTracker(serie, ch, fs){};
71 | // \brief default constructor that should be used only to get an "end" iterator
72 | LifTracker2D end(){return LifTracker2D(getLif().getNbTimeSteps()*getLif().getSpatialDimensions()[0]);};
73 |
74 | bool operator==(const LifTracker2D& rhs) {return time_step==rhs.time_step && getLif()==rhs.getLif();}
75 | //bool operator!=(const LifTracker& rhs) {return time_step!=rhs.time_step;}
76 |
77 | private:
78 | LifTracker2D(const size_t end_step) : iterator(){time_step = end_step;};
79 | boost::array getTrackerDims() const;
80 |
81 | };*/
82 |
83 | }
84 | #endif
85 |
--------------------------------------------------------------------------------
/graphic/mains/aquireWisdom.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 | */
19 |
20 | #include "../lifTracker.hpp"
21 |
22 | using namespace std;
23 | using namespace Colloids;
24 |
25 | #ifndef INSTAL_PATH
26 | #define INSTAL_PATH "c:/bin/"
27 | #endif
28 |
29 | int main(int argc, char* argv[])
30 | {
31 | if(argc<2)
32 | {
33 | cout << "Syntax : aquireWisdom [path]filename" << endl;
34 | return EXIT_FAILURE;
35 | }
36 | string inputFile(argv[1]);
37 | try
38 | {
39 | LifReader reader(inputFile);
40 | const size_t serie = reader.chooseSerieNumber();
41 | LifTracker track(reader.getSerie(serie),0, FFTW_EXHAUSTIVE);
42 | cout << "tracker ok"<.
18 | */
19 |
20 | #include "../graphicParticles.hpp"
21 |
22 | using namespace std;
23 | using namespace cimg_library;
24 |
25 | /**
26 | \brief export the xy slices of a 3D image to tiff files.
27 | */
28 | template
29 | void toTiff(const CImg &img, const string &outputPath)
30 | {
31 | ostringstream oss;
32 | oss << img.depth;
33 | const size_t nbZero = string(oss.str()).size();
34 | cimg_for2Z(img,z)
35 | {
36 | ostringstream osz;
37 | osz << z;
38 | string zstr(osz.str());
39 | for(size_t i = zstr.length();i img = Centers.getRepresentation((unsigned char)255,(unsigned char)0);
68 | if(argc>4)
69 | {
70 | float zblur;
71 | sscanf(argv[4],"%f",&zblur);
72 | img.blur(0,0,zblur);
73 | }
74 | if(argc>5)
75 | {
76 | float pNoise;
77 | sscanf(argv[5],"%f",&pNoise);
78 | if(argc>6)
79 | {
80 | sscanf(argv[6],"%u",&tNoise);
81 | img.noise(-pNoise,tNoise);
82 | }
83 | else img.noise(-pNoise);
84 | }
85 |
86 | img.display();
87 |
88 | toTiff(img,outputPath);
89 |
90 | return EXIT_SUCCESS;
91 | }
92 |
--------------------------------------------------------------------------------
/graphic/mains/lifTest.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 | */
19 | #include "../lifFile.hpp"
20 | #include "CImg.h"
21 |
22 | using namespace std;
23 | using namespace cimg_library;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | if(argc<2)
29 | {
30 | cout << "Syntax : liftest [path]filename" << endl;
31 | return EXIT_FAILURE;
32 | }
33 |
34 | const string filename(argv[1]);
35 | LifReader lif(filename);
36 | cout << "LIF version "<size()>3)
39 | do
40 | {
41 | cout<<"Chose a frame between 0 and "<at(3)->NumberOfElements-1<<": ";
42 | cin>>frame;
43 | }
44 | while(lif.Dimensions[serie]->at(3)->NumberOfElementsimg;
46 | switch (lif.Dimensions[serie]->size())
47 | {
48 | case 0:
49 | cerr << "Serie "<at(0)->NumberOfElements);
54 | break;
55 | case 2:
56 | img.assign(
57 | lif.Dimensions[serie]->at(0)->NumberOfElements,
58 | lif.Dimensions[serie]->at(1)->NumberOfElements);
59 | break;
60 | default :
61 | img.assign(
62 | lif.Dimensions[serie]->at(0)->NumberOfElements,
63 | lif.Dimensions[serie]->at(1)->NumberOfElements,
64 | lif.Dimensions[serie]->at(2)->NumberOfElements);
65 | }
66 | cout<<"image constructed"<.
18 |
19 | * \file serieTracker.hpp
20 | * \brief Define a class to track series of 2D image files
21 | * \author Mathieu Leocmach
22 | * \date 11 January 2010
23 | *
24 | *
25 | */
26 | #ifndef serie_tracker_H
27 | #define serie_tracker_file_H
28 |
29 | #include "tracker.hpp"
30 | #include
31 | namespace Colloids{
32 | /** \brief glue between Tracker and image files
33 | Can be used as a stadard InputIterator
34 | */
35 | class SerieTracker : public TrackerIterator
36 | {
37 | public:
38 | explicit SerieTracker(
39 | const std::string &namePattern, boost::array &xyzt,
40 | const double Zratio=1.0,
41 | const size_t ch=0,
42 | const unsigned fs=FFTW_ESTIMATE);
43 | SerieTracker end(){return SerieTracker(length);};
44 | bool reachedEnd(){return getTimeStep()>=length;};
45 |
46 | void setTimeStep(size_t t);
47 | double getZXratio(){return ZXratio;};
48 |
49 | SerieTracker& operator++();
50 | bool operator==(const SerieTracker& rhs) {return (getPattern()==rhs.getPattern()) && (time_step==rhs.time_step);}
51 | //bool operator!=(const SerieTracker& rhs) {return (getPattern()!=rhs.getPattern()) || (time_step!=rhs.time_step);}
52 |
53 | std::string getPattern() const {return namePattern;};
54 | bool has_time() const {return hasTime;}
55 | bool has_depth() const {return hasDepth;}
56 |
57 | private:
58 | boost::format serie;
59 | size_t length;
60 | double ZXratio;
61 | bool hasTime, hasDepth;
62 | std::string namePattern;
63 |
64 | /** \brief default constructor that should be used only to get an "end" iterator*/
65 | SerieTracker(const size_t end_step) {time_step = end_step;};
66 |
67 | };
68 | }
69 | #endif
70 |
--------------------------------------------------------------------------------
/graphic/tinyxml/tinystr.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MathieuLeocmach/colloids/1387ce920d05b57ed28ed5fa4d1337164dd03014/graphic/tinyxml/tinystr.cpp
--------------------------------------------------------------------------------
/graphic/tinyxml/tinyxmlerror.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | www.sourceforge.net/projects/tinyxml
3 | Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
4 |
5 | This software is provided 'as-is', without any express or implied
6 | warranty. In no event will the authors be held liable for any
7 | damages arising from the use of this software.
8 |
9 | Permission is granted to anyone to use this software for any
10 | purpose, including commercial applications, and to alter it and
11 | redistribute it freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must
14 | not claim that you wrote the original software. If you use this
15 | software in a product, an acknowledgment in the product documentation
16 | would be appreciated but is not required.
17 |
18 | 2. Altered source versions must be plainly marked as such, and
19 | must not be misrepresented as being the original software.
20 |
21 | 3. This notice may not be removed or altered from any source
22 | distribution.
23 | */
24 |
25 | #include "tinyxml.h"
26 |
27 | // The goal of the seperate error file is to make the first
28 | // step towards localization. tinyxml (currently) only supports
29 | // english error messages, but the could now be translated.
30 | //
31 | // It also cleans up the code a bit.
32 | //
33 |
34 | const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
35 | {
36 | "No error",
37 | "Error",
38 | "Failed to open file",
39 | "Memory allocation failed.",
40 | "Error parsing Element.",
41 | "Failed to read Element name",
42 | "Error reading Element value.",
43 | "Error reading Attributes.",
44 | "Error: empty tag.",
45 | "Error reading end tag.",
46 | "Error parsing Unknown.",
47 | "Error parsing Comment.",
48 | "Error parsing Declaration.",
49 | "Error document empty.",
50 | "Error null (0) or unexpected EOF found in input stream.",
51 | "Error parsing CDATA.",
52 | "Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
53 | };
54 |
--------------------------------------------------------------------------------
/lib/dynamicClusters.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 | * \file dynamicClusters.hpp
20 | * \brief Defines classes for time tracked clusters
21 | * \author Mathieu Leocmach
22 | * \version 0.1
23 | * \date 23 April 2009
24 | *
25 | */
26 |
27 | #ifndef dynamic_clusters_H
28 | #define dynamic_clusters_H
29 |
30 | #include "dynamicParticles.hpp"
31 | namespace Colloids
32 | {
33 |
34 | void growCluster(std::set &population, std::set &cluster, size_t center, const NgbList &ngbs);
35 | void segregate(std::set &population, std::vector< std::set > &clusters, const NgbList &ngbs);
36 | void segregateAll(std::vector< std::set > &clusters, const Particles &parts);
37 |
38 | /**
39 | \brief Object representing clusters evolving in time
40 | */
41 | class DynamicClusters
42 | {
43 |
44 | public:
45 | /** \brief The DynamicParticles of which the clusters are made of */
46 | DynamicParticles *parts;
47 |
48 | /**
49 | \brief Clusters' members, time step by time step.
50 | The cluster given by members[t][i] is NOT (in general) the same cluster as members[t+1][i]
51 | */
52 | std::deque< std::deque > > members;
53 | /**
54 | \brief The list of the clusters.
55 | The cluster given by members[t][trajectories[i][t]] IS the same cluster as members[t+1][trajectories[i][t+1]]
56 | */
57 | TrajIndex trajectories;
58 |
59 | DynamicClusters(DynamicParticles &dynParts, std::set &population);
60 |
61 | DynamicClusters& assign(DynamicParticles &dynParts, std::set &population);
62 |
63 | void save(FileSerie &serie) const;
64 |
65 | ScalarDynamicField getLabels() const;
66 |
67 | BoundingBox bounds(const std::set &cluster,const size_t &time);
68 |
69 | std::valarray getLargestDelta(const size_t &time);
70 | };
71 | };
72 | #endif
73 |
--------------------------------------------------------------------------------
/lib/fields.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2010 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 |
20 | * \file fields.cpp
21 | * \brief Implement classes to manage fields of values : scalar, vectorial, static or dynamic
22 | * \author Mathieu Leocmach
23 | * \date 3 February 2010
24 | *
25 | */
26 |
27 | #include "fields.hpp"
28 |
29 | using namespace std;
30 | using namespace Colloids;
31 |
32 | /** @brief write as vtk legacy format */
33 | ostream & Colloids::operator<<(std::ostream &os, const ScalarField &s)
34 | {
35 | os<<"SCALARS "<< s.name<<" double\n"
36 | "LOOKUP_TABLE default\n";
37 | copy(
38 | s.values.begin(), s.values.end(),
39 | ostream_iterator(os,"\n")
40 | );
41 | return os;
42 | }
43 |
44 | /** @brief write as vtk legacy format */
45 | ostream & Colloids::operator<<(std::ostream &os, const VectorField &v)
46 | {
47 | os<<"VECTORS "<.
18 | **/
19 |
20 | #include "files_series.hpp"
21 | #include
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | /** @brief Constructor */
27 | FileSerie::FileSerie(const std::string &namePattern, const std::string &token, size_t size, size_t offset) :
28 | token(token), length(size), offset(offset)
29 | {
30 | string head = namePattern, tail;
31 | size_t digits=0, pos = namePattern.rfind(token);
32 |
33 | if(pos==string::npos)
34 | throw invalid_argument(("Name pattern \""+namePattern+"\" doesn't contain token \""+token+"\"").c_str());
35 |
36 | head.resize(pos);
37 | digits = namePattern.find_first_not_of("0123456789", pos+token.size());
38 | tail = namePattern.substr(digits);
39 | digits -= pos+token.size();
40 |
41 | ostringstream os;
42 | os<pattern.parse(os.str());
46 | }
47 | catch(exception &e)
48 | {
49 | cerr<<"head: "<pattern;
61 | fmt.clear();
62 | string pat = (fmt % 0).str();
63 | pat = pat.substr(0, pat.rfind(".")) + ext;
64 | return FileSerie(pat, this->token, this->size(), this->offset);
65 | }
66 |
67 | /** @brief return a new FileSerie with a postfix added just before the token */
68 | FileSerie FileSerie::addPostfix(const std::string &postfix) const
69 | {
70 | boost::format fmt = this->pattern;
71 | fmt.clear();
72 | string pat = (fmt % 0).str();
73 | pat.insert(pat.rfind(this->token), postfix);
74 | return FileSerie(pat, this->token, this->size(), this->offset);
75 | }
76 |
77 | /** @brief return a new FileSerie with a postfix added just before the token and a different extension */
78 | FileSerie FileSerie::addPostfix(const std::string &postfix, const std::string &ext) const
79 | {
80 | boost::format fmt = this->pattern;
81 | fmt.clear();
82 | string pat = (fmt % 0).str();
83 | pat.insert(pat.rfind(this->token), postfix);
84 | pat = pat.substr(0, pat.rfind(".")) + ext;
85 | return FileSerie(pat, this->token, this->size(), this->offset);
86 | }
87 |
88 | /** @brief return the head of the serie, without time dependence, with the given extension */
89 | string FileSerie::head() const
90 | {
91 | boost::format fmt = this->pattern;
92 | fmt.clear();
93 | string pat = (fmt % 0).str();
94 | pat.erase(pat.rfind(this->token));
95 | return pat;
96 | }
97 |
98 | /** @brief get the 0th file (no extention) for a given prefix and a given serie size */
99 | string FileSerie::get0th(const std::string &prefix, const size_t &size, const std::string &token)
100 | {
101 | ostringstream nbframes;
102 | nbframes << size-1;
103 | const size_t digits = std::max(nbframes.str().size(), (size_t)1);
104 | ostringstream os;
105 | os<.
18 |
19 |
20 | * \file files_series.hpp
21 | * \brief Defines classes for time series and z series of files
22 | * \author Mathieu Leocmach
23 | * \version 0.1
24 | * \date 15 December 2008
25 | *
26 | * Define functions and classes relative to the files series for the particle tracking code
27 | *
28 | */
29 |
30 | #ifndef file_series_H
31 | #define file_series_H
32 |
33 | #include
34 |
35 | #include
36 | #include
37 | #include
38 | #include
39 | #include
40 |
41 | namespace Colloids
42 | {
43 | class FileSerie
44 | {
45 | boost::format pattern;
46 | std::string token;
47 | size_t length, offset;
48 |
49 | public:
50 | FileSerie(const std::string &filesPattern, const std::string &token, size_t size, size_t offset=0);
51 | std::string operator%(const size_t &step){this->pattern.clear(); return (pattern%(step+offset)).str();}
52 | size_t size() const {return length;}
53 | size_t get_offset() const {return offset;}
54 | FileSerie changeExt(const std::string &ext) const;
55 | FileSerie addPostfix(const std::string &postfix) const;
56 | FileSerie addPostfix(const std::string &postfix, const std::string &ext) const;
57 | std::string head() const;
58 |
59 | static std::string get0th(const std::string &prefix, const size_t &size, const std::string &token="_t");
60 | };
61 | }
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/lib/index.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 | */
20 |
21 | #include "index.hpp"
22 | using namespace std;
23 | using namespace Colloids;
24 |
25 | /** @brief Get the indices of the objects contained inside a reduction of the maximum bounding box */
26 | vector SpatialIndex::getInside(const double &margin, const bool noZ) const
27 | {
28 | BoundingBox insideBox = getOverallBox();
29 | for(size_t i=0;i<3-noZ;++i)
30 | if(insideBox.edges[i].second-insideBox.edges[i].first>2*margin)
31 | {
32 | insideBox.edges[i].first += margin;
33 | insideBox.edges[i].second -= margin;
34 | }
35 | //gets the indexes of the particles totally contained inside this volume
36 | return (*this)(insideBox);
37 | }
38 |
39 | /** @brief Get objects spanning the whole interval inside the query box */
40 | vector SpatioTemporalIndex::operator()(const BoundingBox &b) const
41 | {
42 | return (*this)(TimeBox(getOverallInterval(),b));
43 | }
44 |
45 | /** @brief Get all the objects spanning the query interval */
46 | vector SpatioTemporalIndex::operator()(const Interval &in) const
47 | {
48 | return (*this)(TimeBox(in,getOverallBox()));
49 | }
50 |
51 | /** @brief Get the indices of the objects spanning the query interval inside a reduction of the maximum bounding box */
52 | vector SpatioTemporalIndex::getSpanningInside(const Interval &in,const double &margin) const
53 | {
54 | BoundingBox insideBox = getOverallBox();
55 | for(size_t i=0;i<3;++i)
56 | if(insideBox.edges[i].second-insideBox.edges[i].first>2*margin)
57 | {
58 | insideBox.edges[i].first += margin;
59 | insideBox.edges[i].second -= margin;
60 | }
61 | //gets the indexes of the particles totally contained inside this volume
62 | return (*this)(TimeBox(in,insideBox));
63 | }
64 |
65 | /** @brief Get the indices of the objects spanning the whole interval inside a reduction of the maximum bounding box
66 | */
67 | vector SpatioTemporalIndex::getInside(const double &margin) const
68 | {
69 | return getSpanningInside(getOverallInterval(),margin);
70 | }
71 |
72 |
73 |
74 | /** @brief insert */
75 | void BruteSpatialIndex::insert(const size_t &i, const BoundingBox &b)
76 | {
77 | if(!overallBox)
78 | overallBox = new BoundingBox(b);
79 | else
80 | overallBox->stretch(b);
81 | items.insert(make_pair(i,b));
82 | }
83 |
84 | /** @brief get all items included in the query box
85 | complexity ~N
86 | */
87 | vector BruteSpatialIndex::operator()(const BoundingBox &b) const
88 | {
89 | list ret;
90 | for(multimap::const_iterator it = items.begin(); it!= items.end();++it)
91 | if(b.encloses(it->second))
92 | ret.push_back(it->first);
93 | ret.sort();
94 | ret.unique();
95 | return vector(ret.begin(), ret.end());
96 | }
97 |
98 | /** @brief Translate all bounding boxes */
99 | void BruteSpatialIndex::operator+=(const Coord &v)
100 | {
101 | for(multimap::iterator it = items.begin(); it!= items.end();++it)
102 | it->second += v;
103 | }
104 |
105 | void RStarIndex_S::insert(const size_t &i, const BoundingBox &b)
106 | {
107 | tree.Insert(i,b);
108 | }
109 |
110 | /** @brief Get the indices of the objects whose bounding boxes are contained inside the query box */
111 | vector RStarIndex_S::operator()(const BoundingBox &b) const
112 | {
113 | list g = tree.Query(RTree::AcceptEnclosing(b), Gatherer()).gathered;
114 | g.sort();
115 | g.unique();
116 | return vector(g.begin(), g.end());
117 | }
118 |
119 | /** @brief insertion */
120 | void TreeIndex_T::insert(const size_t &i, const Interval &in)
121 | {
122 | if(!overallInterval)
123 | overallInterval = new Interval(in);
124 | else
125 | {
126 | overallInterval->first = min(overallInterval->first, in.first);
127 | overallInterval->second = max(overallInterval->second, in.second);
128 | }
129 | for(size_t t = tree.size();t<=in.first;++t)
130 | tree.push_back(new boost::ptr_vector< std::set >);
131 | for(size_t t = tree[in.first].size();t<=in.second-in.first;++t)
132 | tree[in.first].push_back(new std::set);
133 | tree[in.first][in.second-in.first].insert(tree[in.first][in.second-in.first].end(),i);
134 | }
135 |
136 | /** @brief Get the objects spanning at least the query interval */
137 | vector TreeIndex_T::operator()(const Interval &in) const
138 | {
139 | list sel;
140 | for(size_t t0=0;t0<=min(in.first,tree.size());++t0)
141 | for(size_t t1=in.second-in.first;t1(sel.begin(), sel.end());
146 | }
147 |
148 |
--------------------------------------------------------------------------------
/lib/periodic.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 | **/
19 |
20 | #include "periodic.hpp"
21 |
22 | using namespace std;
23 | using namespace Colloids;
24 |
25 | /** \brief Transform a vector for it to be in the boundary conditions */
26 | void PeriodicParticles::periodify(Coord &v) const
27 | {
28 | for(size_t i=0;i<3;++i)
29 | {
30 | if(v[i]>getPeriod(i)/2.0) v[i] -= getPeriod(i);
31 | if(v[i]<=-getPeriod(i)/2.0) v[i] += getPeriod(i);
32 | }
33 | }
34 |
35 |
36 | /** \brief get the difference vector between a position and one of the particles */
37 | Coord PeriodicParticles::getDiff(const Coord &from,const size_t &to) const
38 | {
39 | Coord diff(3);
40 | diff = Particles::getDiff(from,to);
41 | periodify(diff);
42 | return diff;
43 | }
44 | /** \brief get the difference vector between two particles */
45 | Coord PeriodicParticles::getDiff(const size_t &from,const size_t &to) const
46 | {
47 | Coord diff(3);
48 | diff = Particles::getDiff(from,to);
49 | periodify(diff);
50 | return diff;
51 | }
52 |
53 | /** \brief return the number density without margin */
54 | double PeriodicParticles::getNumberDensity() const
55 | {
56 | return size()/bb.area();
57 | }
58 |
59 | /**
60 | \brief get the index of the particle contained inside a reduction of the bounding box.
61 | \param cutoff range to exclude from each side of the box
62 | \return list of all the particles
63 | Dummy function in the case of periodic boundary condition.
64 | */
65 | vector PeriodicParticles::selectInside(const double &margin, const bool noZ) const
66 | {
67 | vector inside(size());
68 | for(size_t i=0;i PeriodicParticles::selectEnclosed(const BoundingBox &b) const
79 | {
80 | //case where the query doesn't get across the boundaries
81 | if(bb.encloses(b))
82 | return Particles::selectEnclosed(b);
83 |
84 | // case where the periodicity has to be taken into account
85 | BoundingBox queryBox = b;
86 | valarray translation(0.0,3);
87 | listtotal;
88 | vectornewParts;
89 | for(int i=-1;i<=1;++i)
90 | {
91 | translation[0]=i*getPeriod(0);
92 | for(int j=-1;j<=1;++j)
93 | {
94 | translation[1]=j*getPeriod(1);
95 | for(int k=-1;k<=1;++k)
96 | {
97 | translation[2]=k*getPeriod(2);
98 | //the query box get translated to an other side of the periodic boundaries
99 | for(size_t d=0;d<3;++d)
100 | {
101 | queryBox.edges[d].first=b.edges[d].first+translation[d];
102 | queryBox.edges[d].second=b.edges[d].second+translation[d];
103 | }
104 | //if ever the box contains no particle, the query on the R*Tree return an empty result in constant time (immediately)
105 | //so no special precaution to discard in advance irrealistic translations of the query box.
106 | newParts = Particles::selectEnclosed(queryBox);
107 | //the new set of particles is added
108 | copy(newParts.begin(),newParts.end(), back_inserter(total));
109 | }
110 | }
111 | }
112 | total.sort();
113 | total.unique();
114 | return vector(total.begin(), total.end());
115 |
116 | }
117 |
--------------------------------------------------------------------------------
/lib/periodic.hpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 |
19 |
20 | * \file periodic.hpp
21 | * \brief Defines classes for particles spatially indexed with periodic boundary conditions
22 | * \author Mathieu Leocmach
23 | * \version 0.1
24 | * \date 29 January 2009
25 | *
26 | */
27 |
28 | #ifndef periodic_particles_H
29 | #define periodic_particles_H
30 |
31 | #include "particles.hpp"
32 |
33 | namespace Colloids
34 | {
35 | /** \brief indexed particles with periodic boundary conditions */
36 | class PeriodicParticles : public Particles
37 | {
38 | public:
39 |
40 | PeriodicParticles(const double &rad) : Particles(0, rad){return;};
41 | PeriodicParticles(const std::vector &input,const double &rad) : Particles(input,rad){return;};
42 | PeriodicParticles(const Particles &input) : Particles(input){return;};
43 | PeriodicParticles(const std::string &filename,const double &rad) : Particles(filename,rad){return;};
44 | PeriodicParticles(const size_t &Nb, const BoundingBox &b, const std::string &filename, const double &rad) : Particles(Nb,b,filename,rad){return;};
45 |
46 | inline double getPeriod(const size_t &d) const;
47 |
48 | void periodify(Coord &v) const;
49 | Coord getDiff(const Coord &from,const size_t &to) const;
50 | Coord getDiff(const size_t &from,const size_t &to) const;
51 | double getNumberDensity() const;
52 | std::vector selectInside(const double &margin, const bool noZ=false) const;
53 | std::vector selectEnclosed(const BoundingBox &b) const;
54 | std::vector selectInside_noindex(const double &margin, const bool noZ=false) const{return this->selectInside(margin, noZ);};
55 | //vector getEuclidianNeighbours(const valarray ¢er, const double &range) const;
56 | };
57 |
58 | /** \brief get the periodicity according to the bounding box */
59 | inline double PeriodicParticles::getPeriod(const size_t &d) const
60 | {
61 | return bb.edges[d].second-bb.edges[d].first;
62 | }
63 | };
64 | #endif
65 |
--------------------------------------------------------------------------------
/liveTrack/FFT.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | using namespace cimg_library;
3 |
4 | int main(int argc, char* argv[]) {
5 | const CImg img = CImg(argv[1]).channel(1);
6 | CImgList<> F = img.get_FFT();
7 | cimglist_apply(F,translate)(img.dimx()/2,img.dimy()/2,0,0,2);
8 | const CImg mag = ((F[0].get_pow(2) + F[1].get_pow(2)).sqrt()+1.0f).log().normalize(0,255);
9 | CImgList visu(img,mag);
10 | CImgDisplay disp(visu,"[#16] - Fourier Filtering (Click to set filter)");
11 | CImg mask(img.dimx(),img.dimy(),1,1,1);
12 | unsigned char one[] = { 1 }, zero[] = { 0 }, white[] = { 255 };
13 | int rmin = 0, rmax = 256;
14 | while (!disp.is_closed && !disp.is_keyQ && !disp.is_keyESC) {
15 | disp.wait();
16 | const int
17 | xm = disp.mouse_x*2*img.dimx()/disp.dimx()-img.dimx(),
18 | ym = disp.mouse_y*img.dimy()/disp.dimy(),
19 | x = xm-img.dimx()/2,
20 | y = ym-img.dimy()/2;
21 | if (disp.button && xm>=0 && ym>=0) {
22 | const int r = (int)cimg::max(0.0f,(float)std::sqrt((float)x*x+y*y)-3.0f);
23 | if (disp.button&1) rmax = r;
24 | if (disp.button&2) rmin = r;
25 | if (rmin>=rmax) rmin = cimg::max(rmax-1,0);
26 | mask.fill(0).draw_circle(mag.dimx()/2,mag.dimy()/2,rmax,one).
27 | draw_circle(mag.dimx()/2,mag.dimy()/2,rmin,zero);
28 | CImgList<> nF(F);
29 | cimglist_for(F,l) nF[l].mul(mask).translate(-img.dimx()/2,-img.dimy()/2,0,0,2);
30 | visu[0] = nF.FFT(true)[0].normalize(0,255);
31 | }
32 | if (disp.is_resized) disp.resize(disp.window_dimx(),disp.window_dimx()/2).display(visu);
33 | visu[1] = mag.get_mul(mask).draw_text(5,5,white,zero,11,0.6f,"Freq Min/Max = %d / %d",(int)rmin,(int)rmax);
34 | visu.display(disp);
35 | }
36 | return 0;
37 | }
38 |
--------------------------------------------------------------------------------
/liveTrack/liveTrack2D.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | using namespace cimg_library;
4 |
5 | int main(int argc, char* argv[]) {
6 | const CImg img = CImg(argv[1]).channel(1).normalize(0,255);
7 | CImgList<> F = img.get_FFT();
8 | cimglist_apply(F,translate)(img.dimx()/2,img.dimy()/2,0,0,2);
9 | const CImg mag = ((F[0].get_pow(2) + F[1].get_pow(2)).sqrt()+1.0f).log().normalize(0,255);
10 | CImg tracked(img.dimx(),img.dimy(),img.dimz(),2,0);
11 | tracked.get_shared_channel(0)=img;
12 | CImg treated(tracked);
13 | CImgList visu(treated,mag,tracked);
14 | CImgDisplay disp(visu,"Fourier Filtering (Click on the middle image to set filter)");
15 | CImg hist(256,65,1,1,0);
16 | CImgDisplay histo(hist, "Histogram (Clic to set threshold)");
17 | CImg mask(img.dimx(),img.dimy(),1,1,1),thr_mask(mask);
18 | unsigned char one[] = { 1 }, zero[] = { 0 }, white[] = { 255 },grey[]={127};
19 | int fminx = 0, fmaxx = img.dimx(),fminy = 0, fmaxy = img.dimy();
20 | unsigned char thr=0;
21 | hist.draw_graph(img.get_histogram(),white).display(histo);
22 | while (!disp.is_closed && !disp.is_keyQ && !disp.is_keyESC) {
23 | disp.wait_all();
24 | const int
25 | xm = disp.mouse_x*3*img.dimx()/disp.dimx()-img.dimx(),
26 | ym = disp.mouse_y*img.dimy()/disp.dimy(),
27 | x = xm-img.dimx()/2,
28 | y = ym-img.dimy()/2;
29 | //histo.wait();
30 | const int xh = histo.mouse_x*hist.dimx()/histo.dimx();
31 | //std::cout << xh <=0 && xh<256)
33 | {
34 | thr=xh;
35 | }
36 | if (disp.button && xm>=0 && ym>=0 && xm=fmaxx) fminx = cimg::max(fmaxx-1,0);
57 | if (fminy>=fmaxy) fminy = cimg::max(fmaxy-1,0);
58 | mask.fill(0).draw_ellipse(mag.dimx()/2,mag.dimy()/2,(float)fmaxx,(float)fmaxy,0,0,one).
59 | draw_ellipse(mag.dimx()/2,mag.dimy()/2,(float)fminx,(float)fminy,0,0,zero);
60 | CImgList<> nF(F);
61 | cimglist_for(F,l) nF[l].mul(mask).translate(-img.dimx()/2,-img.dimy()/2,0,0,2);
62 | visu[0].get_shared_channel(0) = nF.FFT(true)[0].normalize(0,255);
63 | }
64 | if (disp.is_resized) disp.resize(disp.window_dimx(),disp.window_dimx()/2).display(visu);
65 | visu[1] = mag.get_mul(mask).draw_text(5,5,white,zero,11,0.6f,"Radiusx Min/Max = %f / %f\nRadiusy Min/Max = %f / %f",((float)img.dimx())/((float)fmaxx)/2.0,((float)img.dimx())/((float)fminx)/2.0,((float)img.dimy())/((float)fmaxy)/2.0,((float)img.dimx())/((float)fminy)/2.0);
66 | hist.fill(0).draw_rectangle(0,0,thr,64,grey).draw_graph(visu[0].get_shared_channel(0).get_histogram(),white).draw_text(5,5,white,zero,11,0.6f,"Thr = %u",thr);
67 | visu[0].get_shared_channel(1) = 128*(1-visu[0].get_shared_channel(0).get_threshold(thr));
68 | visu[2].get_shared_channel(1) = (visu[0].get_shared_channel(0)-visu[0].get_shared_channel(0).get_dilate(3)).exp().threshold(0.9999).mul(visu[0].get_shared_channel(0).get_threshold(thr))*255;
69 | visu.display(disp);
70 | hist.display(histo);
71 | }
72 | return 0;
73 | }
74 |
--------------------------------------------------------------------------------
/m4/ltsugar.m4:
--------------------------------------------------------------------------------
1 | # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
2 | #
3 | # Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
4 | # Written by Gary V. Vaughan, 2004
5 | #
6 | # This file is free software; the Free Software Foundation gives
7 | # unlimited permission to copy and/or distribute it, with or without
8 | # modifications, as long as this notice is preserved.
9 |
10 | # serial 6 ltsugar.m4
11 |
12 | # This is to help aclocal find these macros, as it can't see m4_define.
13 | AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
14 |
15 |
16 | # lt_join(SEP, ARG1, [ARG2...])
17 | # -----------------------------
18 | # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
19 | # associated separator.
20 | # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
21 | # versions in m4sugar had bugs.
22 | m4_define([lt_join],
23 | [m4_if([$#], [1], [],
24 | [$#], [2], [[$2]],
25 | [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
26 | m4_define([_lt_join],
27 | [m4_if([$#$2], [2], [],
28 | [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
29 |
30 |
31 | # lt_car(LIST)
32 | # lt_cdr(LIST)
33 | # ------------
34 | # Manipulate m4 lists.
35 | # These macros are necessary as long as will still need to support
36 | # Autoconf-2.59 which quotes differently.
37 | m4_define([lt_car], [[$1]])
38 | m4_define([lt_cdr],
39 | [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
40 | [$#], 1, [],
41 | [m4_dquote(m4_shift($@))])])
42 | m4_define([lt_unquote], $1)
43 |
44 |
45 | # lt_append(MACRO-NAME, STRING, [SEPARATOR])
46 | # ------------------------------------------
47 | # Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
48 | # Note that neither SEPARATOR nor STRING are expanded; they are appended
49 | # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
50 | # No SEPARATOR is output if MACRO-NAME was previously undefined (different
51 | # than defined and empty).
52 | #
53 | # This macro is needed until we can rely on Autoconf 2.62, since earlier
54 | # versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
55 | m4_define([lt_append],
56 | [m4_define([$1],
57 | m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
58 |
59 |
60 |
61 | # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
62 | # ----------------------------------------------------------
63 | # Produce a SEP delimited list of all paired combinations of elements of
64 | # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
65 | # has the form PREFIXmINFIXSUFFIXn.
66 | # Needed until we can rely on m4_combine added in Autoconf 2.62.
67 | m4_define([lt_combine],
68 | [m4_if(m4_eval([$# > 3]), [1],
69 | [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
70 | [[m4_foreach([_Lt_prefix], [$2],
71 | [m4_foreach([_Lt_suffix],
72 | ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
73 | [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
74 |
75 |
76 | # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
77 | # -----------------------------------------------------------------------
78 | # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
79 | # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
80 | m4_define([lt_if_append_uniq],
81 | [m4_ifdef([$1],
82 | [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
83 | [lt_append([$1], [$2], [$3])$4],
84 | [$5])],
85 | [lt_append([$1], [$2], [$3])$4])])
86 |
87 |
88 | # lt_dict_add(DICT, KEY, VALUE)
89 | # -----------------------------
90 | m4_define([lt_dict_add],
91 | [m4_define([$1($2)], [$3])])
92 |
93 |
94 | # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
95 | # --------------------------------------------
96 | m4_define([lt_dict_add_subkey],
97 | [m4_define([$1($2:$3)], [$4])])
98 |
99 |
100 | # lt_dict_fetch(DICT, KEY, [SUBKEY])
101 | # ----------------------------------
102 | m4_define([lt_dict_fetch],
103 | [m4_ifval([$3],
104 | m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
105 | m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
106 |
107 |
108 | # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
109 | # -----------------------------------------------------------------
110 | m4_define([lt_if_dict_fetch],
111 | [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
112 | [$5],
113 | [$6])])
114 |
115 |
116 | # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
117 | # --------------------------------------------------------------
118 | m4_define([lt_dict_filter],
119 | [m4_if([$5], [], [],
120 | [lt_join(m4_quote(m4_default([$4], [[, ]])),
121 | lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
122 | [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
123 | ])
124 |
--------------------------------------------------------------------------------
/m4/ltversion.m4:
--------------------------------------------------------------------------------
1 | # ltversion.m4 -- version numbers -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004 Free Software Foundation, Inc.
4 | # Written by Scott James Remnant, 2004
5 | #
6 | # This file is free software; the Free Software Foundation gives
7 | # unlimited permission to copy and/or distribute it, with or without
8 | # modifications, as long as this notice is preserved.
9 |
10 | # @configure_input@
11 |
12 | # serial 3294 ltversion.m4
13 | # This file is part of GNU Libtool
14 |
15 | m4_define([LT_PACKAGE_VERSION], [2.4])
16 | m4_define([LT_PACKAGE_REVISION], [1.3294])
17 |
18 | AC_DEFUN([LTVERSION_VERSION],
19 | [macro_version='2.4'
20 | macro_revision='1.3294'
21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
22 | _LT_DECL(, macro_revision, 0)
23 | ])
24 |
--------------------------------------------------------------------------------
/mains/ISF.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 | **/
19 | #include
20 | #include "dynamicParticles.hpp"
21 |
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | if(argc<4)
29 | {
30 | cout << "compute Self Intermediate scattering function for sub-time intervals"< ISF;
45 | boost::format name (inputPath+"_%1%from_%2%to_%3%av.isf");
46 | for(size_t i=0;iparts.getNbTimeSteps() || stop+av+1>parts.getNbTimeSteps())
52 | throw invalid_argument
53 | (
54 | (boost::format("[%1%,%2%] not included in [0,%3%]") % start % (stop+av) % (parts.getNbTimeSteps()-1)).str()
55 | );
56 | cout<<"["<" << endl;
57 | ISF = parts.getSelfISF(start,stop,av);
58 |
59 | //export to file
60 | ofstream output((name % start %stop %av).str().c_str(), std::ios::out | std::ios::trunc);
61 | output <<"#t\tISF"< MSD;
24 | boost::format name (inputPath+"_%1%from_%2%to_%3%av.msd");
25 | for(size_t i=0;iparts.getNbTimeSteps() || stop+av+1>parts.getNbTimeSteps())
31 | throw invalid_argument
32 | (
33 | (boost::format("[%1%,%2%] not included in [0,%3%]") % start % (stop+av) % (parts.getNbTimeSteps()-1)).str()
34 | );
35 | cout<<"["<" << endl;
36 | MSD = parts.getMSD(start,stop,av);
37 |
38 | //export to file
39 | ofstream output((name % start %stop %av).str().c_str(), std::ios::out | std::ios::trunc);
40 | output <<"#t\tMSD"<.
18 | **/
19 |
20 | #include "dynamicParticles.hpp"
21 | #include
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | try
29 | {
30 | if(argc<2)
31 | {
32 | cerr<<"syntax: all_bonds [path]filename.traj"<> radius >> delta_t;
50 | trajfile.ignore(1); //escape the endl
51 | getline(trajfile, pattern); //pattern is on the 2nd line
52 | getline(trajfile, token); //token is on the 3rd line
53 | trajfile >> offset >> span;
54 | pattern.insert(0, path);
55 |
56 |
57 | cout< positions(span);
67 | for(size_t t=0; t total_g(200, 0.0);
81 | {
82 | ifstream in((datSerie.head()+".rdf").c_str());
83 | if(in.good())
84 | {
85 | cout<<"load "<> total_g[r] >> total_g[r];
90 | }
91 | else
92 | {
93 | cout<<"calculate rdf and save it to "< g = positions[t].getRdf(200,15.0);
100 | for(int r=0; r<(int)g.size(); ++r)
101 | total_g[r] += g[r];
102 | ++show_pr;
103 | }
104 | ofstream rdfFile((datSerie.head()+".rdf").c_str(), ios::out | ios::trunc);
105 | rdfFile << "#r\tg(r)"<::iterator first_peak = total_g.begin();
114 | size_t first_min;
115 | do
116 | {
117 | first_peak = max_element(total_g.begin(),total_g.end());
118 | first_min = distance(total_g.begin(), min_element(first_peak,total_g.end()));
119 | //cout<<"first_peak="< inside, secondInside;
137 | //create neighbour list and export bonds
138 | positions[t].makeNgbList(bondLength);
139 | bonds = positions[t].getBonds();
140 | ofstream bondFile((bondSerie%t).c_str(), ios::out | ios::trunc);
141 | copy(bonds.begin(), bonds.end(), ostream_iterator(bondFile, "\n"));
142 | bondFile.close();
143 |
144 | //remove neigbour list from memory (can be heavy)
145 | positions[t].delNgbList();
146 | ++(*show_progress);
147 |
148 | }
149 | }
150 | }
151 | catch(const exception &e)
152 | {
153 | cerr<< e.what()<.
18 | **/
19 |
20 | #include "dynamicParticles.hpp"
21 |
22 | #include
23 |
24 | using namespace std;
25 | using namespace Colloids;
26 |
27 | int main(int argc, char ** argv)
28 | {
29 | if(argc<3)
30 | {
31 | cout << "Average the positions over time"<> radius >> dt;
56 | trajfile.ignore(1); //escape the endl
57 | getline(trajfile, pattern); //pattern is on the 2nd line
58 | getline(trajfile, token); //token is on the 3rd line
59 | trajfile >> offset >> size;
60 | trajfile.close();
61 | }
62 | //File series
63 | FileSerie datSerie(path+os.str()+pattern, token, size, offset);
64 | cout<<"load"<.
18 | **/
19 |
20 | //Define the preprocessor variable "periodic" if you want periodic boundary conditions
21 | #include "periodic.hpp"
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | try
29 | {
30 | if(argc<2) throw invalid_argument("Syntax : coordinateFile [maxBondLength]");
31 |
32 | const string filename(argv[1]);
33 | const string inputPath = filename.substr(0,filename.find_last_of("."));
34 | const string ext = filename.substr(filename.find_last_of(".")+1);
35 | double maxBondLength = 0.0;
36 | BondSet bonds;
37 | Particles parts(filename,1);
38 | parts.makeRTreeIndex();
39 | if(argc>2)
40 | maxBondLength = atof(argv[2]);
41 | else
42 | {
43 | vector g = parts.getRdf(200,15.0);
44 | //set the max bond length as the first minima of g(r)
45 | //the loop is here only to get rid of possible multiple centers at small r
46 | vector::iterator first_peak = g.begin();
47 | size_t first_min;
48 | do
49 | {
50 | first_peak = max_element(g.begin(),g.end());
51 | first_min = distance(g.begin(), min_element(first_peak,g.end()));
52 | }
53 | while(g[first_min]==0.0);
54 | }
55 | parts.makeNgbList(maxBondLength);
56 | bonds = parts.getBonds();
57 | ofstream output((inputPath + ".bonds").c_str(), ios::out | ios::trunc);
58 | for(BondSet::const_iterator b=bonds.begin(); b!= bonds.end();++b)
59 | output<low()<<" "<high()<<"\n";
60 | }
61 | catch(const exception &e)
62 | {
63 | cerr<< e.what()< boof,Sboof;
25 | map::iterator booit;
26 | set inside = parts.getRealInside(1.4*2.0*radius);
27 | for(set::iterator p=inside.begin();p!=inside.end();++p)
28 | {
29 | set EuNgb = parts.getEuclidianNeighbours(parts[*p],1.4*2.0*radius);
30 | if(EuNgb.size()>1)
31 | {
32 | booit = boof.insert(boof.end(),make_pair(*p,boo_five()));
33 | for(set::iterator n=EuNgb.begin();n!=EuNgb.end();++n)
34 | if( *p != *n)
35 | booit->second += boo_five(parts.getDiff(*p,*n));
36 | booit->second /= (double)(EuNgb.size()-1);
37 | }
38 | }
39 |
40 | //coarse grained
41 | set second_inside = parts.getRealInside(2.0*1.4*2.0*radius);
42 | map::const_iterator bofit;
43 | for(set::iterator p=second_inside.begin();p!=second_inside.end();++p)
44 | {
45 | set EuNgb = parts.getEuclidianNeighbours(parts[*p],1.4*2.0*radius);
46 | booit = Sboof.insert(Sboof.end(),make_pair(*p,boo_five()));
47 | for(set::iterator n=EuNgb.begin();n!=EuNgb.end();++n)
48 | {
49 | bofit=boof.find(*p);
50 | if(bofit!=boof.end());
51 | booit->second += (*bofit).second;
52 | }
53 | }
54 |
55 | vector q5(2);
56 | q5[0].first = new string("q5");
57 | q5[1].first = new string("Sq5");
58 | q5[0].second = new map();
59 | q5[1].second = new map();
60 | for(bofit=boof.begin();bofit!=boof.end();++bofit)
61 | q5[0].second->insert(q5[0].second->end(),make_pair(bofit->first,bofit->second.getQ5()));
62 | for(bofit=Sboof.begin();bofit!=Sboof.end();++bofit)
63 | q5[1].second->insert(q5[1].second->end(),make_pair(bofit->first,bofit->second.getQ5()));
64 |
65 | parts.exportToVTK(inputPath+"_five.vtk",q5);
66 | }
67 | catch(const exception &e)
68 | {
69 | cerr<< e.what()<.
18 | **/
19 |
20 | #include "particles.hpp"
21 | #include "files_series.hpp"
22 | #include
23 | #include
24 |
25 | namespace po = boost::program_options;
26 | using namespace std;
27 | using namespace Colloids;
28 |
29 | int main(int argc, char ** argv)
30 | {
31 | try
32 | {
33 | string filename, token, outputPostfix;
34 | double minSep;
35 | size_t t_offset;
36 | po::options_description
37 | compulsory_options("Compulsory options"),
38 | additional_options("Additional options"),
39 | cmdline_options("Command-line options");
40 | compulsory_options.add_options()
41 | ("input", po::value(&filename), "input file or pattern")
42 | ("minSep", po::value(&minSep), "Minimum separation between particles (in pixels)")
43 | ;
44 | po::positional_options_description pd;
45 | pd.add("input", 1);
46 | pd.add("minSep", 2);
47 | additional_options.add_options()
48 | ("help", "produce help message")
49 | ("token", po::value(&token)->default_value("_t"), "Token delimiting time step number (for time series only)")
50 | ("span", po::value(), "Number of time steps to process (compulsory for time series)")
51 | ("offset", po::value(&t_offset)->default_value(0), "Starting time step")
52 | ("both", "Removes both particles if they are closer than minSep (removes only the second one by default, ie the dimmer one)")
53 | ("outputPostfix,o", po::value(&outputPostfix)->default_value(""), "If empty output prefix is given, overwrites the files.")
54 | ;
55 |
56 | cmdline_options.add(compulsory_options).add(additional_options);
57 |
58 | po::variables_map vm;
59 | po::store(po::command_line_parser(argc, argv).
60 | options(cmdline_options).positional(pd).run(), vm);
61 |
62 | if (vm.count("help") || (!vm.count("input") && !vm.count("minSep")))
63 | {
64 | cout << "cutter input minSep [options]\n";
65 | cout << cmdline_options << "\n";
66 | return EXIT_SUCCESS;
67 | }
68 | po::notify(vm);
69 |
70 | const string inputPath = filename.substr(0,filename.find_last_of("."));
71 | const string ext = filename.substr(filename.find_last_of(".")+1);
72 |
73 | if(vm.count("span"))
74 | {
75 | cout<<"file serie"<(), t_offset),
77 | outSerie = datSerie.addPostfix(outputPostfix, ".dat");
78 | boost::progress_display show_progress(vm["span"].as());
79 | if(vm.count("both"))
80 | for(size_t t=0; t(); ++t)
81 | {
82 | Particles parts(datSerie%t);
83 | parts.makeRTreeIndex();
84 | parts.removeShortRange(minSep).exportToFile(outSerie%t);
85 | ++show_progress;
86 | }
87 | else
88 | for(size_t t=0; t(); ++t)
89 | {
90 | Particles(datSerie%t).cut(minSep).exportToFile(outSerie%t);
91 | ++show_progress;
92 | }
93 | }
94 | else
95 | if(vm.count("both"))
96 | {
97 | Particles parts(filename);
98 | parts.makeRTreeIndex();
99 | parts.removeShortRange(minSep).exportToFile(inputPath+outputPostfix+".dat");
100 | }
101 | else
102 | Particles(filename).cut(minSep).exportToFile(inputPath+outputPostfix+".dat");
103 |
104 |
105 | }
106 | catch(const exception &e)
107 | {
108 | cerr<< e.what()<.
18 | **/
19 |
20 | //Define the preprocessor variable "periodic" if you want periodic boundary conditions
21 | #include "periodic.hpp"
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | try
29 | {
30 | if(argc<3) throw invalid_argument("Syntax : dat2vtk coordinateFile");
31 |
32 | const string filename(argv[1]);
33 | const string inputPath = filename.substr(0,filename.find_last_of("."));
34 | const string ext = filename.substr(filename.find_last_of(".")+1);
35 | const size_t tokenPos = inputPath.rfind("_t");
36 |
37 | Particles parts(filename);
38 | BondSet bonds = loadBonds(inputPath+".bonds");
39 |
40 | boost::multi_array qw, Sqw;
41 | parts.loadBoo(inputPath+".cloud", qw);
42 |
43 | parts.loadBoo(
44 | inputPath.substr(0, tokenPos)+"_space"+inputPath.substr(tokenPos)+".cloud",
45 | Sqw);
46 | vector scalars;
47 | scalars.reserve(8);
48 | for(size_t i=0;i<4;++i)
49 | scalars.push_back(ScalarField(qw.begin(), qw.end(), "", i));
50 | for(size_t i=0;i<4;++i)
51 | scalars.push_back(ScalarField(Sqw.begin(), Sqw.end(), "", i));
52 | for(size_t i=0;i<8;++i)
53 | scalars[i].name = string(i/4?"cg":"")+string((i/2)%2?"W":"Q")+string(i%2?"6":"4");
54 |
55 | parts.exportToVTK(inputPath+".vtk", bonds, scalars, vector());
56 | }
57 | catch(const exception &e)
58 | {
59 | cerr<< e.what()< drift(0.0,3);
28 | output << "t\tx\ty\tz" << endl;
29 |
30 | for(size_t t=0;t.
18 | **/
19 |
20 | #include "dynamicParticles.hpp"
21 |
22 | using namespace std;
23 | using namespace Colloids;
24 |
25 | int main(int argc, char ** argv)
26 | {
27 | if(argc<3)
28 | {
29 | cout << "compute both Mean Square displacement and Self Intermediate scattering function for maximum averaging."<2)?atoi(argv[2]):1;
40 |
41 | try
42 | {
43 | DynamicParticles parts(filename);
44 | if(mode==0 || mode==2)
45 | {
46 | cout <<"No drift removal"<.
18 | **/
19 |
20 |
21 | #include "dynamicParticles.hpp"
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | if(argc<5)
29 | {
30 | cout << "Syntax : linker [path]filename token radius time_step t_span t_offset(0)" << endl;
31 | return EXIT_FAILURE;
32 | }
33 |
34 | const string filename(argv[1]), token(argv[2]);
35 | const double radius = atof(argv[3]),
36 | time_step= atof(argv[4]);
37 | const size_t t_span = atoi(argv[5]),
38 | t_offset = (argc<7)?0:atoi(argv[6]);
39 |
40 | try
41 | {
42 | FileSerie files(filename, token, t_span, t_offset);
43 | DynamicParticles parts(files, radius, time_step);
44 | cout << "total of " << parts.trajectories.size() << " trajectories" << endl;
45 |
46 | const string head = filename.substr(0,filename.rfind(token));
47 | const string nofolder = filename.substr(filename.find_last_of("/\\")+1);
48 | parts.save(head+".traj",nofolder,token,t_offset,t_span);
49 |
50 | }
51 | catch(const std::exception &e)
52 | {
53 | cerr <.
18 | **/
19 |
20 | #include "dynamicClusters.hpp"
21 |
22 | using namespace std;
23 | using namespace Colloids;
24 |
25 | int main(int argc, char ** argv)
26 | {
27 | if(argc<3)
28 | {
29 | cout << "Syntax : percolation [path]filename.dat radius range" << endl;
30 | cout << "\tOR"<> offset >> size;
60 | trajfile.close();
61 | }
62 | FileSerie datSerie(path+pattern, token, size, offset),
63 | bondSerie = datSerie.changeExt(".bonds"),
64 | clustSerie = datSerie.changeExt(".cluster");
65 |
66 |
67 | //create the population of trajectories to split into clusters : all trajectories
68 | set alltraj;
69 | for(size_t tr=0;trlow()<<" "<high()<<"\n";
91 | }
92 | }
93 |
94 |
95 | cout<<"finding the clusters ... ";
96 | DynamicClusters clusters(parts, alltraj);
97 | cout<<"done!"<.
18 | **/
19 |
20 | //Define the preprocessor variable "use_periodic" if you want periodic boundary conditions
21 | #include "periodic.hpp"
22 |
23 | using namespace std;
24 | using namespace Colloids;
25 |
26 | int main(int argc, char ** argv)
27 | {
28 | try
29 | {
30 |
31 | if(argc<5)
32 | {
33 | cout << "Syntax : [periodic_]rdf [path]filename radius NbOfBins range" << endl;
34 | cout << " range is in diameter unit" << endl;
35 | return EXIT_FAILURE;
36 | }
37 |
38 | cout << "Radial Distribution function" << endl;
39 | const string filename(argv[1]);
40 | const string inputPath = filename.substr(0,filename.find_last_of("."));
41 | const double radius = atof(argv[2]),
42 | nbDiameterCutOff = atof(argv[4]);
43 | const size_t Nbins = atoi(argv[3]);
44 |
45 | //construct the particle container out of the datafile
46 | #ifdef use_periodic
47 | if(argc<9)
48 | {
49 | cout << "Syntax : periodic_rdf [path]filename radius NbOfBins range Nb dx dy dz" << endl;
50 | cout << " range is in diameter unit" << endl;
51 | return EXIT_FAILURE;
52 | }
53 | const size_t Nb = atoi(argv[5]);
54 | BoundingBox b;
55 | for(size_t d=0;d<3;++d)
56 | {
57 | b.edges[d].first=0.0;
58 | b.edges[d].second = atof(argv[6+d]);
59 | }
60 | PeriodicParticles Centers(Nb,b,filename,radius);
61 | cout << "With periodic boundary conditions"< g = Centers.getRdf(Nbins,nbDiameterCutOff);
71 | cout << " done !" << endl;
72 |
73 | ofstream output((inputPath + ".rdf").c_str(), ios::out | ios::trunc);
74 | output<<"#r\tg"<.
18 | **/
19 |
20 | //Define the preprocessor variable "use_periodic" if you want periodic boundary conditions
21 | #include "periodic.hpp"
22 | #include "files_series.hpp"
23 |
24 | using namespace std;
25 | using namespace Colloids;
26 |
27 | int main(int argc, char ** argv)
28 | {
29 | try
30 | {
31 | if(argc<5)
32 | {
33 | cout << "Radial Distribution function" << endl;
34 | cout << "Syntax : totalRdf [path]filename _t NbOfBins range" << endl;
35 | cout << " range is in pixel unit." << endl;
36 | return EXIT_FAILURE;
37 | }
38 |
39 | const string filename(argv[1]), token(argv[2]);
40 | const string inputPath = filename.substr(0,filename.rfind(token));
41 | const double range = atof(argv[4]);
42 | const size_t Nbins = atoi(argv[3]);
43 | cout<<"Nbins="< gTot(Nbins,0.0);
47 | FileSerie datSerie(filename, token, 1);
48 | size_t t=0;
49 |
50 | try
51 | {
52 | while(true)
53 | {
54 | Particles parts(datSerie%(t++), 1.0);
55 | parts.makeRTreeIndex();
56 | vector g = parts.getRdf(Nbins,range);
57 | transform(g.begin(),g.end(),gTot.begin(),gTot.begin(),plus());
58 | }
59 | }
60 | catch(invalid_argument &e){};
61 | ofstream rdfFile((datSerie.head()+".rdf").c_str(), ios::out | ios::trunc);
62 | rdfFile << "#r\tg(r)"<::iterator firstPeak = max_element(gTot.begin(),gTot.end());
66 | vector::iterator firstMin = min_element(firstPeak,gTot.end());
67 | cout<<(firstPeak-gTot.begin())*range/Nbins<<"\t"<<2.0*(firstPeak-gTot.begin())/(double)(firstMin-gTot.begin())<
10 | #include
11 |
12 | namespace Colloids {
13 |
14 | Convolver::Convolver(unsigned long int size) : _size(size), _fourier_size(size/2+1)
15 | {
16 | this->real = (float *) fftwf_malloc(sizeof(float) * this->_size);
17 | this->fourier = (fftwf_complex *) fftwf_malloc(sizeof(fftwf_complex) * this->_fourier_size);
18 | this->forward = fftwf_plan_dft_r2c_1d(this->_size, this->real, this->fourier,
19 | FFTW_MEASURE);
20 | this->backward = fftwf_plan_dft_c2r_1d(this->_size, this->fourier, this->real,
21 | FFTW_MEASURE);
22 | }
23 |
24 | Convolver::~Convolver()
25 | {
26 | fftwf_destroy_plan(this->forward);
27 | fftwf_destroy_plan(this->backward);
28 | fftwf_free(real); fftwf_free(fourier);
29 | }
30 |
31 | void Convolver::spectrum(const float *input, int step, float *output)
32 | {
33 | this->fill(input, step);
34 | fftwf_execute(this->forward);
35 | for (unsigned long int i=0; i_fourier_size; ++i)
36 | *output++ = std::norm(*reinterpret_cast*>(this->fourier+i));
37 | }
38 |
39 | void Convolver::operator()(float* input, const int step, const float* kernel)
40 | {
41 | this->fill(input, step);
42 | fftwf_execute(this->forward);
43 | for(unsigned long int i=0; i_fourier_size; ++i)
44 | {
45 | const float factor = *kernel++ / this->_size;
46 | this->fourier[i][0] *= factor;
47 | this->fourier[i][1] *= factor;
48 | }
49 | fftwf_execute(this->backward);
50 | for (unsigned long int i=0; i_size; ++i)
51 | {
52 | *input = this->real[i];
53 | input += step;
54 | }
55 | }
56 | void Convolver::fill(const float* input, const int step)
57 | {
58 | for(size_t i=0; i_size; ++i)
59 | {
60 | this->real[i] = *input;
61 | input += step;
62 | }
63 | if(this->windowing())
64 | {
65 | for(size_t i=0; i_size; ++i)
66 | this->real[i] *= this->window[i];
67 | }
68 | }
69 | void Convolver::set_hanning()
70 | {
71 | this->window.resize(this->size(), 1.0);
72 | for(int i=0; isize(); ++i)
73 | this->window[i] = 0.5 *(1.0 - cos(2*M_PI*i/(this->size()-1)));
74 | }
75 |
76 | std::vector get_spectrum_1d(const cv::Mat_ &im, const int axis, const bool windowing)
77 | {
78 | if(axis >= im.dims)
79 | throw std::invalid_argument("Matrix dimension is too small to compute the spectrum along this axis");
80 | assert(im.isContinuous());
81 | Convolver co(im.size[axis]);
82 | if(windowing)
83 | co.set_hanning();
84 | std::vector spectrum(co.fourier_size());
85 | std::vector tot(co.fourier_size(), 0.0);
86 | std::vector > totf(co.fourier_size(), 0.0);
87 | unsigned long int step = im.step1(axis);
88 | //whatever the real dimension, we fall back to a 3d situation where the axis of interest is y
89 | //and either x or z can be of size 1
90 | int nbplanes = 1;
91 | for(int d=0; d(im.data) + i*planestep + j, step, &spectrum[0]);
101 | for(size_t u=0; u get_deconv_kernel(const cv::Mat_ &im, const int good_axis, const int bad_axis, const double size_ratio)
114 | {
115 | std::vector bad_sp = get_spectrum_1d(im, bad_axis);
116 | std::vector good_sp = get_spectrum_1d(im, good_axis);
117 | //linear interpolation of good_sp to take into account the voxel size ratio
118 | const double qratio = bad_sp.size() * size_ratio / good_sp.size();
119 | std::vector scaled(std::min(bad_sp.size(), (size_t)((good_sp.size()-1)*qratio)), 0);
120 | for(size_t i=0; i kernel(bad_sp.size(), 1.0f);
129 | for(size_t i=0; i1.0f)
131 | kernel[i] = sqrt(scaled[i]/bad_sp[i]);
132 | return kernel;
133 | }
134 |
135 | void convolve(cv::Mat_ &im, const int axis, const float* kernel)
136 | {
137 | if(axis >= im.dims)
138 | throw std::invalid_argument("Matrix dimension is too small to convolve along this axis");
139 | assert(im.isContinuous());
140 | Convolver co(im.size[axis]);
141 | unsigned long int step = im.step1(axis);
142 | //whatever the real dimension, we fall back to a 3d situation where the axis of interest is y
143 | //and either x or z can be of size 1
144 | int nbplanes = 1;
145 | for(int d=0; d(im.data) + i*planestep + j, step, kernel);
153 | }
154 | }
155 |
--------------------------------------------------------------------------------
/multiscale/src/deconvolution.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * deconvolution.hpp
3 | *
4 | * Created on: 13 avr. 2012
5 | * Author: mathieu
6 | */
7 |
8 | #ifndef DECONVOLUTION_HPP_
9 | #define DECONVOLUTION_HPP_
10 |
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | namespace Colloids {
17 |
18 | class Convolver
19 | {
20 | public:
21 | //constructor, destructor
22 | Convolver(unsigned long int size);
23 | ~Convolver();
24 |
25 | //accessors
26 | int size(){return this->_size;}
27 | int fourier_size(){return this->_fourier_size;}
28 | const std::complex* get_fourier(){return reinterpret_cast*>(this->fourier);}
29 |
30 | //processing
31 | /**
32 | * \brief Compute the spectrum of a (possibly discontinuous) input
33 | */
34 | void spectrum(const float* input, const int step, float* output);
35 | /**
36 | * \brief Convolve in place the (possibly discontinuous) input with the kernel (given in Fourier space)
37 | */
38 | void operator()(float* input, const int step, const float* kernel);
39 | /**
40 | * \brief set the window function to Hanning
41 | */
42 | void set_hanning();
43 | void unset_window(){this->window.clear();}
44 | bool windowing(){return !this->window.empty();}
45 |
46 | protected:
47 | unsigned long int _size;
48 | unsigned long int _fourier_size;
49 | float* real;
50 | fftwf_complex* fourier;
51 | fftwf_plan forward, backward;
52 | std::vector window;
53 | void fill(const float* input, const int step);
54 | };
55 |
56 | std::vector get_spectrum_1d(const cv::Mat_ &im, const int axis=0, const bool windowing=true);
57 | std::vector get_deconv_kernel(const cv::Mat_ &im, const int good_axis, const int bad_axis, const double size_ratio=1.0);
58 | void convolve(cv::Mat_ &im, const int axis, const float* kernel);
59 |
60 | }
61 |
62 | #endif /* DECONVOLUTION_HPP_ */
63 |
--------------------------------------------------------------------------------
/multiscale/src/locatorfromlif.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * liffinder.cpp
3 | *
4 | * Created on: 11 août 2011
5 | * Author: mathieu
6 | */
7 |
8 | #include "locatorfromlif.hpp"
9 |
10 | namespace Colloids {
11 |
12 | LocatorFromLif::LocatorFromLif(LifSerie * serie):
13 | serie(serie), t(0), input(serie->begin())
14 | {
15 | this->dims = serie->getSpatialDimensions();
16 | this->total_z = this->dims.size()>2 ? this->dims[2] : 1;
17 | this->total_t = serie->getNbTimeSteps();
18 | this->finder.reset(new MultiscaleFinder2D(dims[0], dims[1]));
19 | this->slice.create(dims[0], dims[1]);
20 | this->slice.setTo(0);
21 | }
22 |
23 | LocatorFromLif::~LocatorFromLif() {
24 | // TODO Auto-generated destructor stub
25 | }
26 |
27 | void LocatorFromLif::clear()
28 | {
29 | this->slice.setTo(0);
30 | this->rec.clear();
31 | }
32 |
33 | /** \brief Read the next 2D slice from the lif file, track it and add it to the reconstructor */
34 | void LocatorFromLif::fill_next_slice()
35 | {
36 | std::vector centers;
37 | if(this->t >= this->total_t || this->get_z() >= this->total_z)
38 | throw std::out_of_range("End of file reached");
39 | this->serie->fill2DBuffer(static_cast(this->slice.data), 0, this->get_z());//this->t, this->get_z());
40 | this->finder->get_centers(this->slice, centers);
41 | this->rec.push_back(centers);
42 | }
43 |
44 | void LocatorFromLif::fill_time_step()
45 | {
46 | //ensure that we start at the beginning of the stack
47 | this->clear();
48 | //track each slice
49 | for(size_t z=0; ztotal_z; ++z)
50 | this->fill_next_slice();
51 | }
52 | void LocatorFromLif::get_centers(Centers & centers)
53 | {
54 |
55 | //3D reconstruction
56 | //this->rec.split_clusters();
57 | this->rec.get_blobs(centers);
58 | //convert the z coordinate according to the z-spacing of acquisition
59 | for(Centers::iterator c=centers.begin(); c!=centers.end(); ++c)
60 | (*c)[2] *= this->serie->getZXratio();
61 | this->t++;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/multiscale/src/locatorfromlif.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * liffinder.h
3 | *
4 | * Created on: 11 août 2011
5 | * Author: mathieu
6 | */
7 |
8 | #ifndef LIFFINDER_H_
9 | #define LIFFINDER_H_
10 |
11 | #include "lifFile.hpp"
12 | #include "reconstructor.hpp"
13 | #include "multiscalefinder.hpp"
14 |
15 | namespace Colloids {
16 |
17 | class LocatorFromLif {
18 | public:
19 | typedef Reconstructor::OutputType Centers;
20 | explicit LocatorFromLif(LifSerie * serie);
21 | virtual ~LocatorFromLif();
22 |
23 | //accessors
24 | const Reconstructor & get_reconstructor() const {return this->rec;};
25 | const cv::Mat_ & get_slice() const {return this->slice;};
26 | const size_t get_z() const {return get_reconstructor().size();}
27 | const size_t size() const {return total_t;}
28 | const size_t & get_t() const {return t;}
29 | const MultiscaleFinder2D& get_finder() const{return *finder;}
30 |
31 | //processing
32 | void clear();
33 | void fill_next_slice();
34 | void fill_time_step();
35 | void get_centers(Centers ¢ers);
36 |
37 | private:
38 | LifSerie * serie;
39 | std::auto_ptr finder;
40 | Reconstructor rec;
41 | cv::Mat_ slice;
42 | std::vector dims;
43 | size_t t, total_t, total_z;
44 | std::istreambuf_iterator input;
45 | };
46 |
47 | }
48 |
49 | #endif /* LIFFINDER_H_ */
50 |
--------------------------------------------------------------------------------
/multiscale/src/reconstructor.hpp:
--------------------------------------------------------------------------------
1 | /*
2 | * reconstructor.h
3 | *
4 | * Created on: 3 août 2011
5 | * Author: mathieu
6 | */
7 |
8 | #ifndef RECONSTRUCTOR_H_
9 | #define RECONSTRUCTOR_H_
10 |
11 | #include "center.hpp"
12 | #include "traj.hpp"
13 | #include
14 | #include
15 | #include
16 |
17 | namespace Colloids
18 | {
19 |
20 | class Reconstructor :boost::noncopyable
21 | {
22 | public:
23 | typedef std::list Cluster;
24 | typedef std::vector Frame;
25 | typedef std::deque OutputType;
26 | typedef RStarTree RTree;
27 |
28 | Reconstructor();
29 | virtual ~Reconstructor();
30 |
31 | //accessors
32 | inline bool empty() const {return !trajectories.get();}
33 | inline const size_t size() const {return empty()?0:trajectories->nbFrames();}
34 | inline const size_t nb_cluster() const {return clusters.size();}
35 | inline const std::deque& get_clusters() const {return clusters;}
36 | inline const TrajIndex& get_trajectories() const {assert(!empty()); return *trajectories;}
37 |
38 | //processing
39 | void clear();
40 | void push_back(const Frame &fr, const double &max_dist=1.0);
41 | void split_clusters();
42 | void get_blobs(OutputType& blobs);
43 |
44 | private:
45 | std::auto_ptr trajectories;
46 | std::deque clusters;
47 | Frame last_frame;
48 |
49 | void links_by_brute_force(const Frame& fr, std::vector &distances, std::vector &from, std::vector &to, const double &tolerance=1.0) const;
50 | void links_by_RStarTree(const Frame& fr, const RTree& tree, std::vector &distances, std::vector &from, std::vector &to, const double &max_dist=1.0) const;
51 | void links_by_kdtree(const Frame& fr, std::vector &distances, std::vector &from, std::vector &to, const double &tolerance=1.0) const;
52 |
53 | };
54 |
55 | }
56 |
57 | #endif /* RECONSTRUCTOR_H_ */
58 |
--------------------------------------------------------------------------------
/multiscale/src/traj.cpp:
--------------------------------------------------------------------------------
1 | /**
2 | Copyright 2008,2009 Mathieu Leocmach
3 |
4 | This file is part of Colloids.
5 |
6 | Colloids is free software: you can redistribute it and/or modify
7 | it under the terms of the GNU General Public License as published by
8 | the Free Software Foundation, either version 3 of the License, or
9 | (at your option) any later version.
10 |
11 | Colloids is distributed in the hope that it will be useful,
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | GNU General Public License for more details.
15 |
16 | You should have received a copy of the GNU General Public License
17 | along with Colloids. If not, see .
18 | **/
19 |
20 | #include "traj.hpp"
21 | #include
22 | #include
23 |
24 | using namespace std;
25 |
26 | namespace Colloids {
27 |
28 | struct Link : std::pair
29 | {
30 | double distance;
31 | Link(const size_t &a, const size_t &b, const double &distance) :
32 | std::pair(a,b), distance(distance){};
33 |
34 | bool operator<(const Link &other) const {return this->distancetr2pos.push_back(new Traj(0, p));
43 | this->pos2tr.push_back(new std::vector(nb_initial_positions));
44 | for(size_t p=0; ppos2tr[0][p] = p;
46 | }
47 |
48 | void TrajIndex::add_Frame(const size_t &frame_size, const std::vector &distances, const std::vector &p_from, const std::vector &p_to)
49 | {
50 | if(distances.size() != p_from.size() || p_from.size() != p_to.size())
51 | throw std::invalid_argument("TrajIndex::add_Frame: All arguments must have the same size");
52 | if(!p_to.empty() && *std::max_element(p_to.begin(), p_to.end()) >= frame_size)
53 | throw std::invalid_argument("TrajIndex::add_Frame: The largest particle index in the new frame is larger than the new frame size");
54 | std::list bonds;
55 | for(size_t i=0; i< distances.size(); ++i)
56 | bonds.push_back(Link(p_from[i], p_to[i], distances[i]));
57 | //sort the bonds by increasing distances
58 | bonds.sort();
59 | //any position can be linked only once
60 | std::vector from_used(this->pos2tr.back().size(), false), to_used(frame_size, false);
61 | //create the new frame
62 | this->pos2tr.push_back(new std::vector(frame_size));
63 | //link the bounded positions into trajectories
64 | for(std::list::const_iterator b= bonds.begin(); b!=bonds.end(); ++b)
65 | if(!from_used[b->first] && !to_used[b->second])
66 | {
67 | from_used[b->first] = true;
68 | to_used[b->second] = true;
69 | const size_t tr = this->pos2tr[this->pos2tr.size()-2][b->first];
70 | this->pos2tr.back()[b->second] = tr;
71 | this->tr2pos[tr].push_back(b->second);
72 | }
73 | //the trajectories of the previous frame that are not linked in the new frame are terminated by construction
74 | //but the trajectories starting in the new frame have to be created
75 | for(size_t p=0; ppos2tr.back()[p] = this->tr2pos.size();
79 | this->tr2pos.push_back(new Traj(this->pos2tr.size()-1, p));
80 | }
81 | }
82 |
83 | } //Name space
84 |
--------------------------------------------------------------------------------
/multiscale/test/lifTrack.cpp:
--------------------------------------------------------------------------------
1 | #define BOOST_TEST_DYN_LINK
2 |
3 | #include "../src/multiscalefinder.hpp"
4 | #include "../src/traj.hpp"
5 | #include "../src/reconstructor.hpp"
6 | #include "../src/locatorfromlif.hpp"
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 |
16 | using namespace Colloids;
17 | using namespace boost::posix_time;
18 |
19 | BOOST_AUTO_TEST_SUITE( LifTrack )
20 | /*BOOST_AUTO_TEST_CASE( fill_one_slice )
21 | {
22 | LifReader reader("/home/mathieu/Code_data/liftest/Tsuru11dm_phi=52.53_J36.lif");
23 | LocatorFromLif locator(&reader.getSerie(0));
24 | BOOST_CHECK_EQUAL(cv::sum(locator.get_slice())[0], 0);
25 | locator.fill_next_slice();
26 | BOOST_CHECK_EQUAL(cv::sum(locator.get_slice())[0], 5357342);
27 | BOOST_CHECK_EQUAL(locator.get_reconstructor().size(), 1);
28 | locator.clear();
29 | BOOST_CHECK_EQUAL(cv::sum(locator.get_slice())[0], 0);
30 | BOOST_CHECK_EQUAL(locator.get_z(), 0);
31 | MultiscaleFinder2D finder;
32 | cv::Mat_ slice(256, 256, (unsigned char)0);
33 | reader.getSerie(0).fill2DBuffer(static_cast(slice.data), 0, 114);
34 | std::vector centers = finder(slice);
35 | for(size_t l=1; l Clusters;
65 | const Clusters & clusters = locator.get_reconstructor().get_clusters();
66 | Clusters::const_iterator cl_min=clusters.begin();
67 | int count_file =0;
68 | //their may be too many clusters than the maximum of int type, so we have to divide in several files
69 | while(cl_min!=clusters.end())
70 | {
71 | Clusters::const_iterator cl_max = cl_min;
72 | size_t nb = 0, nb_cl=0;
73 | while(cl_max!=clusters.end() && (nb + cl_max->size() + nb_cl +1 < (size_t)std::numeric_limits::max()))
74 | {
75 | nb += cl_max->size();
76 | nb_cl++;
77 | cl_max++;
78 | }
79 | std::cout<<"file "<begin(); p!=cl->end(); ++p)
90 | {
91 | for(size_t d=0;d<3;++d)
92 | f_cl<<(*p)[d]<<" ";
93 | f_cl<<"\n";
94 | }
95 | f_cl<< "LINES "<size()<<" ";
100 | for(size_t p=0; psize();++p)
101 | f_cl<< l++ <<" ";
102 | f_cl<<"\n";
103 | }
104 | f_cl<<"POINT_DATA "<begin(); p!=cl->end(); ++p)
109 | f_cl<< p->r <<"\n";
110 | f_cl<<"SCALARS response double\n"
111 | "LOOKUP_TABLE default\n";
112 | for(Clusters::const_iterator cl=cl_min;cl!=cl_max;++cl)
113 | for(Cluster::const_iterator p = cl->begin(); p!=cl->end(); ++p)
114 | f_cl<< p->intensity <<"\n";
115 | f_cl.close();
116 | cl_min = cl_max;
117 | }
118 |
119 | LocatorFromLif::Centers centers;
120 | {
121 | std::cout<<"get_centers ";
122 | boost::progress_timer ti;
123 | locator.get_centers(centers);
124 | }
125 | std::cout<