Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parallelize register/transform stack #17

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

orena1
Copy link
Contributor

@orena1 orena1 commented May 29, 2021

Use pool to parallelize stack registration, added a variable processes that sets the number of processes to use. If it is 1 the original code is executed if it is larger than one the parallelized code will run.
note that progress_callback does not work with the parallelized version

Use pool to parallelize stack registration, added a variable `processes` that sets the number of processes to use. If it is 1 the original code is executed if it is larger than one the parallelized code will run.
note that progress_callback does not work with the parallelized version
@orena1
Copy link
Contributor Author

orena1 commented May 29, 2021

Test

from pystackreg import StackReg
import tifffile as tif

#load data and incrase size
loaded = tif.imread(BASE_PATH +'/pc12-reg-affine.tif')
data = np.repeat(np.repeat(np.repeat(loaded,8,0),3,2),3,1)


sr = StackReg(StackReg.AFFINE)

%%timeit
out_mean_20p = sr.register_transform_stack(data, reference='mean', processes=20)
##  5.87 s ± 129 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

%%timeit
out_mean_20p = sr.register_transform_stack(data, reference='mean', processes=1)
## 18 s ± 815 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)


np.all(out_mean_20p==out_mean_1p)
## True

@glichtner glichtner force-pushed the master branch 8 times, most recently from 2cbcfc7 to c7ee8d6 Compare October 3, 2024 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant