ALPACA in SlicerMorph

Hello,
I am new to Slicer, tying to learn ALPACA in SlicerMorph.
I am following the steps described here.
When I click on “Run subsampling”, an error occurs : Import Error: cannot import name ‘registration’
I wonder how to solve the problem. Any advice would be appreciated.

Operating system: Windows 10 Pro
Slicer version: 4.11.20210226 r29738 / 7a593c8
Expected behavior: getting a target mesh
Actual behavior: an error occurs

Can you open Python console and type:
import open3d
and report what it says?

M

It does not seem to say anything.
I installed open3d with “pip_install(“open3d”)”

It should automatically install both open3d and pycpd. Did you install that as well with
pip_install(‘pycpd’)

Yes. I also tried different versions of open3d. All caused an error (sometimes not the same error though).
Is there anything else I could try?

This is a bit strange because I can’t replicate this error on any of my windows 10 computer with the latest stable (which is what you are runngin). Can you provide a screen capture of the settings (and copy and paste the entire log file)
@smrolfe @agporto ?

What settings are you referring to?
Here is the log file:

[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Session start time …: 2021-05-24 15:30:52
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Slicer version …: 4.11.20210226 (revision 29738 / 7a593c8) win-amd64 - installed release
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Operating system …: Windows / Professional / (Build 19041, Code Page 65001) - 64-bit
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Memory …: 98022 MB physical, 112358 MB virtual
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - CPU …: GenuineIntel , 16 cores, 16 logical processors
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - VTK configuration …: OpenGL2 rendering, TBB threading
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Qt configuration …: version 5.15.1, with SSL, requested OpenGL 3.2 (compatibility profile)
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Developer mode enabled …: no
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Prefer executable CLI …: yes
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Application path …: C:/Slicer 4.11.20210226/bin
[DEBUG][Qt] 24.05.2021 15:30:52 [] (unknown:0) - Additional module paths …: NA-MIC/Extensions-29738/SurfaceWrapSolidify/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/RawImageGuess/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SlicerDcm2nii/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SlicerIGT/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/SlicerIGT/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SlicerMorph/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/Auto3dgm/lib/Slicer-4.11/cli-modules, NA-MIC/Extensions-29738/Auto3dgm/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/Sandbox/lib/Slicer-4.11/qt-loadable-modules, NA-MIC/Extensions-29738/Sandbox/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/SegmentEditorExtraEffects/lib/Slicer-4.11/qt-scripted-modules, NA-MIC/Extensions-29738/MarkupsToModel/lib/Slicer-4.11/qt-loadable-modules
[DEBUG][Python] 24.05.2021 15:30:53 [Python] (C:\Slicer 4.11.20210226\lib\Python\Lib\site-packages\pydicom\datadict.py:432) - Reversing DICOM dictionary so can look up tag from a keyword…
[WARNING][Qt] 24.05.2021 15:30:53 [] (unknown:0) - libpng warning: iCCP: profile ‘ICC Profile’: ‘CMYK’: invalid ICC profile color space
[WARNING][Qt] 24.05.2021 15:30:54 [] (unknown:0) - libpng warning: iCCP: known incorrect sRGB profile
[DEBUG][Python] 24.05.2021 15:30:54 [Python] (C:\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: Annotations
[DEBUG][Python] 24.05.2021 15:30:55 [Python] (C:\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentEditor
[DEBUG][Python] 24.05.2021 15:30:55 [Python] (C:\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: SegmentStatistics
[DEBUG][Python] 24.05.2021 15:30:56 [Python] (C:\Slicer 4.11.20210226\lib\Slicer-4.11\qt-scripted-modules\SubjectHierarchyPlugins\AbstractScriptedSubjectHierarchyPlugin.py:36) - Scripted subject hierarchy plugin registered: ExportAs
[DEBUG][Qt] 24.05.2021 15:30:56 [] (unknown:0) - Switch to module: “Welcome”
[DEBUG][Qt] 24.05.2021 15:31:08 [] (unknown:0) - Switch to module: “ALPACA”
[INFO][Stream] 24.05.2021 15:31:09 [] (unknown:0) - o3d installed
[INFO][Stream] 24.05.2021 15:31:09 [] (unknown:0) - pycpd installed
[CRITICAL][Stream] 24.05.2021 15:31:09 [] (unknown:0) - PythonQt: QObject::connect() signal ‘validInputChanged(bool)’ does not exist on QCheckBox
[INFO][Stream] 24.05.2021 15:31:37 [] (unknown:0) - :: Loading point clouds and downsampling
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - Traceback (most recent call last):
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - File “C:/Slicer 4.11.20210226/NA-MIC/Extensions-29738/SlicerMorph/lib/Slicer-4.11/qt-scripted-modules/ALPACA.py”, line 353, in onSubsampleButton
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - self.targetModelSelector.currentPath, self.skipScalingCheckBox.checked, self.parameterDictionary)
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - File “C:/Slicer 4.11.20210226/NA-MIC/Extensions-29738/SlicerMorph/lib/Slicer-4.11/qt-scripted-modules/ALPACA.py”, line 903, in runSubsample
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - source_down, source_fpfh = self.preprocess_point_cloud(source, voxel_size, parameters[“normalSearchRadius”], parameters[“FPFHSearchRadius”])
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - File “C:/Slicer 4.11.20210226/NA-MIC/Extensions-29738/SlicerMorph/lib/Slicer-4.11/qt-scripted-modules/ALPACA.py”, line 942, in preprocess_point_cloud
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - from open3d import registration
[CRITICAL][Stream] 24.05.2021 15:31:37 [] (unknown:0) - ImportError: cannot import name ‘registration’

Can you check your open3d version?
The easiest way is to go to the python interpreter within Slicer and type:
import open3d
open3d.__version__

The reason for that is that open3d reorganized some modules from one version to another. So, you would have to pip_uninstall(‘open3d’ and then pip_install(‘open3d==0.10.0’)
That should solve it

It worked out! My open3d version was 12.
Thank you!

1 Like

Glad to hear ! Don’t hesitate to reach out if you have other issues with it

1 Like

@agporto you can enforce a particular open3d version similarly to how it is done here.

I maintain that this open3d package is a hodge-podge of random stuff and there are lots of red flags in the code and how it is managed. Even though it contains some useful algorithms and the package may improve in the future, I would recommend to look for alternatives if you want to avoid unnecessary trouble.

1 Like

It is actually enforced, it is version 0.10

But we need to update hte tutorial, which uses a generic pip_install(“open3d”)

1 Like

Thanks @lassoan . It is good to know there is a way to check the installed version. Normally, users would have version 0.10.0 installed by default, as Murat mentioned. But it seems this user manually installed open3d from the python interpreter.
I also agree with regard to the issue of having external dependencies (such as open3d). However, outside of Sara (who is the main developer on SlicerMorph and has a lot of stuff on her plate), we don’t really have a dedicated developer that could tackle this issue in the short term. So, at least for now, we have to rely on these dependencies to some extent.

Just to be clear with what happened to me as far as I can remember:

  1. I opened ALPACA for the first time and the installation of open3d automatically started.
  2. But after that I still could not open ALPACA correctly (the two tabs did not appear).
  3. So I thought there was something wrong with the installation of open3d. So I ran pip_install(“open3d”) (which probably overwrote the version 0.10 with 0.12). After this, I also found out that pycpd was not automatically installed (I don’t know if this is default). So I ran pip_install(“pycpd”) and finally ALPACA opened. But naturally, the version of open3d is different, which caused an error.

So my problem was that pycpd was not automatically installed, so ALPACA did not open. But I misinterpreted it as a problem of open3d and replaced it with a newer version. I wonder if pycpd is supposed to get automatically installed when opening ALPACA for the first time. This happened again today using another computer.

Interesting. Thanks for the follow up. One quick question, do you have git installed on those machines? I am wondering if the pycpd installation is not happening because of git

Thanks for details. Pycpd also should automatically installed. SlicerMorph/ALPACA.py at 5bd5ee21b9f9b7d8e92d4828701ec8a29a120972 · SlicerMorph/SlicerMorph · GitHub

Open3d installation can take a minute, since it has a lot of dependencies. But i haven’t seen this before. We will try with a new installation.

No, I don’t have git on both computers.

1 Like

If there are known problems with any Python package versions then you can use the code snippet in the DICOMweb module that I referenced above. It does a few important things:

  • forces installation of the correct version of the package (if the installed version is unacceptable, even if import succeeds)
  • automatically restarts the application if needed (typically you need to restart the application if the package is already imported and you want to replace it with a different version)
  • it keeps the user informed about what’s happening and why (the user can just click OK, but has the option to interrupt the process, for example if that’s needed by some other modules).