Open
Conversation
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
Contributor
Author
|
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 |
2cbcfc7 to
c7ee8d6
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use pool to parallelize stack registration, added a variable
processesthat 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