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 663 forks source link

Calling python itk.meshread on the linked file causes itk to segfault. #4478

Closed HastingsGreer closed 4 months ago

HastingsGreer commented 6 months ago

Description

Calling python itk.meshread on the linked file causes itk to segfault.

Steps to Reproduce

Download

https://github.com/uncbiag/OAI_analysis_2/blob/oh-no/meshR.vtk

import itk
itk.imread("meshR.vtk")

Actual behavior

>>> itk.meshread("Downloads/meshR.vtk")
zsh: segmentation fault  python
(base) hastings@hastingss-air ~ % /Users/hastings/opt/anaconda3/lib/python3.8/multiprocessing/resource_tracker.py:216:     UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown
  warnings.warn('resource_tracker: There appear to be %d '

Reproducibility

I have reproduced on mac and linux 100%

Versions

I have seen this on itk 5.3.0

Environment

Mac and linux, with the default pip install itk

Additional Information

HastingsGreer commented 6 months ago

Quick and easy reproduction: https://colab.research.google.com/drive/1n1t0525CigneZ--2QTxSsiPsKXQ6LKaP?usp=sharing

(There is no output when it segfaults, the notebook just restarts with an error message)

thewtex commented 6 months ago

The reader is choking on the presence of OFFSETS, which is because VTK changed the format in legacy file format version 5.1:

https://github.com/Kitware/VTK/commit/7f76b9e97b1a05cfe4fcd5f9af58f0d7a385b639

which is currently undocumented:

https://gitlab.kitware.com/vtk/vtk/-/issues/17989

thewtex commented 4 months ago

Also: https://discourse.vtk.org/t/legacy-polydata-file-compatibility/5354/11