Skip to content

Commit dca7e7f

Browse files
authored
Merge pull request #165 from AdaptiveParticles/develop
bump master
2 parents dd08691 + e8b221a commit dca7e7f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3557
-2164
lines changed

.github/workflows/cmake.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CMake
1+
name: Build and Test
22

33
on:
44
push:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ cmake-build-debug/
217217
cmake-build-release/
218218
cmake-build*
219219
xcode*
220+
build-cmake-debug/
221+
build-cmake-release/
220222
#####
221223
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
222224
#

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ option(APR_DENOISE "enable denoising code" OFF)
2525

2626
# Validation of options
2727
if (NOT APR_BUILD_SHARED_LIB AND NOT APR_BUILD_STATIC_LIB)
28-
message(FATAL_ERROR "At least one target: APR_BUILD_SHARED_LIB or APR_BUILD_STATIC_LIB must be build!")
28+
message(FATAL_ERROR "At least one target: APR_BUILD_SHARED_LIB or APR_BUILD_STATIC_LIB must be enabled")
2929
endif()
3030
if (NOT APR_USE_LIBTIFF)
3131
if (APR_TESTS OR APR_BUILD_EXAMPLES)
32-
message(FATAL_ERROR "Building tests orexamples not possible when APR_USE_LIBTIFF=OFF!")
32+
message(FATAL_ERROR "Building tests or examples is not possible when APR_USE_LIBTIFF=OFF")
3333
endif()
3434
endif()
3535

@@ -42,7 +42,7 @@ list(APPEND CMAKE_MODULE_PATH
4242
###############################################################################
4343

4444
set (APR_VERSION_MAJOR 2)
45-
set (APR_VERSION_MINOR 0)
45+
set (APR_VERSION_MINOR 1)
4646
set (APR_VERSION_PATCH 0)
4747
set (APR_VERSION_STRING ${APR_VERSION_MAJOR}.${APR_VERSION_MINOR}.${APR_VERSION_PATCH})
4848

@@ -355,7 +355,7 @@ endif(APR_BUILD_EXAMPLES)
355355
if(APR_TESTS)
356356
message(STATUS "APR: Building tests")
357357
if(APR_PREFER_EXTERNAL_GTEST)
358-
find_package(GTest 1.8.0)
358+
find_package(GTest 1.10.0)
359359
endif()
360360
if(GTEST_FOUND)
361361
include_directories(${GTEST_INCLUDE_DIRS})

INSTALL_INSTRUCTIONS.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# Install instructions for LibAPR.
22

3-
The way to use it is configure it via some new APR_* variables (can be set to ON/OFF depending on needs) which describes what to build and if it should be installed through cmake commands:
3+
The build is configured it via several CMake options (APR_* variables), which can be set to ON/OFF depending on your needs.
4+
The following options control the build type and installation:
45

5-
APR_BUILD_STATIC_LIB=ON
6-
APR_BUILD_SHARED_LIB=OFF
7-
APR_INSTALL=ON
8-
(all other configuration possibilities are now in the top of CMakeLists.txt file)
6+
- APR_BUILD_STATIC_LIB=ON
7+
- APR_BUILD_SHARED_LIB=OFF
8+
- APR_INSTALL=ON
9+
10+
See [README](README.md) for the full list of build options.
911

1012
## OSX / UNIX Installation
1113

12-
so full command line would look like: (-DCMAKE_INSTALL_PREFIX=/tmp/APR can be used for a non-default location)
14+
The full command-line to install the library may look like:
1315

1416
```
1517
mkdir build
@@ -18,35 +20,34 @@ cmake -DAPR_INSTALL=ON -DAPR_BUILD_STATIC_LIB=ON -DAPR_BUILD_SHARED_LIB=OFF ..
1820
make
1921
make install
2022
```
21-
22-
You may need file-permissions (sudo for the install)
23+
with other build options turned on/off as required. Non-default install locations can be set via
24+
`-DCMAKE_INSTALL_PREFIX=/tmp/APR`. Depending on the location, you may need file-permissions (sudo) for the install command.
2325

2426
## Windows Installation Clang
2527

26-
``
28+
On Windows the install commands may look like:
29+
30+
```
2731
cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_TOOLCHAIN_FILE="PATH_TO_VCPKG\vcpkg\scripts\buildsystems\vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -T ClangCL -DAPR_BUILD_STATIC_LIB=ON -DAPR_BUILD_SHARED_LIB=OFF -DAPR_INSTALL=ON ..
2832
cmake --build . --config Release
29-
``
30-
31-
Need to be in a console running as administrator.
32-
33-
``
3433
cmake --install .
35-
``
34+
```
3635

37-
## Minimal example CMAKE
36+
(Probably need to be in a console running as administrator)
3837

39-
To use APR the minimalistic CMakeLists.txt file can be found here: https://github.com/AdaptiveParticles/APR_cpp_project_example
38+
## Minimal CMake example
4039

41-
##
40+
A minimalistic CMakeLists.txt file for using LibAPR in another C++ project can be found here: https://github.com/AdaptiveParticles/APR_cpp_project_example
4241

43-
APR::staticLib (Note, tested across Windows, Linux, and Mac)
44-
APR::sharedLib (Note, not tested)
42+
### Notes:
4543

46-
If shared version is preferred then APR::sharedLib should be used (and of course APR_BUILD_SHARED_LIB=ON during lib build step).
44+
If shared version is preferred then `APR::sharedLib` should be used (and of course APR_BUILD_SHARED_LIB=ON during the build step).
4745

48-
NOTICE: if APR is installed in not standard directory then some hint for cmake must be provided by adding install dir to CMAKE_PREFIX_PATH like for above example:
46+
Use of `APR::staticLib` has been tested across Windows, Linux, and Mac.
47+
`APR::sharedLib` has currently only been tested on Linux.
4948

49+
If APR is installed in a non-standard location then some hint for cmake must be provided by adding the install directory
50+
to CMAKE_PREFIX_PATH, for example:
5051
```
5152
export CMAKE_PREFIX_PATH=/tmp/APR:$CMAKE_PREFIX_PATH
5253
```

README.md

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,24 @@ Labeled Zebrafish nuclei: Gopi Shah, Huisken Lab ([MPI-CBG](https://www.mpi-cbg.
1212

1313
## Python support
1414

15-
We now provide python wrappers in a separate repository [PyLibAPR](https://github.com/AdaptiveParticles/PyLibAPR)
15+
We provide python wrappers in a separate repository [pyapr](https://github.com/AdaptiveParticles/pyapr). This is likely
16+
the simplest option to first try and use the APR.
1617

17-
In addition to providing wrappers for most of the LibAPR functionality, the Python library contains a number of new features that simplify the generation and handling of the APR. For example:
18+
In addition to providing wrappers for most of the LibAPR functionality, the Python library contains a number of new
19+
features that simplify the generation and handling of the APR. For example:
1820

1921
* Interactive APR conversion
2022
* Interactive APR z-slice viewer
2123
* Interactive APR raycast (maximum intensity projection) viewer
2224
* Interactive lossy compression of particle intensities
2325

24-
25-
## Version 2.0 release notes
26-
27-
The library has changed significantly since release 1.1. __There are changes to IO and iteration that are not compatible
28-
with the older version__.
29-
30-
* New (additional) linear access data structure, explicitly storing coordinates in the sparse dimension,
31-
similar to Compressed Sparse Row.
32-
* Block-based decomposition of the APR generation pipeline, allowing conversion of very large images.
33-
* Expanded and improved functionality for image processing directly on the APR:
34-
* APR filtering (spatial convolutions).
35-
* [APRNumerics](./src/numerics/APRNumerics.hpp) module, including e.g. gradient computations and Richardson-Lucy deconvolution.
36-
* CUDA GPU-accelerated convolutions and RL deconvolution (currently only supports dense 3x3x3 and 5x5x5 stencils)
37-
38-
3926
## Dependencies
4027

4128
* HDF5 1.8.20 or higher
4229
* OpenMP > 3.0 (optional, but recommended)
4330
* CMake 3.6 or higher
4431
* LibTIFF 4.0 or higher
4532

46-
47-
NB: This update to 2.0 introduces changes to IO and iteration that are not compatable with old versions.
48-
4933
If compiling with APR_DENOISE flag the package also requires:
5034
* Eigen3.
5135

@@ -67,6 +51,7 @@ cmake -DAPR_USE_OPENMP=OFF ..
6751

6852
| Option | Description | Default value |
6953
|:--|:--|:--|
54+
| APR_INSTALL | Install library | OFF |
7055
| APR_BUILD_SHARED_LIB | Build shared library | OFF |
7156
| APR_BUILD_STATIC_LIB | Build static library | ON |
7257
| APR_BUILD_EXAMPLES | Build executable examples | OFF |
@@ -76,15 +61,18 @@ cmake -DAPR_USE_OPENMP=OFF ..
7661
| APR_PREFER_EXTERNAL_GTEST | Use installed gtest instead of included sources | ON |
7762
| APR_PREFER_EXTERNAL_BLOSC | Use installed blosc instead of included sources | ON |
7863
| APR_USE_OPENMP | Enable multithreading via OpenMP | ON |
79-
| APR_USE_CUDA | Enable CUDA (Under development - APR conversion pipeline is currently not working with CUDA enabled) | OFF |
64+
| APR_USE_CUDA | Enable CUDA functionality (under development) | OFF |
65+
| APR_DENOISE | Enable denoising code (requires Eigen3) | OFF |
8066

8167
### Building on Linux
8268

83-
On Ubuntu, install the `cmake`, `build-essential`, `libhdf5-dev` and `libtiff5-dev` packages (on other distributions, refer to the documentation there, the package names will be similar). OpenMP support is provided by the GCC compiler installed as part of the `build-essential` package.
69+
On Ubuntu, install the `cmake`, `build-essential`, `libhdf5-dev` and `libtiff5-dev` packages (on other distributions,
70+
refer to the documentation there, the package names will be similar). OpenMP support is provided by the GCC compiler
71+
installed as part of the `build-essential` package.
8472

85-
For denoising support also requires: `libeigen3-dev`
73+
Denoising support also requires `libeigen3-dev`.
8674

87-
In the directory of the cloned repository, run
75+
In the directory of the cloned repository, run:
8876

8977
```
9078
mkdir build
@@ -97,9 +85,11 @@ This will create the `libapr.so` library in the `build` directory.
9785

9886
### Building on OSX
9987

100-
On OSX, install the `cmake`, `hdf5` and `libtiff` [homebrew](https://brew.sh) packages and have the [Xcode command line tools](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) installed.
88+
On OSX, install the `cmake`, `hdf5` and `libtiff` [homebrew](https://brew.sh) packages and have the
89+
[Xcode command line tools](http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) installed.
10190

102-
If you want to compile with OpenMP support (Recommended), also install the `llvm` and `libomp` package via homebrew as the clang version shipped by Apple currently does not support OpenMP.
91+
If you want to compile with OpenMP support (Recommended), also install the `llvm` and `libomp` package via homebrew as
92+
the clang version shipped by Apple currently does not support OpenMP.
10393

10494
In the directory of the cloned repository, run
10595

@@ -160,11 +150,11 @@ Note: not recently tested.
160150

161151
## Install instructions
162152

163-
Please see: INSTALL_INSTRUCTIONS.md and https://github.com/AdaptiveParticles/APR_cpp_project_example for a minimal project using the APR.
153+
Please see [INSTALL_INSTRUCTIONS](INSTALL_INSTRUCTIONS.md) and https://github.com/AdaptiveParticles/APR_cpp_project_example for a minimal project using the APR.
164154

165155
## Examples and Documentation
166156

167-
There are 12 basic examples, that show how to generate and compute with the APR. These can be built by adding
157+
There are 14 basic examples, that show how to generate and compute with the APR. These can be built by adding
168158
-DAPR_BUILD_EXAMPLES=ON to the cmake command.
169159

170160
| Example | How to ... |
@@ -181,10 +171,13 @@ There are 12 basic examples, that show how to generate and compute with the APR.
181171
| [Example_compute_gradient](./examples/Example_compute_gradient.cpp) | compute the gradient magnitude of an APR. |
182172
| [Example_apr_filter](./examples/Example_apr_filter.cpp) | apply a filter (convolution) to an APR. |
183173
| [Example_apr_deconvolution](./examples/Example_apr_deconvolution.cpp) | perform Richardson-Lucy deconvolution on an APR. |
174+
| [Exampe_denoise](./examples/Example_denoise.cpp) | denoise an APR (experimental) |
175+
| [Example_lazy_access](./examples/Example_lazy_access.cpp) | lazily iterate over APR particles and their spatial properties |
184176

185177
All examples except `Example_get_apr` and `Example_get_apr_by_block` require an already produced APR, such as those created by `Example_get_apr*`.
186178

187-
For tutorial on how to use the examples, and explanation of data-structures see [the library guide](./docs/lib_guide.pdf).
179+
For tutorial on how to use the examples, and explanation of data-structures see [the library guide](./docs/lib_guide.pdf)
180+
(note: this is outdated - in particular code examples may not work and some discussed parameters do not exist anymore).
188181

189182
## LibAPR Tests
190183

@@ -196,7 +189,9 @@ on the command line in your build folder. Please let us know by creating an issu
196189

197190
## Java wrappers
198191

199-
Basic Java wrappers can be found at [LibAPR-java-wrapper](https://github.com/krzysg/LibAPR-java-wrapper) Not compatable with recent releases.
192+
Basic Java wrappers can be found at [LibAPR-java-wrapper](https://github.com/AdaptiveParticles/LibAPR-java-wrapper).
193+
194+
Note: not compatable with recent releases.
200195

201196
## Coming soon
202197

benchmarks/BenchCudaAccessInit.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ inline void bench_access_full(APR& apr,ParticleData<partsType>& parts,int num_re
7070

7171
for(int r = 0; r < 5; ++r) {
7272
auto access = apr.gpuAPRHelper();
73-
access.init_gpu();
73+
access.init_gpu(true);
7474
error_check ( cudaDeviceSynchronize() )
7575
error_check( cudaGetLastError() )
7676

7777
auto tree_access = apr.gpuTreeHelper();
78-
tree_access.init_gpu();
78+
tree_access.init_gpu(true);
7979
error_check ( cudaDeviceSynchronize() )
8080
error_check( cudaGetLastError() )
8181
}
@@ -84,14 +84,14 @@ inline void bench_access_full(APR& apr,ParticleData<partsType>& parts,int num_re
8484
for(int r = 0; r < num_rep; ++r) {
8585
timer2.start_timer("apr access");
8686
auto access = apr.gpuAPRHelper();
87-
access.init_gpu();
87+
access.init_gpu(true);
8888
error_check ( cudaDeviceSynchronize() )
8989
timer2.stop_timer();
9090
apr_time += timer2.timings.back();
9191

9292
timer2.start_timer("tree access");
9393
auto tree_access = apr.gpuTreeHelper();
94-
tree_access.init_gpu();
94+
tree_access.init_gpu(true);
9595
error_check ( cudaDeviceSynchronize() )
9696
timer2.stop_timer();
9797
tree_time += timer2.timings.back();
@@ -115,12 +115,12 @@ inline void bench_access_partial(APR& apr,ParticleData<partsType>& parts,int num
115115

116116
for(int r = 0; r < 5; ++r) {
117117
auto tree_access = apr.gpuTreeHelper();
118-
tree_access.init_gpu();
118+
tree_access.init_gpu(true);
119119
error_check ( cudaDeviceSynchronize() )
120120
error_check( cudaGetLastError() )
121121

122122
auto access = apr.gpuAPRHelper();
123-
access.init_gpu(tree_access);
123+
access.init_gpu(tree_access, true);
124124
error_check ( cudaDeviceSynchronize() )
125125
error_check( cudaGetLastError() )
126126
}
@@ -130,14 +130,14 @@ inline void bench_access_partial(APR& apr,ParticleData<partsType>& parts,int num
130130

131131
timer2.start_timer("tree access");
132132
auto tree_access = apr.gpuTreeHelper();
133-
tree_access.init_gpu();
133+
tree_access.init_gpu(true);
134134
error_check ( cudaDeviceSynchronize() )
135135
timer2.stop_timer();
136136
tree_time += timer2.timings.back();
137137

138138
timer2.start_timer("apr access");
139139
auto access = apr.gpuAPRHelper();
140-
access.init_gpu(tree_access);
140+
access.init_gpu(tree_access, true);
141141
error_check ( cudaDeviceSynchronize() )
142142
timer2.stop_timer();
143143
apr_time += timer2.timings.back();

benchmarks/BenchIO.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,11 @@ inline void bench_apr_io(APR& apr,ParticleData<partsType>& parts,int num_rep,Ana
106106

107107
aprFile.open(file_name,"WRITE");
108108

109-
aprFile.set_read_write_tree(false);
110-
111109
for (int r = 0; r < num_rep; ++r) {
112110

113111
timer_steps.start_timer("write_apr");
114112

115-
aprFile.write_apr(apr,r);
113+
aprFile.write_apr(apr, r, "t", false);
116114

117115
timer_steps.stop_timer();
118116

@@ -132,8 +130,6 @@ inline void bench_apr_io(APR& apr,ParticleData<partsType>& parts,int num_rep,Ana
132130

133131
aprFile.open(file_name,"READ");
134132

135-
aprFile.set_read_write_tree(false);
136-
137133
for (int r = 0; r < num_rep; ++r) {
138134

139135
timer_steps.start_timer("read_apr");

benchmarks/BenchPartData.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ inline void bench_lazy_particle_data(APR& apr,ParticleData<partsType>& parts,int
155155

156156
LazyData<uint16_t> parts_lazy;
157157

158-
parts_lazy.init_file(writeFile,"parts",true);
158+
parts_lazy.init(writeFile, "parts");
159159

160160
parts_lazy.open();
161161

benchmarks/BenchPipeline.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ inline void bench_apr_pipeline(APR& apr,ParticleData<partsType>& parts,int num_r
8686

8787
aprFile.open("file_name","WRITE");
8888

89-
aprFile.set_read_write_tree(false);
90-
9189
for (int r = 0; r < num_rep; ++r) {
9290

9391
timer_steps.start_timer("get_apr");
@@ -98,13 +96,13 @@ inline void bench_apr_pipeline(APR& apr,ParticleData<partsType>& parts,int num_r
9896

9997
timer_steps.start_timer("sample_parts");
10098

101-
part_vec[r].sample_parts_from_img_downsampled(apr_vec[r],pipelineImage);
99+
part_vec[r].sample_image(apr_vec[r], pipelineImage);
102100

103101
timer_steps.stop_timer();
104102

105103
timer_steps.start_timer("write_apr");
106104

107-
aprFile.write_apr(apr_vec[r],r);
105+
aprFile.write_apr(apr_vec[r], r, "t", false);
108106

109107
timer_steps.stop_timer();
110108

benchmarks/FilterBenchmarks.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,13 +817,13 @@ inline void bench_richardson_lucy_apr(APR& apr, ParticleData<partsType>& parts,
817817

818818
// burn-in
819819
for(int i = 0; i < num_rep/10; ++i) {
820-
richardson_lucy(access, tree_access, input_gpu.get(), output_gpu.get(), stencil_gpu.get(), stencil_gpu.get(), 5, niter, true);
820+
APRNumericsGPU::richardson_lucy(access, tree_access, input_gpu.get(), output_gpu.get(), stencil_gpu.get(), stencil_gpu.get(), 5, niter, true);
821821
}
822822
cudaDeviceSynchronize();
823823

824824
timer.start_timer("richardson lucy");
825825
for(int i = 0; i < num_rep; ++i) {
826-
richardson_lucy(access, tree_access, input_gpu.get(), output_gpu.get(), stencil_gpu.get(), stencil_gpu.get(), 5, niter, true);
826+
APRNumericsGPU::richardson_lucy(access, tree_access, input_gpu.get(), output_gpu.get(), stencil_gpu.get(), stencil_gpu.get(), 5, niter, true);
827827
}
828828
cudaDeviceSynchronize();
829829
timer.stop_timer();

0 commit comments

Comments
 (0)