Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2129_median_gpu_fix' into 2129_m…
Browse files Browse the repository at this point in the history
…edian_gpu_fix
  • Loading branch information
ashmeigh committed Mar 14, 2024
2 parents d601b11 + cb378e4 commit 2f8abb8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/release_notes/next/fix-2129-median_cuda
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#2129 : fix: Pytest failure AttributeError: 'ImageStack' object has no attribute 'shape
9 changes: 7 additions & 2 deletions mantidimaging/core/operations/median_filter/median_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,15 @@ def _median_filter(data: np.ndarray, size: int, mode: str) -> np.ndarray:

def _execute_gpu(data, size, mode, progress=None):
log = getLogger(__name__)
progress = Progress.ensure_instance(progress, num_steps=data.shape[0], task_name="Median filter GPU")
try:
num_steps = len(data)
except TypeError as err:
raise ValueError("Data structure does not support len().") from err

progress = Progress.ensure_instance(progress, num_steps=num_steps, task_name="Median filter GPU")

cuda = gpu.CudaExecuter(data.dtype)

with progress:
log.info(f"GPU median filter, with pixel data type: {data.dtype}, filter size/width: {size}.")

cuda.median_filter(data, size, mode, progress)

0 comments on commit 2f8abb8

Please sign in to comment.