Skip to content

Crash while generating meshes (access violation) #90

@MattTheCuber

Description

@MattTheCuber

Hello, I have been generating meshes based on the segmentations from MSD. Once my script hit the Task05_Prostate labels, it started crashing seemingly randomly. It fails anywhere from the first to the 16th from my testing. I'm sure there is a pattern, but I couldn't find it. It succeeded on all my other datasets yesterday (Task01_BrainTumour, Task02_Heart, Task03_Liver, Task04_Hippocampus) without any problems, and there is no real difference from the working data to this data as far as size, data type, or scalar range.

When I enable fault handler, I get the following output:

Windows fatal exception: access violation

Current thread 0x00007704 (most recent call first):
  File "....\venv\Lib\site-packages\itk\ITKCommonBasePython.py", line 3115 in UpdateLargestPossibleRegion
  File "...\.venv\Lib\site-packages\itk\ITKCommonBasePython.py", line 3327 in __internal_call__
  File "...\.venv\Lib\site-packages\itk\itkCuberilleImageToMeshFilterPython.py", line 6444 in cuberille_image_to_mesh_filter
  File "...\.venv\Lib\site-packages\itk\support\helpers.py", line 157 in image_filter_wrapper
  ...

A simple producible script is shown below.

Download and extract the dataset: https://msd-for-monai.s3-us-west-2.amazonaws.com/Task05_Prostate.tar

import faulthandler
from pathlib import Path

import itk
import nibabel as nib

itk.Image  # implicitly load ITKCommon module

from itk.CuberillePython import cuberille_image_to_mesh_filter

faulthandler.enable()

for path in Path("Task05_Prostate/labelsTr").glob("*.nii.gz"):
    if path.name.startswith("._"):
        continue  # Skip macOS metadata files
    print(f"Processing {path}...")
    img = nib.load(path)
    data = img.get_fdata()
    cuberille_image_to_mesh_filter(data, project_vertices_to_iso_surface=False)

Environment

  • Operating System: Windows 11
  • Python Version: 3.13
  • ITK Version: 5.4.4.post1
  • ITKCuberille Version: 2.7.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions