Repository navigation
Conversation
|
There was another PR recently which mentioned empty arrays. Should some change be done there? |
|
The recent related change I found is #6929. I checked it against this PR: it handles empty transform parameters before calling GetArrayFromVnlVector, whereas #6986 fixes the separate VectorContainer-to-NumPy bridge. The VNL bridge is unchanged here, so #6929's explicit empty float64 arrays should remain. Its empty TranslationTransform fixed-parameter test also remains applicable. I do not see a corresponding change needed in #6929 for this fix. |
[Medium impact] The PR appears safe to merge.
|
e890f82 to
246eb72
Compare
An empty VectorContainer can expose a null data pointer, which PyMemoryView_FromBuffer rejects, so array_view_from_vector_container and array_from_vector_container raised ValueError instead of returning an empty array. Return an empty array of the container's shape and dtype before creating the memory view. Closes InsightSoftwareConsortium#3150.
246eb72 to
7736c3b
Compare
Return a correctly shaped and typed NumPy array for empty VectorContainer conversions. Cover scalar and point containers through both view and copy helpers. Closes #3150.
Validation
Native arm64 macOS build with AppleClang 21, Python 3.13.9, and SWIG 4.4.1 passed on the published commit. The registered
itkPyVectorContainerTestpassed both methods, covering six empty-container subcases and the existing nonempty view/copy checks. Imports were confirmed to use the newly built native extensions.The original wheel harness also passed; its six pre-fix empty-buffer errors remain the negative control. Windows/MSVC 19.44 native wrapper build and the registered NumPy CTest also pass. The upstream Linux and macOS Azure Python jobs also pass at
e890f827.