SuperElastix / SimpleElastix

Multi-lingual medical image registration library
http://simpleelastix.github.io
Apache License 2.0
509 stars 149 forks source link

Runtime error: exception thrown in SimpleITK Elastix #355

Open IWamelink opened 4 years ago

IWamelink commented 4 years ago

Hi, I posted in a closed issue, however I am not sure if it then still works (I am new to GitHub). Can anyone help? Thanks in advance!

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in resultImage = sitk.Elastix(sitk.ReadImage(r'G:\PsP vs TP\Test\True Progression\2020-02-18-002\IMAGES\IM00001'), sitk.ReadImage(r'G:\PsP vs TP\Test\True Progression\2020-02-18-002\IMAGES\IM00002'), True) File "C:\ProgramData\Anaconda3\lib\site-packages\simpleitk-1.2.0rc2.dev1167+gd4cf2-py3.7-win-amd64.egg\SimpleITK\SimpleITK.py", line 11054, in Elastix return _SimpleITK.Elastix(*args) RuntimeError: Exception thrown in SimpleITK Elastix: C:\Users\vctla\SimpleElastix\Code\Elastix\src\sitkElastixImageFilterImpl.cxx:259: sitk::ERROR: itk::ExceptionObject (0000004B63BEA6A0) Location: "unknown" File: C:\Users\vctla\build\Elastix\Core\Main\elxElastixFilter.hxx Line: 253 Description: itk::ERROR: Self(0000021F84AC3970): Internal elastix error: See elastix log (use LogToConsoleOn() or LogToFileOn()).

The IM00001 files are DICOM files.

IWamelink commented 4 years ago

Duplicate of #

When I set logtoconsole to True, this is what the console gives as output:

ELASTIX version: 4.900 Command line options from ElastixBase: -fMask unspecified, so no fixed mask used -mMask unspecified, so no moving mask used -out ./ -priority unspecified, so NORMAL process priority -threads unspecified, so all available threads are used WARNING: The parameter "UseDirectionCosines", requested at entry number 0, does not exist at all. The default value "true" is used instead. WARNING: The option "UseDirectionCosines" was not found in your parameter file. From elastix 4.8 it defaults to true! This may change the behavior of your registrations considerably. Command line options from TransformBase: -t0 unspecified, so no initial transform used Reading images... Reading images took 0 ms. WARNING: the fixed pyramid schedule is not fully specified! A default pyramid schedule is used. WARNING: the moving pyramid schedule is not fully specified! A default pyramid schedule is used. WARNING: The parameter "AutomaticTransformInitialization", requested at entry number 0, does not exist at all. The default value "false" is used instead. Transform parameters are initialized as: [0, 0, 0] Initialization of all components (before registration) took: 0 ms. itk::ExceptionObject (0000004B63BEA218) Location: "ElastixTemplate - Run()" File: C:\Users\vctla\build\ITK-prefix\include\ITK-4.13\itkRecursiveSeparableImageFilter.hxx Line: 245 Description: itk::ERROR: RecursiveGaussianImageFilter(0000021FFE6EFC30): The number of pixels along direction 2 is less than 4. This filter requires a minimum of four pixels along the dimension to be processed. Error occurred during actual registration.

sorenchr2011 commented 4 years ago

Which transform are you using? Does the error message apply to your input? The number of pixels along direction 2 is less than 4. This filter requires a minimum of four pixels along the dimension to be processed.

IWamelink commented 4 years ago

I am not using a specific transform. I am applying the example given in the read.me file: SimpleITK.Elastix(sitk.ReadImage("fixedImage.dcm"), sitk.ReadImage("movingImage.dcm"))

I am unable to figure out to whether it applies to my input. The DICOM files I am using are of the same size and should contain more than 4 pixels in every direction.

sorenchr2011 commented 4 years ago

Then you are using the default transform(s) which you can inspect here sitk.PrintParameterMap(se.GetParameterMap()) #(where se=sitk.ElastixImageFilter()) So it seems as if that applies a gaussian blur which requires 3D data whereas you have 2D data (assuming this is non enhanced DICOM). I don't have experience with 2D images but this should help you: http://elastix.bigr.nl/wiki/index.php/Parameter_file_database

hawk257 commented 3 years ago

Do you solve this problem? I meet a same error, how do you solve this error? Would you like to share it? thank you .

kkkk-oss commented 3 years ago

Then you are using the default transform(s) which you can inspect here sitk.PrintParameterMap(se.GetParameterMap()) #(where se=sitk.ElastixImageFilter()) So it seems as if that applies a gaussian blur which requires 3D data whereas you have 2D data (assuming this is non enhanced DICOM). I don't have experience with 2D images but this should help you: http://elastix.bigr.nl/wiki/index.php/Parameter_file_database

It outputs three ParameterMaps and doesn't like a problem. How to solve it?