Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

RuntimeError: Exception thrown in SimpleITK Elastix #478

Open
martinloh opened this issue Jul 15, 2022 · 1 comment
Open

RuntimeError: Exception thrown in SimpleITK Elastix #478

martinloh opened this issue Jul 15, 2022 · 1 comment

Comments

@martinloh
Copy link

Hi,

when I try to run the following code:

`path = r"\nas-fa0efsusr1\lohmn\My Documents\Auswertungen\Niere"
filename_moving = '45_b1_moving.nii'
filename_fixed = '45_fixed.nii'

image_fixed = sitk.ReadImage(os.path.join(path, filename_fixed))
image_moving = sitk.ReadImage(os.path.join(path, filename_moving))

Register

elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetFixedImage(image_fixed)
elastixImageFilter.SetMovingImage(image_moving)
elastixImageFilter.SetParameterMap(sitk.GetDefaultParameterMap('groupwise'))
elastixImageFilter.Execute()`

I receive the following runtime error:

Exception thrown in SimpleITK ElastixImageFilter_Execute: C:\dafne\SimpleElastix\Code\Elastix\src\sitkElastixImageFilterImpl.cxx:259:
sitk::ERROR:
itk::ExceptionObject (000000E4B07E83E0)
Location: "unknown"
File: c:\dafne\simpleelastix\build3.9\elastix\core\main\elxElastixFilter.hxx
Line: 253
Description: itk::ERROR: ElastixFilter(000001E4BE8B5570): Internal elastix error: See elastix log (use LogToConsoleOn() or LogToFileOn()).

It's very similar to issue #132, but it didn't get me any further unfortunately.
I also have no idea how to use LogToConsoleOn() or LogToFileOn().

Thank you

@Kiiaan
Copy link

Kiiaan commented Sep 14, 2022

Hi!

I also have no idea how to use LogToConsoleOn() or LogToFileOn().

You can activate logging to file with the following commands before running Execute():

elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.LogToFileOn()
elastixImageFilter.SetOutputDirectory("./")

Then elastix.log will be created in your current directory and your error will be logged there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants