pyimreg / python-register

Linear and non-linear image registration methods, using scipy and numpy.
Other
62 stars 34 forks source link

Segmentation fault in 64 bit systems #43

Open hgrecco opened 12 years ago

hgrecco commented 12 years ago

I have a working script in my 32 bit python that fails when running in a 64 bit python with segmentation fault. The function that fails is:

def _shift(image, template):

Form the affine registration instance.

shift = register.Register(
    model.Shift,
    metric.Residual,
    sampler.CubicConvolution
)
# Coerce the image data into RegisterData.
image = register.RegisterData(image)
template = register.RegisterData(template)

# Register.
params, warp, img, error = shift.register(
    image,
    template,
    verbose=False,
    )

return params, warp, img, error

In addition to this: should I use https://github.com/pyimreg/imreg or https://github.com/pyimreg/python-register

Thanks

hgrecco commented 12 years ago

I also get segfault when the sampler is Nearest, Bilinear or Spline

hgrecco commented 12 years ago

To my surprise, the problem was in np.gradient. Everything got fixed when I changed to float32. Maybe the images are too big (1024, 1344)?

diff --git a/imreg/metrics/metric.py b/imreg/metrics/metric.py index b1fd29b..f141853 100644 --- a/imreg/metrics/metric.py +++ b/imreg/metrics/metric.py @@ -104,7 +104,7 @@ class Residual(Metric): | p = number of parameters. """