Skip to content

Commit

Permalink
Merge pull request #65 from elgw/dev
Browse files Browse the repository at this point in the history
v 0.4.2
  • Loading branch information
elgw committed Jun 10, 2024
2 parents 7a0b2d6 + 123d9c1 commit 9ccc968
Show file tree
Hide file tree
Showing 13 changed files with 254 additions and 234 deletions.
41 changes: 23 additions & 18 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 0.4.2
- VkFFT upgraded from v1.3.3 to v1.3.4.
- Fixed an issue preventing anything than `--bq 0` to be used on
Windows (one array was not properly initialized to 0).

## 0.4.1
- Fixes the GPU memory leak reported in [issue
#62](https://github.com/elgw/deconwolf/issues/62).
Expand Down Expand Up @@ -176,19 +181,19 @@ Results when testing on the microtubules image shown below.
commenting in/out the corresponding lines in the makefile.
- Cleaned up the output of `dw --version`

## v 0.2.7
## 0.2.7
- Converted a few minor code paths to execute in parallel by OpenMP
directives.

## v 0.2.6
## 0.2.6
- Using ISO 8601 in log files, e.g., `2023-02-14T11:14:14`.

## v 0.2.5
## 0.2.5
- Added the **--xyz** option to **dw maxproj**, for creating max
projections along the three axes and collecting them on a single 2D
image.

## v 0.2.4
## 0.2.4
- **dw --help** now shows the additional commands/modules available.
- Reading 16-bit tif files with **TIFFReadEncodedStrip** instead of
**TIFFReadRawStrip**. Some programs saves tiff files in other ways
Expand All @@ -199,26 +204,26 @@ Results when testing on the microtubules image shown below.
- Setting the background level automatically to min(image) unless
specified with **--bg**.

## v 0.2.3
## 0.2.3
- Fixed some errors introduced in v 0.2.2, especially the **dw
maxproj** was broken.
- added the subcommand **dw merge**. To be used to merge single z-planes
into a 3D volume.

## v 0.2.2
## 0.2.2
- Can deconvolve using clFFT, when compiled with **OPENCL=1** two new
methods appear, **--method shbcl** and **--shbcl2**, the first using
clFFT only for the Fourier transforms, the latter using OpenCL for
the whole deconvolution procedure. Uses quite much GPU memory which
is something to improve upon in future version, possibly by
switching to vkFFT.

## v 0.1.1
## 0.1.1
- Added experimental **dw imshift** for shifting images, also shift
estimation using normalized cross correlation with **dw imshift
--ref file.tif**. Might be extended to basic tiling etc.

## v 0.1.0
## 0.1.0
- Implements the 'Scaled Heavy Ball'. More
memory efficient than eve and about the same speed and image
quality. Might become the default method.
Expand All @@ -238,20 +243,20 @@ iteration to a separate tsv file for easier plotting and analysis.
- Three different stopping criteria: Relative error (default) Fixed
number of iterations or at an absolute error.

## v 0.0.26
## 0.0.26
- **dw maxproj** works with file that are not in the current folder.
- Fixed **--iterdump** not always working.

## v. 0.0.25
## 0.0.25
- Builds with cuFFT on Linux, use `make CUFFT=1 -B`, requires a CUDA
compatible GPU and of course the cuFFT library installed.

## v. 0.0.24
## 0.0.24
- Tested on CentOS, install both with make and meson.
- Fixed a memory leak with the **--tilesize** option causing
crashed sometimes.

## v. 0.0.23
## 0.0.23
- Added 'meson.build' files in order for deconwolf to be built by
[The Meson Build system](https://mesonbuild.com/), tested to work
on both Ubuntu 21.10 and MacOS (on x86_64 hardware).
Expand All @@ -263,17 +268,17 @@ document.
- Aborting if the number of threads is set < 1.
- The algorithm is still unchanged since v 0.0.20.

## v. 0.0.22
## 0.0.22
- Fixed double free-bug in tiling mode.

## v. 0.0.21
## 0.0.21
- Updated documentation and man-pages based on markdown files
for easier updating.
- Provides `makefile-freebsd` for building on FreeBSD 13.0
- Changed behavior when too few input arguments are given to
only give a two-line message.

## v. 0.0.20
## 0.0.20
- Changing acceleration technique to use
'Exponential Vector Extrapolation' (EVE) described in Biggs PhD thesis.
Deconvolved images get higher MSE but much lower I-div.
Expand All @@ -291,13 +296,13 @@ however that is not recommended.
experimental option. 14 percent faster on a small test image, varied
results on larger images.

## v. 0.0.19
## 0.0.19
- Using lanczos5 instead of lanczos3 for the PSF generation. As a result
GSL_EROUND is not raised for the test cases.
- Faster PSF generation, using more symmetries.
- dw_bw can now use more than one thread (wrongly disabled in v 0.0.18).

## v. 0.0.18
## 0.0.18
- Provided install instructions for Windows 10.
- Fixed some mismatching fftwf_malloc/fftwf_free where they were
mixed up with malloc/free causing crashes on Windows.
Expand All @@ -306,7 +311,7 @@ building with cmake. It is also possible to cross compile for Windows
on Linux although it takes some effort to collect the DLL files for the
dependencies.

## v. 0.0.17
## 0.0.17
- Fixed some bugs in the PSF generation code that did affect the accuracy
of the pixels in the PSF.
- Stared to use GSL for numerical integration. It remains to change the
Expand Down
13 changes: 10 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ The dependencies can get retrieved by vcpkg:
``` shell
git clone https://github.com/microsoft/vcpkg
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg integrate install
.\vcpkg\vcpkg.exe install fftw3[threads]
.\vcpkg\vcpkg.exe install tiff
.\vcpkg\vcpkg.exe install gsl
Expand All @@ -138,9 +137,17 @@ cmake "-DCMAKE_TOOLCHAIN_FILE=C:/YOUR/OWN/PATH/vcpkg/scripts/buildsystems/vcpkg.
```
Important: Please use the correct path to `vcpkg.cmake`.

Open visual studio and compile it from there. Don't forget to change the build type to release.
Open the visual studio solution and oo to Linker->Input->Additional
dependencies and add:

If you are a windows developer and reading this, please help us out get make this process smoother (if possible).
``` shell
libomp.lib
```

Change the build type from debug to release and compile.

If you are a windows developer and reading this, please help us out
to make the build process smoother!

## FreeBSD
- Use `gmake`, not `make`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# deconwolf v0.4.1
# deconwolf v0.4.2

**deconwolf**[^9] is a software for 3-D deconvolution of fluorescent wide-field
images:
Expand Down
2 changes: 1 addition & 1 deletion src/VkFFT/vkFFT/vkFFT.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,6 @@
#include "vkFFT/vkFFT_AppManagement/vkFFT_DeleteApp.h"

static inline int VkFFTGetVersion() {
return 10303; //X.XX.XX format
return 10304; //X.XX.XX format
}
#endif
26 changes: 13 additions & 13 deletions src/dw_nuclei.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ static void opts_free(opts * s)
* than green set to 2. Everything else set to 0.
* http://www.libpng.org/pub/png/libpng-manual.txt
*/
fim_t * fim_png_read_green_red(char * fname)
fimo * fim_png_read_green_red(char * fname)
{
fim_t * F = NULL;
fimo * F = NULL;

png_image image;
memset(&image, 0, sizeof(image));
Expand All @@ -113,7 +113,7 @@ fim_t * fim_png_read_green_red(char * fname)
size_t N = image.height;
//printf("M=%zu, N=%zu image buffer %u b\n", M, N, PNG_IMAGE_SIZE(image));

F = malloc(sizeof(fim_t));
F = malloc(sizeof(fimo));
assert(F != NULL);
F->M = M;
F->N = N;
Expand Down Expand Up @@ -291,7 +291,7 @@ static int float_arg_max(const float * v, size_t N)
return argmax;
}

fim_t * get_reduction(opts * s, char * file)
fimo * get_reduction(opts * s, char * file)
{


Expand Down Expand Up @@ -325,7 +325,7 @@ fim_t * get_reduction(opts * s, char * file)
{
float * maxI = fim_maxproj(I, M, N, P);
free(I);
fim_t * result = fim_image_from_array(maxI, M, N, 1);
fimo * result = fim_image_from_array(maxI, M, N, 1);
free(maxI);
return result;
}
Expand All @@ -336,20 +336,20 @@ fim_t * get_reduction(opts * s, char * file)
{
printf("Finding focus\n"); fflush(stdout);
}
fim_t * II = fim_image_from_array(I, M, N, P);
fimo * II = fim_image_from_array(I, M, N, P);
free(I);
float sigma = 1;
float * gm = fim_focus_gm(II, sigma);
int slice = float_arg_max(gm, II->P);
fim_t * result = malloc(sizeof(fim_t));
fimo * result = malloc(sizeof(fimo));
assert(result != NULL);
result->M = M;
result->N = N;
result->P = 1;
result->V = malloc(M*N*sizeof(float));
assert(result->V != NULL);
memcpy(result->V, II->V+slice*M*N, M*N*sizeof(float));
fimt_free(II);
fimo_free(II);
if(s->verbose > 0)
{
printf("Returning slice %d\n", slice); fflush(stdout);
Expand Down Expand Up @@ -387,7 +387,7 @@ void segment_image_rf(opts * s, PrfForest * F, char * file)
printf("\n");

/* Read the image */
fim_t * redu = get_reduction(s, file);
fimo * redu = get_reduction(s, file);
assert(redu != NULL);
printf("1\n"); fflush(stdout);
/* Extract features */
Expand Down Expand Up @@ -453,7 +453,7 @@ void segment_image_rf(opts * s, PrfForest * F, char * file)

fim_tiff_write_noscale(outfile, result, NULL,
redu->M, redu->N, 1);
fimt_free(redu);
fimo_free(redu);
return;
}

Expand All @@ -471,7 +471,7 @@ PrfForest * loop_training_data(opts * s, float * features_cm,
}

/* Read annotated image */
fim_t * anno = fim_png_read_green_red(s->anno_label);
fimo * anno = fim_png_read_green_red(s->anno_label);
assert(anno != NULL);

/* Append one columns for the annotations */
Expand Down Expand Up @@ -551,7 +551,7 @@ PrfForest * loop_training_data(opts * s, float * features_cm,
}
free(features_cma);
free(features_cma_train);
fimt_free(anno);
fimo_free(anno);
free(result);
}

Expand All @@ -562,7 +562,7 @@ void random_forest_pipeline(opts * s, int argc, char ** argv)
{

/* Read raw image */
fim_t * anno_raw = get_reduction(s, s->anno_image);
fimo * anno_raw = get_reduction(s, s->anno_image);

/* Extract features */
ftab_t * features = fim_features_2d(anno_raw);
Expand Down
20 changes: 10 additions & 10 deletions src/dw_psf.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,14 +545,14 @@ static void downsample_integrate(float * A, float * B, int nA, int nB)
free(K);
}

fim_t * gen_psf(opts * s, double lambda)
fimo * gen_psf(opts * s, double lambda)
{
if(s->verbose > 2) { printf("Allocating for output\n"); fflush(stdout); }

double optical_dx = s->optical.dx/s->oversampling;

fim_tiff_init();
fim_t * PSF = fimt_zeros(s->M*s->oversampling, s->M*s->oversampling, s->P);
fimo * PSF = fimo_zeros(s->M*s->oversampling, s->M*s->oversampling, s->P);

double Fs = 1/optical_dx;
double Fn = Fs/2;
Expand Down Expand Up @@ -765,7 +765,7 @@ static float * conv2d_float(float * A, float * B,
}


static void pinhole_convolution(opts * s, fim_t * PSF)
static void pinhole_convolution(opts * s, fimo * PSF)
{
/* Convolve PSF by a square filter. The specified pinhole is the
diameter. */
Expand Down Expand Up @@ -840,7 +840,7 @@ static void dw_psf(opts * s)
printf("Calculating emission PSF\n");
}

fim_t * PSF = gen_psf(s, s->optical.lambda);
fimo * PSF = gen_psf(s, s->optical.lambda);
if(s->optical.lambda2 != 0)
{
/* We will generate a PSF for a confocal microscope with
Expand All @@ -855,22 +855,22 @@ static void dw_psf(opts * s)
{
printf("Calculating excitation PSF\n");
}
fim_t * PSF2 = gen_psf(s, s->optical.lambda2);
fimo * PSF2 = gen_psf(s, s->optical.lambda2);
//printf("Multiplying PSFs\n");
for(size_t kk = 0; kk<fimt_nel(PSF); kk++)
for(size_t kk = 0; kk<fimo_nel(PSF); kk++)
{
PSF->V[kk] *= PSF2->V[kk];
}
fimt_free(PSF2);
fimo_free(PSF2);
}


if(s->verbose > 0)
{
printf("Writing to %s\n", s->outfile);
}
float sum = fimt_sum(PSF);
fim_mult_scalar(PSF->V, fimt_nel(PSF), 1.0/sum);
float sum = fimo_sum(PSF);
fim_mult_scalar(PSF->V, fimo_nel(PSF), 1.0/sum);

ttags * T = ttags_new();
char * swstring = malloc(1024);
Expand All @@ -886,7 +886,7 @@ static void dw_psf(opts * s)
T,
PSF->M, PSF->N, PSF->P);
ttags_free(&T);
fimt_free(PSF);
fimo_free(PSF);
}

int dw_psf_cli(int argc, char ** argv)
Expand Down
12 changes: 6 additions & 6 deletions src/dw_psf_sted.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ static void argparsing(int argc, char ** argv, opts * s)



static fim_t * gen_psf(opts * s)
static fimo * gen_psf(opts * s)
{
fim_t * PSF = fimt_zeros(s->M, s->M, s->P);
fimo * PSF = fimo_zeros(s->M, s->M, s->P);
const double gamma = s->gamma;
const double sigma = s->sigma;

Expand Down Expand Up @@ -357,10 +357,10 @@ static void dw_psf_sted(opts * s)
{
printf("Writing to %s\n", s->outfile);
}
fim_t * PSF = gen_psf(s);
fimo * PSF = gen_psf(s);

float sum = fimt_sum(PSF);
fim_mult_scalar(PSF->V, fimt_nel(PSF), 1.0/sum);
float sum = fimo_sum(PSF);
fim_mult_scalar(PSF->V, fimo_nel(PSF), 1.0/sum);

ttags * T = ttags_new();
char * swstring = malloc(1024);
Expand All @@ -377,7 +377,7 @@ static void dw_psf_sted(opts * s)
T,
PSF->M, PSF->N, PSF->P);
ttags_free(&T);
fimt_free(PSF);
fimo_free(PSF);
}

int dw_psf_sted_cli(int argc, char ** argv)
Expand Down
Loading

0 comments on commit 9ccc968

Please sign in to comment.