SimpleElastix icon indicating copy to clipboard operation
SimpleElastix copied to clipboard

Registering 3d images (nii) Error in ElastixImageFilter_Execute

Open AmericaBG opened this issue 5 years ago • 1 comments

Hi! I'm registering 3d images (.nii). I've registered yet 44 images but when the number 45, the next error message is shown:

RuntimeError: Exception thrown in SimpleITK ElastixImageFilter_Execute: C:\SimpleElastix\SimpleElastix\Code\Elastix\src\sitkElastixImageFilterImpl.cxx:259:
sitk::ERROR: 
itk::ExceptionObject (00000082187E75C0)
Location: "unknown" 
File: C:\SimpleElastix\build\Elastix\Core\Main\elxElastixFilter.hxx
Line: 253
Description: itk::ERROR: Self(000001AFC4EF8DB0): Internal elastix error: See elastix log (use LogToConsoleOn() or LogToFileOn()).

I've checked that 45.nii has the correct 3D dimensions just as the other images (512, 512, 12) My code:

elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetParameter("WriteIterationInfo",["true"])


fixed_image=elastixImageFilter.SetFixedImage(sitk.ReadImage(fija))
moving_image=elastixImageFilter.SetMovingImage(sitk.ReadImage(variable))
elastixImageFilter.SetOutputDirectory("C:/Users/Usuario/Desktop/CNN/SimpleElastix")

translation_params = sitk.GetDefaultParameterMap('translation')
affine_params = sitk.GetDefaultParameterMap('affine')
bspline_params = sitk.GetDefaultParameterMap('bspline')

translation_params['MaximumNumberOfIterations']=['2000']
translation_params['NumberOfResolutions']=['6']
elastixImageFilter.SetParameterMap(translation_params)
elastixImageFilter.AddParameterMap(affine_params)

elastixImageFilter.PrintParameterMap()
resultImage = elastixImageFilter.Execute()

Could you help me please? Thank you very much in advance.

AmericaBG avatar Sep 29 '20 15:09 AmericaBG

Hi @SouthAmericaB, what does the elastix log show if you call elastixImageFilter.LogToConsoleOn() before running the registration?

kaspermarstal avatar Oct 02 '20 09:10 kaspermarstal