InsightSoftwareConsortium / InsightSoftwareConsortium/ITKElastix

Encountering segmentation fault when running `elastix_registration_method()` on both 2D and 3D images

Open
#295 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
281
Forks
29
Avg merge
16h 28m
Merged PRs (30d)
8

Description

Hi there, I have been introduced to Elastix as a possible solution for some of my image alignment needs, and have been running into the aforementioned segmentation fault issue when I try implementing multi-threading on a 3D job.

Using the example elastix data provided, this is the test code that I've written that runs into that segmentation fault:
```python
import numpy as np

from itk import imread
from itk.itkElastixRegistrationMethodPython import elastix_registration_method
from pathlib import Path
from tifffile import imwrite

# Load images
file_static = Path("/tutorials/elastix-examples/data/CT_3D_lung_fixed.mha")
img_static = np.asarray(imread(file_static))
dtype = str(img_static.dtype)
print(f"Using {file_static.name!r} as the reference image")

file_moving = Path("/tutorials/elastix-examples/data/CT_3D_lung_moving.mha")
img_moving = np.asarray(imread(file_moving))

# Register image while implementing multithreading
img_aligned, params = elastix_registration_method(
img_static, img_moving,
number_of_threads=2,
log_to_console=False,
) # <-- CODE FAILS AT THIS STEP
```
I am running this on a Linux RHEL8 system using `python v3.10.14` and `itk-elastix v0.20.0`

Any insight into what went wrong would be much appreciated!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.