Skip to content

STYLE: Replace UI with IT as index type for LevelSetNode VectorContainer - #6803

Open
N-Dekker wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
N-Dekker:Replace-UI-with-IT-index-type-LevelSetNode-VectorContainer
Open

STYLE: Replace UI with IT as index type for LevelSetNode VectorContainer#6803
N-Dekker wants to merge 1 commit into
InsightSoftwareConsortium:mainfrom
N-Dekker:Replace-UI-with-IT-index-type-LevelSetNode-VectorContainer

Conversation

@N-Dekker

Copy link
Copy Markdown
Contributor

itk.IT ("IdentifierType") is the most commonly supported index type for VectorContainer. (VectorContainer is wrapped for IT and UC, but not for UI, as index type.)

@github-actions github-actions Bot added area:Python wrapping Python bindings for a class type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) labels Aug 25, 2026
@N-Dekker N-Dekker changed the title STYLE: Replace UI with IT as index type for LevelSetNode VectorContainer WIP: Replace UI with IT as index type for LevelSetNode VectorContainer Aug 25, 2026
@N-Dekker

Copy link
Copy Markdown
Contributor Author

Still under construction. I see now: in C++, NodeContainerType also has unsigned int as index type. Probably related.

using NodeContainerType = VectorContainer<unsigned int, NodeType>;

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on a glance.

@N-Dekker
N-Dekker force-pushed the Replace-UI-with-IT-index-type-LevelSetNode-VectorContainer branch from 5bb4e81 to 67912ce Compare August 26, 2026 13:47
@github-actions github-actions Bot removed the type:Style Style changes: no logic impact (indentation, comments, naming) label Aug 26, 2026
@N-Dekker

Copy link
Copy Markdown
Contributor Author

This force-pushed amend aims to address CI failures at https://open.cdash.org/tests/2723817696 saying:

  File "/Users/runner/work/1/s-build/Wrapping/Generators/Python/itk/support/template_class.py", line 527, in __getitem__
    this_item = self.__template__[key]
                ~~~~~~~~~~~~~~~~~^^^^^
KeyError: (<itkCType unsigned long>, <class 'itk.itkLevelSetNodePython.itkLevelSetNodeF2'>)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/runner/work/1/s/Modules/Filtering/FastMarching/wrapping/test/FastMarchingImageFilterTest.py", line 131, in <module>
    NodeContainer = itk.VectorContainer[itk.IT, NodeType]
                    ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/Users/runner/work/1/s-build/Wrapping/Generators/Python/itk/support/template_class.py", line 531, in __getitem__
    raise itk.TemplateTypeError(self, key)
itk.support.extras.TemplateTypeError: itk.VectorContainer is not wrapped for input type `itk.UL, itk.LevelSetNode[itk.F,2]`.


/** Type of container used to store the level set nodes. */
using NodeContainerType = VectorContainer<unsigned int, NodeType>;
using NodeContainerType = VectorContainer<NodeType>;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a potentially breaking change, although in practice, VectorContainer<unsigned int, NodeType> and VectorContainer<NodeType> behave exactly the same.

@N-Dekker
N-Dekker force-pushed the Replace-UI-with-IT-index-type-LevelSetNode-VectorContainer branch 2 times, most recently from 089ed05 to 4c1b3c9 Compare August 28, 2026 10:01
`itk.IT` ("IdentifierType") is the most commonly supported index type for
VectorContainer.

Adjusted Node Container types in C++ to use the default index type of
`itk::VectorContainer` (which is equal to `IdentifierType`), instead of
`unsigned int`.

Adjusted ITKFastMarchingBase.wrap accordingly.

Follow-up to pull request InsightSoftwareConsortium#6800
commit 0939d4c
"STYLE: Replace UL with IT as index type in itkPyVectorContainerTest.py"
@N-Dekker
N-Dekker force-pushed the Replace-UI-with-IT-index-type-LevelSetNode-VectorContainer branch from 4c1b3c9 to 57480cd Compare August 28, 2026 13:22
@N-Dekker N-Dekker changed the title WIP: Replace UI with IT as index type for LevelSetNode VectorContainer STYLE: Replace UI with IT as index type for LevelSetNode VectorContainer Aug 28, 2026
@N-Dekker
N-Dekker marked this pull request as ready for review August 28, 2026 16:20
@greptile-apps

greptile-apps Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This change aligns LevelSetNode VectorContainer indices across the FastMarching and ShapePrior native APIs, Python wrapper declarations, and affected Python tests. The C++ aliases now use ITK’s default IdentifierType index, while the wrapper and tests use the corresponding itk.IT specialization.

No defect was identified in the reviewed changes. The focused declarations and Python wrapper registration consistently use the same container index type.

T-Rex validation blocked

Runtime verification of Python container acceptance could not run because the wrapped itk Python package is missing, and the repository’s documented build route requires the missing pixi package manager. The native syntax fallback also cannot run because the generated itkConfigure.h header is unavailable without a configured build tree.

Confidence Score: 5/5

The changed native aliases, wrapper specialization, and Python test call sites consistently use IdentifierType and itk.IT for LevelSetNode containers.

No review findings were emitted. Source inspection found the FastMarching and ShapePrior API container types aligned with the registered Python wrapper specialization and updated test usage.

Files Needing Attention: A configured ITK Python-wrapping build should run the focused FastMarching and ShapePrior Python tests for final runtime coverage; the relevant files are Modules/Filtering/FastMarching/wrapping/ITKFastMarchingBase.wrap and the affected Python test files.

T-Rex T-Rex Logs

What T-Rex did

  • Attempted the Python IT LevelSetNode integration probe and encountered a ModuleNotFoundError for itk, preventing container construction.
  • Tried the wrapped-build configuration via Pixi, but Pixi was not found and the command exited with code 127.
  • Ran a focused C++ syntax check for the LevelSet alias; it failed because itkConfigure.h was not generated due to a missing configured ITK build tree.
  • Validated Python probe syntax and bytecode, but the missing wrapper runtime and build tooling prevented observing container acceptance behavior.
  • Cross-proof validation confirms the same failure modes across proofs: missing itk module, missing Pixi wrapper/build tools, and missing ITK configuration, with no container acceptance observations at this checkout.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "STYLE: Replace UI with IT as index type ..." | Re-trigger Greptile

@thewtex thewtex left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but not terribly excited about this change -- I think unsigned int was probably intended, and there is a breaking type change.

@N-Dekker

N-Dekker commented Aug 29, 2026

Copy link
Copy Markdown
Contributor Author

OK, but not terribly excited about this change -- I think unsigned int was probably intended, and there is a breaking type change.

Thanks for your comment, @thewtex Looking at the code, I don't see why it was using unsigned int as index type, rather than itk.IT. The underlying std::vector<NodeType> is the same for both VectorContainer specializations, so technically I don't think it matters.

For end-users I think it would be clearer if we just stick with one index type, for VectorContainer. Eventually I think it would also allow us to remove some VectorContainer wrappings, for index types UC and US, but that's beyond the scope of this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module area:Python wrapping Python bindings for a class area:Segmentation Issues affecting the Segmentation module type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants