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

combine_slices optimization #18

Open
jond01 opened this issue May 13, 2020 · 0 comments
Open

combine_slices optimization #18

jond01 opened this issue May 13, 2020 · 0 comments

Comments

@jond01
Copy link
Contributor

jond01 commented May 13, 2020

After inspecting in detail the combine_slices code, I found some optimization possibilities:

  • _sort_by_slice_position is called twice:
    First in the voxels (_merge_slice_pixel_arrays),
    Second in the affine (_ijk_to_patient_xyz_transform_matrix).
    Obviously, it can be done once in the outer combine_slices function.
  • _slice_positions is called 4 times:
    _validate_slices_form_uniform_grid - 1 time
    _slice_spacing - 1 time
    _sort_by_slice_position - 1 time, but _sort_by_slice_position is called twice --> 2 times
  • _extract_cosines is called 6 times:
    _validate_image_orientation - 1 time
    _ijk_to_patient_xyz_transform_matrix - 1 time
    _slice_positions - 1 time, but _slice_positions is called 4 times --> 4 times

All these calls better be done once (and can be).
However,

  1. this may incorporate substantial redesign of the code,
  2. it will change the functionality of _merge_slice_pixel_arrays and _ijk_to_patient_xyz_transform_matrix, which should not be used alone, but there are some special tests for _merge_slice_pixel_arrays.

Originally posted by @jond01 in #16 (comment)

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

No branches or pull requests

1 participant