Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: modify wrapping to produce float mesh coordinate type #79

Closed
wants to merge 2 commits into from

Conversation

dzenanz
Copy link
Member

@dzenanz dzenanz commented Nov 27, 2024

When used with unsigned char input images, which is the common case, the produced mesh would use UC as coordinate type. This would not only cause a massive loss in precision and range, but is not wrapped with itk::Mesh class thus causing runtime error:

itk.meshwrite(mesh, file_path)
...
itk.support.extras.TemplateTypeError: itk.MeshFileWriter is not wrapped for input type itk.Mesh[itk.UC,3]. To limit the size of the package, only a limited number of types are available in ITK Python.
...
Supported input types:
itk.Mesh[itk.F,2]
itk.Mesh[itk.D,2]
itk.Mesh[itk.F,3]
itk.Mesh[itk.D,3]

When used with unsigned char input images, which is the common case,
the produced mesh would use UC as coordinate type.
This would not only cause a massive loss in precision and range,
but is not wrapped with itk::Mesh class thus causing runtime error:

   itk.meshwrite(mesh, file_path)
     ...
itk.support.extras.TemplateTypeError: itk.MeshFileWriter is not wrapped for input type `itk.Mesh[itk.UC,3]`.
To limit the size of the package, only a limited number of
types are available in ITK Python.
...
Supported input types:
itk.Mesh[itk.F,2]
itk.Mesh[itk.D,2]
itk.Mesh[itk.F,3]
itk.Mesh[itk.D,3]
@dzenanz dzenanz marked this pull request as ready for review November 27, 2024 19:07
Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

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

This would not only cause a massive loss in precision and range

The pixel values are sampled from the input image, correct? Which are unsigned char. The precision and range is the same as the input.

Wrapping mesh-io should be updated if needed.

@dzenanz
Copy link
Member Author

dzenanz commented Nov 29, 2024

This was already fixed by InsightSoftwareConsortium/ITK@68944d5.

@dzenanz dzenanz closed this Nov 29, 2024
@dzenanz dzenanz deleted the wrapFloat branch November 29, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants