Failing Tests - ImportError: No module named Elastix

There a couple extensions with failing tests for Slicer 4.10 related to a failure to import Elastix.

SequenceRegistration: http://slicer.cdash.org/testDetails.php?test=9620798&build=1619449
SlicerCochlea: http://slicer.cdash.org/testDetails.php?test=9662089&build=1619496

test_widgetRepresentation (qSlicerSequenceRegistrationModuleGenericTest.qSlicerSequenceRegistrationModuleGenericTest) ... Traceback (most recent call last):
  File "/Volumes/Dashboards/Stable/S-4102-E-b/SequenceRegistration-build/lib/Slicer-4.10/qt-scripted-modules/SequenceRegistration.py", line 42, in setup
    self.logic = SequenceRegistrationLogic()
  File "/Volumes/Dashboards/Stable/S-4102-E-b/SequenceRegistration-build/lib/Slicer-4.10/qt-scripted-modules/SequenceRegistration.py", line 490, in __init__
    import Elastix
ImportError: No module named Elastix
ok

The .s4ext files on the 4.10 branch do specify SlicerElastix as a dependency. SequenceRegistration specifies SlicerElastix as a dependency here. Anyone have an idea about why it is failing to import Elastix? Something specific to the build/test process on the nightly builds of extensions?

If SlicerElastix extension is installed them import Elastix should not throw an error. SlicerElastix is built successfully for Slicer-4.10.x and also for recent Slicer-4.11.x releases. I only see occasional build errors on Linux (dashboard upload fails, so it is not really a build error but some issue on the factory machine).

If an extension uses SlicerElastix and does not list it as a dependency then maybe the expectation is that the user will install it manually? Probably it would be better to list it as a dependency.

I didn’t see any import issues with the extension installed, but it appears the failing test for ImportError: No module named Elastix has been happening since at least 2018.

The extensions are both listing SlicerElastix as a dependency.

@jcfr Is this some issue with the factory machine?

but it appears the failing test for ImportError: No module named Elastix

This should be fixed in ENH: Generate SlicerElastixConfig to fix find_package() call by dependent extension by jcfr · Pull Request #18 · lassoan/SlicerElastix · GitHub

After integrating this change, the following tests are still failing but this is independent of SlicerElastix:

$ ctest 
Test project /tmp/SlicerCochlea-build
    Start 1: py_nomainwindow_qSlicerCochleaRegModuleGenericTest
1/9 Test #1: py_nomainwindow_qSlicerCochleaRegModuleGenericTest .....   Passed   16.88 sec
    Start 2: py_CochleaReg
2/9 Test #2: py_CochleaReg ..........................................***Failed    3.77 sec
    Start 3: py_CochleaRegModuleTest
3/9 Test #3: py_CochleaRegModuleTest ................................***Failed   82.24 sec
    Start 4: py_nomainwindow_qSlicerCochleaSegModuleGenericTest
4/9 Test #4: py_nomainwindow_qSlicerCochleaSegModuleGenericTest .....   Passed    2.74 sec
    Start 5: py_CochleaSeg
5/9 Test #5: py_CochleaSeg ..........................................***Failed    3.77 sec
    Start 6: py_CochleaSegModuleTest
6/9 Test #6: py_CochleaSegModuleTest ................................***Failed   47.83 sec
    Start 7: py_nomainwindow_qSlicerVisSimCommonModuleGenericTest
7/9 Test #7: py_nomainwindow_qSlicerVisSimCommonModuleGenericTest ...   Passed    2.85 sec
    Start 8: py_VisSimCommon
8/9 Test #8: py_VisSimCommon ........................................   Passed    3.65 sec
    Start 9: py_VisSimCommonModuleTest
9/9 Test #9: py_VisSimCommonModuleTest ..............................   Passed    3.88 sec

I submitted the following PR to simplify the testing harness and fix the one of the failing tests, the last failing test can be fixed applying similar fixes (cc: @brhoom) . See Fix CochleaReg test by jcfr · Pull Request #17 · MedicalImageAnalysisTutorials/SlicerCochlea · GitHub

$ ctest 
Test project /tmp/SlicerCochlea-build
    Start 1: py_nomainwindow_qSlicerCochleaRegModuleGenericTest
1/7 Test #1: py_nomainwindow_qSlicerCochleaRegModuleGenericTest .....   Passed    2.83 sec
    Start 2: py_CochleaReg
2/7 Test #2: py_CochleaReg ..........................................   Passed   22.38 sec
    Start 3: py_nomainwindow_qSlicerCochleaSegModuleGenericTest
3/7 Test #3: py_nomainwindow_qSlicerCochleaSegModuleGenericTest .....   Passed    2.85 sec
    Start 4: py_CochleaSeg
4/7 Test #4: py_CochleaSeg ..........................................***Failed    3.80 sec
    Start 5: py_nomainwindow_qSlicerVisSimCommonModuleGenericTest
5/7 Test #5: py_nomainwindow_qSlicerVisSimCommonModuleGenericTest ...   Passed    2.76 sec
    Start 6: py_VisSimCommon
6/7 Test #6: py_VisSimCommon ........................................   Passed    3.65 sec
    Start 7: py_VisSimCommonModuleTest
7/7 Test #7: py_VisSimCommonModuleTest ..............................   Passed    3.77 sec

This should be fixed in ENH: Generate SlicerElastixConfig to fix find_package() call by dependent extension by jcfr · Pull Request #18 · lassoan/SlicerElastix · GitHub

Thanks for your effort. I got this error, while I am testing your modifications now. I got this error:

                CochleaReg.py", line 398, in testSlicerCochleaRegistration
checksums='SHA256:d7cda4e106294a59591f03e74fbe9ecffa322dd1a9010b4d0590b377acc05eb5')[0]
               TypeError: downloadFromURL() got an unexpected keyword argument 'checksums'
               Reload and Test: Exception!

              downloadFromURL() got an unexpected keyword argument 'checksums'

Solved by changing the code to:

  nodeNames='P100001_DV_L_a'
  nodeNames='P100001_DV_L_a'
  fileNames='P100001_DV_L_a.nrrd'
  uris='https://cloud.uni-koblenz-landau.de/s/EwQiQidXqTcGySB/download'
  checksums='SHA256:d7cda4e106294a59591f03e74fbe9ecffa322dd1a9010b4d0590b377acc05eb5'
  if fixedImgPath is None:
      fixedVolumeNode = SampleData.downloadFromURL(uris, fileNames, nodeNames, checksums )[0]

@brhoom Did you test with a recent Slicer build? Checksum support was added to the SampleData module 6 days ago. See https://github.com/Slicer/Slicer/commit/aedb7d6702a30b485be952f2c933dfd96f072f02

As indicated by @jamesobutler, since the checksum has been introduced recently, make sure to use a recent Slicer version.

Only after all issues have been addressed in the master branch, I suggest you backport changes to the 4.10

The error was in 4.11.

I have another issue. By using simpledata , the volume has no storage node anymore. I find a workaround be reloading the volume.

I find a workaround be reloading the volume.

Since the downloaded data are for testing … keeping the storage node would not give the opportunity for the user to save in a location different from the tmp folder.

Updating the CochleaReg module, I noticed you were relaying on the filename associated with the storage node to restore the node name.

Without revisiting the approach, here what i did to make sure the storage node was available:

@brhoom This commit should fix the remaining test, I will let you cherry-pick what makes sense. See https://github.com/jcfr/SlicerCochlea/commit/30e61b013582e54fe940a63f2180050420fbe1ec

Summary:

1 Like