jpg2000

Hi again,
I found a SimpleITK-1.2.0.dev298+gaffed-py2.7-linux-x86_64.egg file in ./SimpleITK-build/Wrapping/Python/dist/ directory. But apparently, this egg file is for python2.7 and I would like a python3 version. Is there a way to create one with the Superbuild feature ?
Regards
Ludovic

There is the documentation for building SimpleITK:
https://simpleitk.readthedocs.io/en/master/Documentation/docs/source/building.html

When you configure the SimpleITK, you need to make sure it is configured with the version of Python you want to use it with. You can use ccmake to configure the PYTHON CMake variable for the correct executable, include path, and libraries.

The “make install” conventions does not work with python package managers. After compilation you should be able to do something like:

cd SimpleITK-build/Wrapping/Python
python Packaging/setup.py install

or you could make a wheel with:

make -C SimpleITK-build dist

Hi,
It’s working!
Many thanks for your help and your time.
Regards
Ludovic

1 Like

Hi again,
An exception is raised when I try to open my jp2 file with sitk and Imagemagick open it without troubles.
Apparently, the image is correctly loaded as sitk.Show() displays the image.sitk_jp2_8.jp2 (1.1 MB)

Here is the output.

HDF5-DIAG: Error detected in HDF5 (1.10.3) thread 0:
#000: /home/physiciens/sitk/ITK/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5F.c line 509 in itk_H5Fopen(): unable to open file
major: File accessibilty
minor: Unable to open file
#001: /home/physiciens/sitk/ITK/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Fint.c line 1400 in itk_H5F__open(): unable to open file
major: File accessibilty
minor: Unable to open file
#002: /home/physiciens/sitk/ITK/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Fint.c line 1700 in itk_H5F_open(): unable to read superblock
major: File accessibilty
minor: Read failed
#003: /home/physiciens/sitk/ITK/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Fsuper.c line 411 in itk_H5F__super_read(): file signature not found
major: File accessibilty
minor: Not an HDF5 file
WARNING: In /home/physiciens/sitk/ITK/Modules/IO/JPEG2000/src/itkJPEG2000ImageIO.cxx, line 347
JPEG2000ImageIO (0x2d35d50): file does not specify color space, assuming sRGB

Do I miss a library ? In case, I upload one of my jp2 file.
Regards
Ludovic

This patch should silence the warnings from HDF5 library. And those exceptions are all caught and dismissed by IO infrastructure. The warning about assuming sRGB should be just a warning, image loading should succeed. Is it not so?

1 Like

Hi,
Yes, images are loaded and I am able to visualize them with sitk.Show() command.
I’ll patch the source code and let you know.Thanks.
Regards
Ludovic

1 Like

Hi,
I have a basic question regarding applying the patch.
I have patched ITK source directory I got from a git clone command from main ITK repo. But how could I do the same on SimpleITK that comes with Superbuild ?
Regards
Ludovic

You will need to compile ITK outside of the SimpleITK superbuild, then tell SimpleITK to use your ITK build directory.

To configure your custom ITKv5 to be compatible with SimpleITK you will need to pass the following flags to the ITK configuration: -DCMAKE_CXX_STANDARD:STRING=11 -DITKV4_COMPATIBILITY:BOOL=ON -DITK_LEGACY_REMOVE:BOOL=OFF -DModule_ITKIOJPEG2000:BOOL=ON additionally you may want to turn on any option ITK modules you want to use, such as Review. Next compile ITK.

To configure SimpleITK to use your compiled ITK build directory pass the following flags: -DSimpleITK_USE_SYSTEM_ITK:BOOL=ON -DITK_DIR:PATH=the_path_to_your_itk_build_directory -DCMAKE_CXX_STANDARD:STRING=11. Then compile SimpleITK.

The initial configuration of SimpleITK was passed several flags that were just passed to the ITK build. Building ITK separately mean passing those flags to the ITK configurations.