This should now be fixed in r28350
In a nutshell, regular expression can not be used as globbing expression.
This should now be fixed in r28350
In a nutshell, regular expression can not be used as globbing expression.
It is, thanks @jcfr!
Hi,
I’m trying to use SimpleElastix within Anaconda while using Slicer (to do my registration). I feel like my problem is related to this issue here.
So it seems that SimpleElastix is not included in the SimpleITK of Slicer because when I import SimpleITK as sitk I get this error:
Module 'SimpleITK' has no attribute 'ElastixImageFilter'
How can I tell anaconda which version to use?
Similar to the solution here I changed _SimpleITK.so
to _SimpleITK*.so
in my build directory for SimpleElastix installation and then did sudo python setup.py install again but it still looks for _SimpleITK.so
.
Do you have any recommendations?
Thanks very much.
You can use SlicerElastix extension and to get Elastix binaries that are compatible with Slicer’s SimpleITK version that you can use from Python. Command-line interface may not be as convenient as Python, but it comes with nice perks, such as being able to run the registration in the background and stop it any time without impacting the application.
Sorry I’m a beginner so I have the SlicerElastix installed on my computer but should I import something? (I tried importing SlicerElastix but didn’t work)
I also tried slicer.util.pip_install(‘SimpleElastix’) but this is the error I get (my computer is mac 10.14):
ERROR: Could not find a version that satisfies the requirement SimpleElastix (from versions: 0.9.1.macosx-10.11-intel, 0.10.0.post224.macosx-10.6-x86_64)
ERROR: No matching distribution found for SimpleElastix
when I write my code in the jupyter notebook I import SimpleITK as sitk. Here’s the code:
import SimpleITK as sitk
# Concatenate the ND images into one (N+1)D image
MRI_nodes = ['image1.hdr', ..., 'imageN.hdr']
vectorOfImages = sitk.VectorOfImage()
for volumenode in MRI_nodes:
sitk_images = sitkUtils.PullVolumeFromSlicer(volumenode)
vectorOfImages.push_back(sitk_images)
image = sitk.JoinSeries(vectorOfImages)
# Register
elastixImageFilter = sitk.ElastixImageFilter()
elastixImageFilter.SetFixedImage(image)
elastixImageFilter.SetMovingImage(image)
elastixImageFilter.SetParameterMap(sitk.GetDefaultParameterMap('groupwise'))
elastixImageFilter.Execute()
**elastixImageFilter = sitk.ElastixImageFilter() → this is what gives me the error and when I use the tab after sitk. I don’t see ElastixImageFilter in the menu
Sequence registration module is a good example of how to run the Elastix command-line executables from Python. These executables are not Python modules, they are command-line applications.
See above. SlicerElastix extension provides you Elastix command-line applications, not the Python package.
If you absolutely want to run Elastix via SimpleElastix then you may need to do it in an external Python environment. For example, you install anaconda, create a virtual Python environment, in that environment you install SimpleElastix, and then from Slicer you run the registration script in that environment.