diff --git a/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/algorithm.py b/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/algorithm.py index 5fc3b52e..3382f6c5 100644 --- a/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/algorithm.py +++ b/httomo_backends/methods_database/packages/backends/httomolibgpu/supporting_funcs/recon/algorithm.py @@ -197,6 +197,9 @@ def _calc_memory_bytes_LPRec3d_tomobar( min_mem_usage_ifft2 = False if "min_mem_usage_ifft2" in kwargs: min_mem_usage_ifft2 = kwargs["min_mem_usage_ifft2"] + power_of_2_cropping = False + if "power_of_2_cropping" in kwargs: + power_of_2_cropping = kwargs["power_of_2_cropping"] angles_tot = non_slice_dims_shape[0] DetectorsLengthH_prepad = non_slice_dims_shape[1] @@ -205,6 +208,10 @@ def _calc_memory_bytes_LPRec3d_tomobar( _CENTER_SIZE_MIN = 192 # must be divisible by 8 n = DetectorsLengthH + if(power_of_2_cropping): + n_pow2 = 2 ** math.ceil(math.log2(n)) + if( 0.9 < n / n_pow2 ): + n = n_pow2 odd_horiz = False if (n % 2) != 0: diff --git a/pyproject.toml b/pyproject.toml index b55b0108..adfa0969 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ dev_template = "{tag}" [project] name = "httomo-backends" -version = "0.7.1" +version = "0.7.2" description = "Supplementary files for HTTomo backends." readme = "README.rst" license = {text = "BSD-3-Clause"} @@ -55,7 +55,6 @@ dependencies = [ "astra-toolbox", "tomobar", "scikit-image", - "ccpi-regularisation-cupy", ] [project.optional-dependencies] diff --git a/tests/test_httomolibgpu.py b/tests/test_httomolibgpu.py index 201e2a31..0c89bf67 100644 --- a/tests/test_httomolibgpu.py +++ b/tests/test_httomolibgpu.py @@ -543,7 +543,8 @@ def test_recon_FBP3d_tomobar_memoryhook( @pytest.mark.cupy -@pytest.mark.parametrize("min_mem_usage_filter_ifft2", [(False, False), (True, False), (True, True)]) +@pytest.mark.parametrize("min_mem_usage_filter_ifft2", [(False, False)]) +@pytest.mark.parametrize("power_of_2_cropping", [False]) @pytest.mark.parametrize("padding_detx", [0, 10, 50, 100]) @pytest.mark.parametrize("projections", [1500, 1801, 2560]) @pytest.mark.parametrize("detX_size", [2560]) @@ -556,6 +557,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook( projection_angle_range, min_mem_usage_filter_ifft2, padding_detx, + power_of_2_cropping, ensure_clean_memory, ): __test_recon_LPRec3d_tomobar_memoryhook_common( @@ -565,6 +567,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ) @@ -572,6 +575,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook( @pytest.mark.full @pytest.mark.cupy @pytest.mark.parametrize("min_mem_usage_filter_ifft2", [(False, False), (True, False), (True, True)]) +@pytest.mark.parametrize("power_of_2_cropping", [False, True]) @pytest.mark.parametrize("padding_detx", [0, 10, 50, 100, 800]) @pytest.mark.parametrize("projections", [1500, 1801, 2560, 3601]) @pytest.mark.parametrize("detX_size", [2560]) @@ -584,6 +588,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook_full( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ): __test_recon_LPRec3d_tomobar_memoryhook_common( @@ -593,6 +598,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook_full( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ) @@ -600,6 +606,7 @@ def test_recon_LPRec3d_tomobar_0_pi_memoryhook_full( @pytest.mark.full @pytest.mark.cupy @pytest.mark.parametrize("min_mem_usage_filter_ifft2", [(False, False), (True, False), (True, True)]) +@pytest.mark.parametrize("power_of_2_cropping", [False, True]) @pytest.mark.parametrize("padding_detx", [0, 10, 50, 100, 800]) @pytest.mark.parametrize("projections", [1500, 1801, 2560, 3601]) @pytest.mark.parametrize("detX_size", [2560]) @@ -614,6 +621,7 @@ def test_recon_LPRec3d_tomobar_memoryhook_full( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ): __test_recon_LPRec3d_tomobar_memoryhook_common( @@ -623,6 +631,7 @@ def test_recon_LPRec3d_tomobar_memoryhook_full( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ) @@ -634,6 +643,7 @@ def __test_recon_LPRec3d_tomobar_memoryhook_common( projection_angle_range, padding_detx, min_mem_usage_filter_ifft2, + power_of_2_cropping, ensure_clean_memory, ): angles_number = projections @@ -646,6 +656,7 @@ def __test_recon_LPRec3d_tomobar_memoryhook_common( kwargs["detector_pad"] = padding_detx kwargs["min_mem_usage_filter"] = min_mem_usage_filter_ifft2[0] kwargs["min_mem_usage_ifft2"] = min_mem_usage_filter_ifft2[1] + kwargs["power_of_2_cropping"] = power_of_2_cropping kwargs["recon_size"] = detX_size kwargs["recon_mask_radius"] = 0.8