Open muratmaga opened 8 months ago
On Linux, I was able to install the extension, but when I tried a rigid only registration, this is the error message I got. if this is too early to test. Let me know. I am using the CBCT Dental Surgery sample dataset bundled with Slicer.
Traceback (most recent call last):
File "/home/exouser/Slicer/lib/Python/lib/python3.9/site-packages/itk/support/template_class.py", line 525, in __getitem__
this_item = self.__template__[key]
KeyError: (<itkCType float>, 3)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 666, in onRunRegistrationButton
self.logic.process(**parameters)
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 901, in process
initial_itk_transform = itk.AffineTransform[
File "/home/exouser/Slicer/lib/Python/lib/python3.9/site-packages/itk/support/template_class.py", line 529, in __getitem__
raise itk.TemplateTypeError(self, key)
itk.support.extras.TemplateTypeError: itk.AffineTransform is not wrapped for input type `itk.F, int`.
To limit the size of the package, only a limited number of
types are available in ITK Python. To print the supported
types, run the following command in your python environment:
itk.AffineTransform.GetTypes()
Possible solutions:
* If you are an application user:
** Convert your input image into a supported format (see below).
** Contact developer to report the issue.
* If you are an application developer, force input images to be
loaded in a supported pixel type.
e.g.: instance = itk.AffineTransform[itk.D, int].New(my_input)
* (Advanced) If you are an application developer, build ITK Python yourself and
turned to `ON` the corresponding CMake option to wrap the pixel type or image
dimension you need. When configuring ITK with CMake, you can set
`ITK_WRAP_${type}` (replace ${type} with appropriate pixel type such as
`double`). If you need to support images with 4 or 5 dimensions, you can add
these dimensions to the list of dimensions in the CMake variable
`ITK_WRAP_IMAGE_DIMS`.
Supported input types:
itk.D
itk.D
itk.D
The default precision is float
. I will change the default to double
(which doesn't error out like this) until float
is fixed. That should be done after we have the next RC version of ITK.
Generating the resampled volume works OK if no initial transform is specified. But as of right now, many things are broken.
I pushed the double
as default. Does this fix it for you?
Himm, not quite:
"Volume" Reader has successfully read the file "/home/exouser/.cache/slicer.org/Slicer/SlicerIO/PostDentalSurgery.gipl.gz" "[0.50s]"
"Volume" Reader has successfully read the file "/home/exouser/.cache/slicer.org/Slicer/SlicerIO/PreDentalSurgery.gipl.gz" "[0.49s]"
Instantiating the filter
Importing itk...
ITK 5.3.0 imported correctly
Passing Slicer nodes to ITK filters is not yet implemented
Traceback (most recent call last):
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 666, in onRunRegistrationButton
self.logic.process(**parameters)
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 918, in process
ants_reg = itk.ANTSRegistration[type(fixedImage), type(movingImage)].New()
File "/home/exouser/Slicer/lib/Python/lib/python3.9/site-packages/itk/support/lazy.py", line 131, in __getattribute__
value = types.ModuleType.__getattribute__(self, attr)
AttributeError: module 'itk' has no attribute 'ANTSRegistration'
Downloading latest stable Slicer on my Linux test machine, it worked (after I pushed another fix): Here is what I had in the log:
Switch to module: "ANTsRegistration"
------------------------------
Reloading module: ANTsRegistration
------------------------------
Starting the test
Requesting download RegLib_C01_1.nrrd from https://github.com/Slicer/SlicerTestingData/releases/download/SHA256/998cb522173839c78657f4bc0ea907cea09fd04e44601f17c82ea27927937b95 ...
<i>Downloaded 496.0 KB (10% of 4.8 MB)...</i>
<i>Downloaded 992.0 KB (20% of 4.8 MB)...</i>
<i>Downloaded 1.5 MB (30% of 4.8 MB)...</i>
<i>Downloaded 1.9 MB (40% of 4.8 MB)...</i>
<i>Downloaded 2.4 MB (50% of 4.8 MB)...</i>
<i>Downloaded 2.9 MB (60% of 4.8 MB)...</i>
<i>Downloaded 3.4 MB (70% of 4.8 MB)...</i>
<i>Downloaded 3.9 MB (80% of 4.8 MB)...</i>
<i>Downloaded 4.4 MB (90% of 4.8 MB)...</i>
<i>Downloaded 4.8 MB (100% of 4.8 MB)...</i>
Download finished
Verifying checksum
Checksum OK
<b>Requesting load MRBrainTumor1 from /home/dzenan/.cache/slicer.org/Slicer/SlicerIO/RegLib_C01_1.nrrd ...</b>
"Volume" Reader has successfully read the file "/home/dzenan/.cache/slicer.org/Slicer/SlicerIO/RegLib_C01_1.nrrd" "[0.14s]"
<b>Load finished</b><p></p>
Requesting download RegLib_C01_2.nrrd from https://github.com/Slicer/SlicerTestingData/releases/download/SHA256/1a64f3f422eb3d1c9b093d1a18da354b13bcf307907c66317e2463ee530b7a97 ...
<i>Downloaded 600.0 KB (10% of 5.8 MB)...</i>
<i>Downloaded 1.2 MB (20% of 5.8 MB)...</i>
<i>Downloaded 1.8 MB (30% of 5.8 MB)...</i>
<i>Downloaded 2.3 MB (40% of 5.8 MB)...</i>
<i>Downloaded 2.9 MB (50% of 5.8 MB)...</i>
<i>Downloaded 3.5 MB (60% of 5.8 MB)...</i>
<i>Downloaded 4.1 MB (70% of 5.8 MB)...</i>
<i>Downloaded 4.7 MB (80% of 5.8 MB)...</i>
<i>Downloaded 5.3 MB (90% of 5.8 MB)...</i>
<i>Downloaded 5.8 MB (100% of 5.8 MB)...</i>
Download finished
Verifying checksum
Checksum OK
<b>Requesting load MRBrainTumor2 from /home/dzenan/.cache/slicer.org/Slicer/SlicerIO/RegLib_C01_2.nrrd ...</b>
"Volume" Reader has successfully read the file "/home/dzenan/.cache/slicer.org/Slicer/SlicerIO/RegLib_C01_2.nrrd" "[0.11s]"
<b>Load finished</b><p></p>
Instantiating the filter
Importing itk...
ITK will be downloaded and installed now. The process might take a minute.
Collecting itk-ants>=0.2.0
Downloading itk_ants-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (1.5 kB)
Collecting itk>=5.3.0 (from itk-ants>=0.2.0)
Downloading itk-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.4 kB)
Collecting itk-core==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_core-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.5 kB)
Collecting itk-numerics==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_numerics-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.3 kB)
Collecting itk-io==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_io-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.3 kB)
Collecting itk-filtering==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_filtering-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.4 kB)
Collecting itk-registration==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_registration-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.4 kB)
Collecting itk-segmentation==5.3.0 (from itk>=5.3.0->itk-ants>=0.2.0)
Downloading itk_segmentation-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (9.4 kB)
Requirement already satisfied: numpy in ./lib/Python/lib/python3.9/site-packages (from itk>=5.3.0->itk-ants>=0.2.0) (1.26.1)
Downloading itk_ants-0.2.0-cp39-cp39-manylinux_2_28_x86_64.whl (7.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 7.7/7.7 MB 6.3 MB/s eta 0:00:00
Downloading itk-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (8.3 kB)
Downloading itk_core-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (81.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 81.2/81.2 MB 25.0 MB/s eta 0:00:00
Downloading itk_filtering-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (73.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 73.5/73.5 MB 24.4 MB/s eta 0:00:00
Downloading itk_io-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (25.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 25.6/25.6 MB 39.5 MB/s eta 0:00:00
Downloading itk_numerics-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (58.8 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.8/58.8 MB 25.8 MB/s eta 0:00:00
Downloading itk_registration-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (26.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.6/26.6 MB 36.4 MB/s eta 0:00:00
Downloading itk_segmentation-5.3.0-cp39-cp39-manylinux_2_28_x86_64.whl (16.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.5/16.5 MB 47.4 MB/s eta 0:00:00
Installing collected packages: itk-core, itk-numerics, itk-io, itk-filtering, itk-segmentation, itk-registration, itk, itk-ants
Successfully installed itk-5.3.0 itk-ants-0.2.0 itk-core-5.3.0 itk-filtering-5.3.0 itk-io-5.3.0 itk-numerics-5.3.0 itk-registration-5.3.0 itk-segmentation-5.3.0
ITK 5.3.0 installed correctly
ITK 5.3.0 imported correctly
This initialization is not yet implemented
Stage 0 started
CompositeTransform (0xabc8740)
RTTI typeinfo: itk::CompositeTransform<double, 3u>
Reference Count: 4
Modified Time: 14159916
Debug: Off
Object Name:
Observers:
none
Transforms in queue, from begin to end:
>>>>>>>>>
AffineTransform (0x5398bf0)
RTTI typeinfo: itk::AffineTransform<double, 3u>
Reference Count: 2
Modified Time: 9448651
Debug: Off
Object Name:
Observers:
none
Matrix:
1 0 0
0 1 0
0 0 1
Offset: [0, 0, 0]
Center: [0, 0, 0]
Translation: [0, 0, 0]
Inverse:
1 0 0
0 1 0
0 0 1
Singular: 0
>>>>>>>>>
Euler3DTransform (0x6905560)
RTTI typeinfo: itk::Euler3DTransform<double>
Reference Count: 1
Modified Time: 14159913
Debug: Off
Object Name:
Observers:
none
Matrix:
0.999815 -0.0047334 0.0186226
0.0052049 0.999665 -0.0253522
-0.0184963 0.0254444 0.999505
Offset: [9.14162, 3.65252, -1.93833]
Center: [0, 0, 0]
Translation: [9.14162, 3.65252, -1.93833]
Inverse:
0.999815 0.0052049 -0.0184963
-0.0047334 0.999665 0.0254444
0.0186226 -0.0253522 0.999505
Singular: 0
Euler's angles: AngleX=0.0254472 AngleY=0.0185034 AngleZ=0.00473495
m_ComputeZYX = 0
End of MultiTransform.
<<<<<<<<<<
TransformsToOptimizeFlags, begin() to end():
1 1
TransformsToOptimize in queue, from begin to end:
>>>>>>>>>
AffineTransform (0x5398bf0)
RTTI typeinfo: itk::AffineTransform<double, 3u>
Reference Count: 2
Modified Time: 9448651
Debug: Off
Object Name:
Observers:
none
Matrix:
1 0 0
0 1 0
0 0 1
Offset: [0, 0, 0]
Center: [0, 0, 0]
Translation: [0, 0, 0]
Inverse:
1 0 0
0 1 0
0 0 1
Singular: 0
End of TransformsToOptimizeQueue.
<<<<<<<<<<
End of CompositeTransform.
<<<<<<<<<<
Processing completed in 19.39 seconds
Most importantly, check whether you have itk-ants
pip package. This extension should install it automatically, so knowing why it didn't would be useful.
It was not installed, I manually installed it with pip_install, but still getting the same error.
Instantiating the filter
Importing itk...
ITK 5.3.0 imported correctly
Passing Slicer nodes to ITK filters is not yet implemented
Traceback (most recent call last):
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 666, in onRunRegistrationButton
self.logic.process(**parameters)
File "/home/exouser/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 918, in process
ants_reg = itk.ANTSRegistration[type(fixedImage), type(movingImage)].New()
File "/home/exouser/Slicer/lib/Python/lib/python3.9/site-packages/itk/support/lazy.py", line 131, in __getattribute__
value = types.ModuleType.__getattribute__(self, attr)
AttributeError: module 'itk' has no attribute 'ANTSRegistration'
Also in my case for some reason additional module paths do not persist between slicer restarts. Everytime, I have to manually add the extension repo using the Extension Wizard. Not sure why.
Complete log in a different Linux box, with a freshly cloned SlicerANTs, log shows all the steps including Extension Wizard part:
Popen(['git', 'version'], cwd=/home/maga, universal_newlines=False, shell=None, istream=None)
Popen(['git', 'version'], cwd=/home/maga, universal_newlines=False, shell=None, istream=None)
Popen(['git', 'cat-file', '--batch-check'], cwd=/home/maga/SlicerANTs, universal_newlines=False, shell=None, istream=<valid stream>)
Encoding detection: utf_8 is most likely the one.
Encoding detection: utf_8 is most likely the one.
Switch to module: "ANTsRegistration"
QXcbConnection: XCB error: 3 (BadWindow), sequence: 3021, resource id: 10515545, major code: 40 (TranslateCoords), minor code: 0
Switch to module: "SampleData"
Requesting download PreDentalSurgery.gipl.gz from https://github.com/Slicer/SlicerTestingData/releases/download/SHA256/7bfa16945629c319a439f414cfb7edddd2a97ba97753e12eede3b56a0eb09968 ...
Downloaded 2.4 MB (10% of 23.6 MB)...
Downloaded 4.7 MB (20% of 23.6 MB)...
Downloaded 7.1 MB (30% of 23.6 MB)...
Downloaded 9.5 MB (40% of 23.6 MB)...
Downloaded 11.8 MB (50% of 23.6 MB)...
Downloaded 14.2 MB (60% of 23.6 MB)...
Downloaded 16.5 MB (70% of 23.6 MB)...
Downloaded 18.9 MB (80% of 23.6 MB)...
Downloaded 21.3 MB (90% of 23.6 MB)...
Downloaded 23.6 MB (100% of 23.6 MB)...
Download finished
Verifying checksum
Checksum OK
Requesting load PreDentalSurgery from /home/maga/.cache/slicer.org/Slicer/SlicerIO/PreDentalSurgery.gipl.gz ...
"Volume" Reader has successfully read the file "/home/maga/.cache/slicer.org/Slicer/SlicerIO/PreDentalSurgery.gipl.gz" "[2.01s]"
Load finished
Requesting download PostDentalSurgery.gipl.gz from https://github.com/Slicer/SlicerTestingData/releases/download/SHA256/4cdc3dc35519bb57daeef4e5df89c00849750e778809e94971d3876f95cc7bbd ...
Downloaded 3.4 MB (10% of 33.8 MB)...
Downloaded 6.8 MB (20% of 33.8 MB)...
Downloaded 10.1 MB (30% of 33.8 MB)...
Downloaded 13.5 MB (40% of 33.8 MB)...
Downloaded 16.9 MB (50% of 33.8 MB)...
Downloaded 20.3 MB (60% of 33.8 MB)...
Downloaded 23.6 MB (70% of 33.8 MB)...
Downloaded 27.0 MB (80% of 33.8 MB)...
Downloaded 30.4 MB (90% of 33.8 MB)...
Downloaded 33.8 MB (100% of 33.8 MB)...
Download finished
Verifying checksum
Checksum OK
Requesting load PostDentalSurgery from /home/maga/.cache/slicer.org/Slicer/SlicerIO/PostDentalSurgery.gipl.gz ...
"Volume" Reader has successfully read the file "/home/maga/.cache/slicer.org/Slicer/SlicerIO/PostDentalSurgery.gipl.gz" "[0.33s]"
Load finished
Switch to module: "Data"
Switch to module: "ANTsRegistration"
/home/maga/Downloads/Slicer/bin/Python/slicer/util.py:2786: UserWarning: does not have observer
warn("does not have observer")
Instantiating the filter
Importing itk...
ITK 5.3.0 imported correctly
Passing Slicer nodes to ITK filters is not yet implemented
Traceback (most recent call last):
File "/home/maga/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 666, in onRunRegistrationButton
self.logic.process(**parameters)
File "/home/maga/SlicerANTs/ANTsRegistration/ANTsRegistration.py", line 918, in process
ants_reg = itk.ANTSRegistration[type(fixedImage), type(movingImage)].New()
File "/home/maga/Downloads/Slicer/lib/Python/lib/python3.9/site-packages/itk/support/lazy.py", line 131, in __getattribute__
value = types.ModuleType.__getattribute__(self, attr)
AttributeError: module 'itk' has no attribute 'ANTSRegistration'
Everytime, I have to manually add the extension repo using the Extension Wizard. Not sure why.
If you CTRL-C instead of cleanly exiting, the settings may not be saved.
installing SlicerANTS modules
Instead of using the ExtensionWizard, I suggest you simply drag-and-drop the directory onto Slicer:
Step 1: Drag & drop | Step 2: Load and update settings |
---|---|
For reference, see https://discourse.slicer.org/t/new-feature-install-modules-by-drag-and-drop-python-files/28311
it appears there is an issue with drag and dropping the extension in Mac. Doesn't seem to register it as extension packages.
By the way, these issues (both extension wizard and dragging and dropping SlicerANTs to Slicer windows) persists on Mac in the latest preview. If I drag and drop the SlicerANTs folder, it gives me a popup asking for a reader for the data in which the options are either DICOM or AnyData.
For example, if I do the same with the SlicerMorph modules, it defaults the suggested reader to add "Python Scripted modules to the application". This is not an option with SlicerANTs repo.
When I use extension wizard to add the cloned repo, it is stuck at this screen and this is the message in the log file.