InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.4k stars 664 forks source link

ITK 5.2.1 Python Package Missing Wrappings #2706

Closed tbirdso closed 3 years ago

tbirdso commented 3 years ago

Description

The ITK Python 5.2.1 distribution does not contain several Python wrappings that were included in the 5.2.1 release schedule. This includes imread enhancements and additional wrappings for SymmetricSecondRankTensor and mesh filters.

The issue has been observed both locally and in Github CI depending on the ITK Python packages. CI is failing in the ITKStrain external module due to being unable to find wrappings that should be introduced in v5.2.1.

TransformToStrainImageFilter PR fails because GenerateImageSource is not wrapped for SSRT

Steps to Reproduce

  1. pip install itk==5.2.1
  2. Launch Python console and verify installation path and version
    import itk
    print(itk.__file__)
    print(itk.__version__)
  3. Check wrappings availability:
    itk.MeshToMeshFilter.GetTypes()
    itk.GenerateImageSource.GetTypes()
  4. Try reading in vector-valued data with imread, such as a Nrrd sequence volume:
    itk.imread('vectordata.seq.nrrd', pixel_type=itk.VariableLengthVector[itk.F])

Expected behavior

  1. Package installs
  2. File and version match current environment and 5.2.1
  3. MeshToMeshFilter is wrapped for scalar types and GenerateImageSource is wrapped for real types per 5.2.1 release schedule
  4. Vector image is read in successfully.

These steps pass when testing against a local build of ITK 5.2.1.

Actual behavior

  1. Package installs

    Successfully installed itk-5.2.1
  2. Package path is correct but version is 5.2.0

    >>> itk.__file__
    'C:\\Users\\tom.birdsong\\Anaconda3\\envs\\venv-itk\\lib\\site-packages\\itk\\__init__.py'
    >>> itk.__version__
    '5.2.0'

    I have verified that the distribution folders in this site-packages path are all named for version 5.2.1 such as follows:

    itk_core-5.2.1.dist-info

  3. Wrapping expansions in 5.2.1 are not included:

    >>> itk.MeshToMeshFilter.GetTypes()
    <itkTemplate itk::MeshToMeshFilter>
    Options:
    [<class 'itk.itkMeshBasePython.itkMeshD2'>, <class 'itk.itkMeshBasePython.itkMeshD2'>]
    [<class 'itk.itkMeshBasePython.itkMeshD3'>, <class 'itk.itkMeshBasePython.itkMeshD3'>]
    [<class 'itk.itkMeshBasePython.itkMeshD4'>, <class 'itk.itkMeshBasePython.itkMeshD4'>]
    [<class 'itk.itkMeshBasePython.itkMeshF2'>, <class 'itk.itkMeshBasePython.itkMeshF2'>]
    [<class 'itk.itkMeshBasePython.itkMeshF3'>, <class 'itk.itkMeshBasePython.itkMeshF3'>]
    [<class 'itk.itkMeshBasePython.itkMeshF4'>, <class 'itk.itkMeshBasePython.itkMeshF4'>]

    (no scalar types)

    >>> itk.GenerateImageSource.GetTypes()
    <itkTemplate itk::GenerateImageSource>
    Options:
    ....

    (no SSRT types)

  4. imread fails

    itk.imread('vectordata.seq.nrrd', pixel_type=itk.VariableLengthVector[itk.F])
    Traceback (most recent call last):
    File "C:\Users\tom.birdsong\Anaconda3\envs\venv-itk\lib\site-packages\itk\support\template_class.py", line 525, in __getitem__
    this_item = self.__template__[key]
    KeyError: (<class 'itk.itkVariableLengthVectorPython.itkVariableLengthVectorF'>, 3)

Reproducibility

100%

Versions

Expecting v5.2.1, may be pulling v5.2.0 despite naming?

Environment

I am using an Anaconda environment for Python 3.8.5 on Windows. CI is failing across at least Python 3.6 and 3.7 pipelines across platforms.

Additional Information

Float wrapping added for SymmetricSecondRankTensor in 5.2.1 seems to be present in the PyPi package:

<itkTemplate itk::SymmetricSecondRankTensor>
Options:
  [<itkCType double>, 2]
  [<itkCType double>, 3]
  [<itkCType double>, 4]
  [<itkCType float>, 2]
  [<itkCType float>, 3]
  [<itkCType float>, 4]

@dzenanz @thewtex

thewtex commented 3 years ago

@tbirdso thanks for the report!

Yes, it looks like we ended up with the wrong hash in the release. Should be addressed with: https://github.com/InsightSoftwareConsortium/ITKPythonPackage/commit/380a0ce05adea5a3656f0327bb329fbcd1ce87ac

We'll build / test and upload as itk-5.2.1.post1.

thewtex commented 3 years ago

These are now built / addressed, except for Linux-ARM, which is building.

CC @aylward