slicersalt / itkshape Goto Github PK
View Code? Open in Web Editor NEWITK-Based Shape Analysis Filters (e.g Procrustes Alignment for Meshes)
License: Apache License 2.0
ITK-Based Shape Analysis Filters (e.g Procrustes Alignment for Meshes)
License: Apache License 2.0
The wrapped itk.Mesh3DProcrustesAlignFilter
cannot be instantiated in a Python workspace.
After successfully building the Python wrapping a CTest script is employed to test instantiation of the itk.Mesh3DProcrustesAlignFilter
class. Mesh3DProcrustesFilter
is available as an ITK module per the following output:
Python 3.8.8 (default, Feb 24 2021, 15:54:32) [MSC v.1928 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import itk
>>> itk.Mesh3DProcrustesAlignFilter
<module 'Mesh3DProcrustesAlignFilter'>
>>> dir(itk.Mesh3DProcrustesAlignFilter)
['Mesh3DProcrustesAlignFilter', '_LazyITKModule__belong_lazy_attributes', 'doc', 'loader', 'name', 'package', 'spec', 'itk_base_global_lazy_attributes', 'loaded_lazy_modules', 'mesh3_d_procrustes_align_filter']
However, attempts to get types or instantiate a filter object fail:
>>> itk.Mesh3DProcrustesAlignFilter.GetTypes()
Traceback (most recent call last):
File "", line 1, in
File "C:\repos\ITK-build\Wrapping\Generators\Python\itk\support\itkLazy.py", line 71, in getattribute
value = types.ModuleType.getattribute(self, attr)
AttributeError: module 'Mesh3DProcrustesAlignFilter' has no attribute 'GetTypes'
>>> itk.Mesh3DProcrustesAlignFilter.New()
Traceback (most recent call last):
File "", line 1, in
File "C:\repos\ITK-build\Wrapping\Generators\Python\itk\support\itkLazy.py", line 71, in getattribute
value = types.ModuleType.getattribute(self, attr)
AttributeError: module 'Mesh3DProcrustesAlignFilter' has no attribute 'New'
Mesh3DProcrustesAlignFilter
can be instantiated according to wrapped types
Mesh3DProcrustesAlignFilter
is available as a Python module but cannot be referenced as a wrapped filter object
Python wrapping is not built with the project and is not available as a CMake parameter.
I am seeking to wrap Mesh3DProcrustesAlignFilter
class for Python. The external module contains a CMakeLists.txt
and .wrap
file in the wrapping
folder, but no Wrapping
folder with Python binaries is built in the ITK-build
directory. When setting configuration variables in CMake-GUI there is no WRAP_PYTHON
parameter available, and attempting to explicitly set this variable with the CMake CLI has no noticeable impact on the build.
Mesh3DProcrustesAlignFilter_WRAP_PYTHON
(or a similar parameter) is available for configuration with CMakeITK-Build/Wrapping
No wrapping is built
Steps:
Mesh3DProcrustesAlignFilter
to ITKShape
everywhere in the ITKShape repo (this was changed shortly after the project was created)See related PR: InsightSoftwareConsortium/ITK#2642
We have to replace this block:
maybe others?
itk-shape
has an entry at https://pypi.org/project/itk-shape/ but attempting to install with pip install itk-shape
fails:
>pip install itk-shape==0.1.0
ERROR: Could not find a version that satisfies the requirement itk-shape==0.1.0 (from versions: none)
ERROR: No matching distribution found for itk-shape==0.1.0
@thewtex Could you clarify what other steps we need to take to publish a new package to Pypi? Are we missing credentials for this repo?
Note that this isn't a blocking issue, we can build the cxx project against a local ITK build, but it would be useful to have a Python package we can freely install as a testing dependency as we move forward on the HASI Python pipeline.
Look into adding updated files from the ITK module template.
See notes in PR 23.
MeshProcrustesAlignFilter builds and is wrapped successfully for template arguments of type itk::Mesh<double, 3>. However, attempting to set input meshes in Python following setting number of inputs returns an error:
>>> filter.SetInput(0,m1)
...
TypeError: in method 'itkMeshProcrustesAlignFilterM3M3_SetInput', argument 3 of type 'itkMeshD3_Pointer'
At face value it seems that there is a type mismatch between the expected argument of type itkMeshD3_Pointer
and the given value of type itkMeshD3
. However, per Discourse discussion Python is not expected to handle pointers directly.
m1 = itk.meshread('C:/users/tom.birdsong/source/repos/hasi/test/input/901-L-mesh.vtk', itk.D)
type(m1)
<class 'itk.itkMeshBasePython.itkMeshD3'>
filter = itk.MeshProcrustesAlignFilter[itk.Mesh[itk.D,3], itk.Mesh[itk.D,3]].New()
type(filter)
<class 'itk.itkMeshProcrustesAlignFilterPython.itkMeshProcrustesAlignFilterM3M3'>
filter.SetNumberOfInputs(2)
filter.SetInput(0,m1)
Setting inputs up to the allocated number in Step 3 succeeds without error.
Traceback (most recent call last):
File "", line 1, in
TypeError: in method 'itkMeshProcrustesAlignFilterM3M3_SetInput', argument 3 of type 'itkMeshD3_Pointer'
The current repo name ITKMesh3DProcrustesAlignFilter
may not be adequately descriptive as support for 2D meshes is added to the ITKMeshProcrustesAlignFilter
class. We cannot simply rename the repo to ITKMeshProcrustesAlignFilter
as this causes a naming overlap in building the module Python wrapping and renders the wrapped filter class inaccessible.
In now-resolved Issue 5 @thewtex wrote:
I am thinking we should rename the repository / module name to ITKSALT so we can bring in other shape analysis filters. @bpaniagua does that sound good to you?
Note that renaming the repository requires repo edit permissions.
Initial files in PR 1 fail to build with CMake.
PR 1 adds an ITK external module created with cookiecutter
from the ITK external module template, along with header, template, and wrapping files for Mesh3DProcrustesAlignFilter
. itk-module.cmake
is updated with ITK module dependencies. Attempting to build with CMake yields an error indicating that ITK modules are not linked successfully to allow the headers to be built.
External module builds without error.
include/itkMesh3DProcrustesAlignFilter.h:5:10: fatal error: itkAffineTransform.h: No such file or directory
Contents of CMakeError.log:
Performing Test ITK_UNDEFINED_SYMBOLS_ALLOWED failed with the following output:
(no output follows)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.