Skip to content

Commit e8b221a

Browse files
authored
Merge pull request #176 from AdaptiveParticles/bump_version_2.1.0
Bump version 2.1.0
2 parents c869596 + f084452 commit e8b221a

File tree

6 files changed

+68
-84
lines changed

6 files changed

+68
-84
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 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

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

src/numerics/APRNumericsGPU.cu

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -209,32 +209,17 @@ void APRNumericsGPU::richardson_lucy(GPUAccessHelper& access, GPUAccessHelper& t
209209

210210
VectorData<stencilType> psf_vec;
211211
VectorData<stencilType> psf_flipped_vec;
212-
213-
if(use_stencil_downsample) {
214-
APRStencil::get_downsampled_stencils(psf, psf_vec, access.level_max() - access.level_min(), normalize_stencil);
215-
APRStencil::get_downsampled_stencils(psf_flipped, psf_flipped_vec, access.level_max() - access.level_min(), normalize_stencil);
216-
}
212+
const int num_levels = use_stencil_downsample ? access.level_max() - access.level_min() : 1;
213+
APRStencil::get_downsampled_stencils(psf, psf_vec, num_levels, normalize_stencil);
214+
APRStencil::get_downsampled_stencils(psf_flipped, psf_flipped_vec, num_levels, normalize_stencil);
217215

218216
output.resize(input.size());
219217

220-
/// allocate GPU memory
221-
ScopedCudaMemHandler<inputType*, JUST_ALLOC> input_gpu(input.data(), input.size());
218+
/// allocate GPU memory and copy data
219+
ScopedCudaMemHandler<inputType*, H2D> input_gpu(input.data(), input.size());
222220
ScopedCudaMemHandler<stencilType*, JUST_ALLOC> output_gpu(output.data(), output.size());
223-
ScopedCudaMemHandler<stencilType*, JUST_ALLOC> psf_gpu;
224-
ScopedCudaMemHandler<stencilType*, JUST_ALLOC> psf_flipped_gpu;
225-
226-
if(use_stencil_downsample) {
227-
psf_gpu.initialize(psf_vec.data(), psf_vec.size());
228-
psf_flipped_gpu.initialize(psf_flipped_vec.data(), psf_flipped_vec.size());
229-
} else {
230-
psf_gpu.initialize(psf.mesh.get(), psf.mesh.size());
231-
psf_flipped_gpu.initialize(psf_flipped.mesh.get(), psf_flipped.mesh.size());
232-
}
233-
234-
/// copy input and psf to the device
235-
input_gpu.copyH2D();
236-
psf_gpu.copyH2D();
237-
psf_flipped_gpu.copyH2D();
221+
ScopedCudaMemHandler<stencilType*, H2D> psf_gpu(psf_vec.data(), psf_vec.size());
222+
ScopedCudaMemHandler<stencilType*, H2D> psf_flipped_gpu(psf_flipped_vec.data(), psf_flipped_vec.size());
238223

239224
if(resume) {
240225
output_gpu.copyH2D();
@@ -254,8 +239,10 @@ template void APRNumericsGPU::gradient_magnitude(GPUAccessHelper&, GPUAccessHelp
254239
template void APRNumericsGPU::gradient_magnitude(GPUAccessHelper&, GPUAccessHelper&, VectorData<uint64_t>&, VectorData<float>&, VectorData<float>&, VectorData<float>&, VectorData<float>&);
255240
template void APRNumericsGPU::gradient_magnitude(GPUAccessHelper&, GPUAccessHelper&, VectorData<float>&, VectorData<float>&, VectorData<float>&, VectorData<float>&, VectorData<float>&);
256241

242+
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, uint8_t*, float*, float*, float*, int, int, bool, bool);
257243
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, uint16_t*, float*, float*, float*, int, int, bool, bool);
258244
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, float*, float*, float*, float*, int, int, bool, bool);
259245

246+
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, VectorData<uint8_t>&, VectorData<float>&, PixelData<float>&, int, bool, bool, bool);
260247
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, VectorData<uint16_t>&, VectorData<float>&, PixelData<float>&, int, bool, bool, bool);
261-
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, VectorData<float>&, VectorData<float>&, PixelData<float>&, int, bool, bool, bool);
248+
template void APRNumericsGPU::richardson_lucy(GPUAccessHelper&, GPUAccessHelper&, VectorData<float>&, VectorData<float>&, PixelData<float>&, int, bool, bool, bool);

src/numerics/miscCuda.cu

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ __global__ void elementWiseSqrt(float* __restrict__ input,
6969
}
7070

7171

72-
template<typename T>
73-
__global__ void copyKernel(const T* in, T* out, const size_t size){
72+
template<typename T, typename S>
73+
__global__ void copyKernel(const T* __restrict__ in, S* __restrict__ out, const size_t size){
7474

7575
for(size_t idx = blockIdx.x * blockDim.x + threadIdx.x; idx < size; idx += blockDim.x * gridDim.x) {
7676
out[idx] = in[idx];
@@ -440,10 +440,11 @@ template __global__ void elementWiseMult(uint16_t*, const uint16_t*, const size_
440440

441441
template __global__ void elementWiseDiv(const float*, const float*, float*, const size_t);
442442
template __global__ void elementWiseDiv(const uint16_t*, const float*, float*, const size_t);
443-
template __global__ void elementWiseDiv(const uint16_t*, const uint16_t*, uint16_t*, const size_t);
443+
template __global__ void elementWiseDiv(const uint8_t*, const float*, float*, const size_t);
444444

445445
template __global__ void copyKernel(const float*, float*, const size_t);
446-
template __global__ void copyKernel(const uint16_t*, uint16_t*, const size_t);
446+
template __global__ void copyKernel(const uint16_t*, float*, const size_t);
447+
template __global__ void copyKernel(const uint8_t*, float*, const size_t);
447448

448449
template __global__ void fillWithValue(float*, float, const size_t);
449450
template __global__ void fillWithValue(uint16_t*, uint16_t, const size_t);

src/numerics/miscCuda.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ __global__ void addSquare(float* in1, const float* in2, size_t size);
9191
__global__ void elementWiseSqrt(float* input, size_t size);
9292

9393

94-
template<typename T>
95-
__global__ void copyKernel(const T* in, T* out, const size_t size);
94+
template<typename T, typename S>
95+
__global__ void copyKernel(const T* in, S* out, const size_t size);
9696

9797

9898
template<typename T>

0 commit comments

Comments
 (0)