-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy some tests into 'interactive tests'
Moving forward the 'tests' directory will be used for unit type tests that will be run with pytest. They will use dummy data to test if the software is functioning right and producing correct values for simulated cases. 'interactive tests' will be used to test and troubleshoot with real files.
- Loading branch information
Showing
7 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from clij2fft.libs import getlib | ||
from clij2fft.richardson_lucy import richardson_lucy | ||
import numpy as np | ||
|
||
|
||
lib = getlib() | ||
lib.print_platforms_and_devices() | ||
|
||
img= np.ones((256, 256, 128), dtype=np.float32) | ||
psf = np.ones((128, 128, 64), dtype=np.float32) | ||
|
||
result = richardson_lucy(img, psf, 100, 0, platform=0, device=0) | ||
#result = richardson_lucy(img, psf, 100, 0, platform=1, device=0) | ||
|
||
print() | ||
print(result.shape, result.mean()) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from clij2fft.richardson_lucy_dask import richardson_lucy_dask | ||
from skimage.io import imread | ||
import numpy as np | ||
from matplotlib import pyplot as plt | ||
import pyopencl as cl | ||
import os | ||
|
||
use_ones = False | ||
|
||
# we have the option of just using arrays of ones to test that the code runs... | ||
if use_ones: | ||
img = np.ones((256, 256, 128), dtype=np.float32) | ||
psf = np.ones((128, 128, 64), dtype=np.float32) | ||
# ...or we can use real images | ||
else: | ||
clij2fft_images_path = r'/home/bnorthan/images/clij2-fft-images' | ||
|
||
img_name=os.path.join(clij2fft_images_path, 'Bars-G10-P15-stack.tif') | ||
psf_name=os.path.join(clij2fft_images_path, 'PSF-Bars-stack.tif') | ||
|
||
img=imread(img_name) | ||
print('image shape is',img.shape) | ||
psf=imread(psf_name) | ||
|
||
pad_z=50 | ||
pad_y=50 | ||
pad_x=50 | ||
mem_to_use=1 | ||
|
||
img = np.pad(img, [(pad_z,pad_z),(pad_y, pad_y),(pad_x, pad_x)], mode = 'constant', constant_values = 0) | ||
print('image shape is',img.shape) | ||
|
||
platforms = cl.get_platforms() | ||
|
||
for platform in platforms: | ||
# print number of devices per platform | ||
print("Platform: {} has {} devices".format(platform.name, len(platform.get_devices()))) | ||
for device in platform.get_devices(): | ||
print(' ',device) | ||
|
||
platform_to_use = 0 | ||
decon=richardson_lucy_dask(img, psf, 50, 0.0001, mem_to_use=mem_to_use, platform = 0, num_devices = len(platforms[0].get_devices()), debug = False) | ||
|
||
fig, ax = plt.subplots(1,2) | ||
ax[0].imshow(img.max(axis=0)) | ||
ax[0].set_title('img') | ||
|
||
ax[1].imshow(decon.max(axis=0)) | ||
ax[1].set_title('deconvolution') | ||
|
||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters