Skip to content

Segmentation fault in 64 bit systems #43

Open

Description

@hgrecco

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

Activity

  1. hgrecco commented on Oct 16, 2012

    @hgrecco
    Author

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

  2. hgrecco commented on Oct 16, 2012

    @hgrecco
    Author

    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.
    """

    •    grad = np.gradient(warpedImage)
      
    •    grad = np.gradient(np.asarray(warpedImage, dtype=np.float32))
      
       dIx = grad[1].flatten()
       dIy = grad[0].flatten()
      
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions