Hi all,
I hope this is a relevant question for this forum …
I am trying to install simpleITK in Anaconda3 environment. I followed the instructions in the manual.
pip install SimpleITK
conda list
I can see SimpleITK is in the list of packages.
I did run this script and it did show installation is correct!
from __future__ import print_function
import importlib
from distutils.version import LooseVersion
# check that all packages are installed (see requirements.txt file)
required_packages = {'jupyter',
'numpy',
'matplotlib',
'ipywidgets',
'scipy',
'pandas',
'SimpleITK'
}
problem_packages = list()
# Iterate over the required packages: If the package is not installed
# ignore the exception.
for package in required_packages:
try:
p = importlib.import_module(package)
except ImportError:
problem_packages.append(package)
if len(problem_packages) is 0:
print('All is well.')
else:
print('The following packages are required but not installed: ' \
+ ', '.join(problem_packages))
output: All is well
meaning the SimpleITK binaries are installed in my condo virtual environment installed.
I tried to write my first SimpleITK program to make sure it is working
import SimpleITK as sitk
%run update_path_to_download_script
from downloaddata import fetch_data, fetch_data_all
from ipywidgets import interact
print(sitk.Version())
%run update_path_do_download_script not recognized because the magic command %run is not there. therefore next line:
from download data import fetch_data, fetch_data_all
raises an error meaning downloaddata python script is not in my python path, that is SimpleITK does not have this script, I have checked SimpleITK-Notebook has download data.py in repository but I have installed binary SimpleITK.
I hope this question is relevant to the ITK forum,
any help is appreciated.
Before you proceed any further I recommend that you skim through the SimpleITK read-the-docs. It will illustrate how to install SimpleITK and introduce the toolkit’s fundamental concepts and conventions.
To your questions:
To install SimpleITK for anaconda/miniconda conda install -c simpleitk simpleitk.
The errors you are encountering are due to the fact that the notebook repository has additional functionality that is outside the SimpleITK scope (downloading data from cloud storage, visualization of images in notebooks etc.). You are also using code that is intended for use in ipython and not standard Python scripts (e.g. %run magic).
You can obviously copy the relevant code from the notebook repository and use it, but these are auxiliary functions that are mostly useful if you intend to write code using Jupyter notebooks and not standalone Python scripts, or want to download the images used by the notebooks for other uses.
Hi @ziv,
Thank you for the help, I ended up super building the entire simpleitk, and I tell you a good one week pain! for some reason the PythonVirtualEnv.vcxproj project of python wrapping exited in cmd.exe with return value = 1 and I did get a lot of errors, I think this was the part which installs python simpleitk.egg into miniconda3, though the python/java/csharp wrappings supper build succeeded.
I could not use SimpleITK.Show(SimpleITK.Image, “SimpleITK.jpg”, “SimpleITK Logo”) and this fails. I have posted it this morning on this forum!
I am going to test CSharp/Java wrapping and see how they actually work.
Thanks anyways if you have any suggestions I appreciate. I am having problems to find working examples python wrapping SimpleITK and what I have right now is the latest and seems to me that not many working examples, so a big struggle for me! any help regarding examples such as SimpleITK.DiscreteGaussianFilter which amazingly not documented under SimpleITK and rather SimpleITK.DiscreteGaussianImageFIlter is documented and that is not even clear how to be called from python because it is documented as C++ and I should try to just call it as SimpleITK.DiscreteGaussianImageFilter!? not sure yet, so some examples may help …
Regards,
sag