linumpy.gpu.registration#
GPU-accelerated registration operations for linumpy.
Provides a hybrid approach where metric computation is done on GPU while the optimizer runs on CPU (SimpleITK).
Classes#
Hybrid GPU/CPU registration class. |
Functions#
|
GPU-accelerated 2D image registration. |
|
Apply SimpleITK transform to image using GPU resampling. |
Module Contents#
- class linumpy.gpu.registration.GPUAcceleratedRegistration(use_gpu=True, metric='mse')[source]#
Hybrid GPU/CPU registration class.
Uses GPU for: - Image resampling/transformation - Metric computation (MSE, NCC)
Uses CPU (SimpleITK) for: - Optimization loop - Transform management
- Parameters:
- compute_metric(fixed, moving)[source]#
Compute registration metric between two images.
- Parameters:
fixed (np.ndarray) – Fixed image
moving (np.ndarray) – Moving image (already transformed)
- Returns:
Metric value (lower is better for MSE, higher for NCC)
- Return type:
- transform_image(image, transform_matrix, output_shape=None)[source]#
Apply transformation to image using GPU.
- Parameters:
image (np.ndarray) – Input image
transform_matrix (np.ndarray) – Transformation matrix
output_shape (tuple, optional) – Output shape
- Returns:
Transformed image
- Return type:
np.ndarray
- linumpy.gpu.registration.register_2d_gpu(fixed, moving, method='affine', metric='mse', max_iterations=1000, use_gpu=True)[source]#
GPU-accelerated 2D image registration.
Uses SimpleITK optimizer with GPU metric computation.
- Parameters:
- Returns:
transform (sitk.Transform) – Computed transform
str – Optimizer stop condition
float – Final metric value
- Return type:
Any
- linumpy.gpu.registration.apply_transform_gpu(image, transform, use_gpu=True)[source]#
Apply SimpleITK transform to image using GPU resampling.
- Parameters:
image (np.ndarray) – Input image
transform (sitk.Transform) – SimpleITK transform
use_gpu (bool) – Whether to use GPU
- Returns:
Transformed image
- Return type:
np.ndarray