# jpg2000

**URL:** https://discourse.itk.org/t/jpg2000/1345
**Category:** Beginner Questions
**Created:** [October 11, 2018, 9:18am UTC](https://discourse.itk.org/t/jpg2000/1345 "2018-10-11T09:18:40Z")
**Posts on this page:** 8
**Page:** 2

<div class="post-metadata">

### Author: ![ludicludo](https://discourse.itk.org/user_avatar/discourse.itk.org/ludicludo/32/526_2.png) [@ludicludo](https://discourse.itk.org/u/ludicludo)
#### Post date: [October 17, 2018, 7:27pm UTC](https://discourse.itk.org/t/jpg2000/1345/21 "2018-10-17T19:27:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [October 17, 2018, 7:34pm UTC](https://discourse.itk.org/t/jpg2000/1345/22 "2018-10-17T19:34:33Z")

</div>

There is the documentation for building SimpleITK:  
[https://simpleitk.readthedocs.io/en/master/Documentation/docs/source/building.html](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:

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

```

or you could make a wheel with:

```auto
make -C SimpleITK-build dist

```

---

<div class="post-metadata">

### Author: ![ludicludo](https://discourse.itk.org/user_avatar/discourse.itk.org/ludicludo/32/526_2.png) [@ludicludo](https://discourse.itk.org/u/ludicludo)
#### Post date: [October 18, 2018, 4:17am UTC](https://discourse.itk.org/t/jpg2000/1345/23 "2018-10-18T04:17:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ludicludo](https://discourse.itk.org/user_avatar/discourse.itk.org/ludicludo/32/526_2.png) [@ludicludo](https://discourse.itk.org/u/ludicludo)
#### Post date: [October 18, 2018, 4:50am UTC](https://discourse.itk.org/t/jpg2000/1345/24 "2018-10-18T04:50:17Z")

</div>

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](https://discourse.itk.org/uploads/default/original/1X/d079e599269bf1307e351742752558f1ef32330c.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

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [October 18, 2018, 1:21pm UTC](https://discourse.itk.org/t/jpg2000/1345/25 "2018-10-18T13:21:26Z")

</div>

This [patch](http://review.source.kitware.com/#/c/23783/) 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?

---

<div class="post-metadata">

### Author: ![ludicludo](https://discourse.itk.org/user_avatar/discourse.itk.org/ludicludo/32/526_2.png) [@ludicludo](https://discourse.itk.org/u/ludicludo)
#### Post date: [October 19, 2018, 4:42am UTC](https://discourse.itk.org/t/jpg2000/1345/26 "2018-10-19T04:42:26Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ludicludo](https://discourse.itk.org/user_avatar/discourse.itk.org/ludicludo/32/526_2.png) [@ludicludo](https://discourse.itk.org/u/ludicludo)
#### Post date: [October 20, 2018, 8:09pm UTC](https://discourse.itk.org/t/jpg2000/1345/27 "2018-10-20T20:09:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [October 22, 2018, 1:56pm UTC](https://discourse.itk.org/t/jpg2000/1345/28 "2018-10-22T13:56:01Z")

</div>

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.

[Previous page](https://discourse.itk.org/t/jpg2000/1345.md?page=1)
