ITK 6.0.0
Insight Toolkit
 
Loading...
Searching...
No Matches
itkPyVnl.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18
19#ifndef itkPyVnl_h
20#define itkPyVnl_h
21
22#include <vnl/vnl_vector.h>
23#include <vnl/vnl_matrix.h>
24
25// The python header defines _POSIX_C_SOURCE without a preceding #undef
26#undef _POSIX_C_SOURCE
27#undef _XOPEN_SOURCE
28#include <Python.h>
29
30namespace itk
31{
32
45template <typename TElement>
46class PyVnl
47{
48public:
50 using Self = PyVnl;
51
53 using DataType = TElement;
54 using VectorType = vnl_vector<TElement>;
55 using MatrixType = vnl_matrix<TElement>;
56
60 static PyObject *
62
66 static VectorType
68
72 static PyObject *
74
78 static MatrixType
80};
81
82} // namespace itk
83
84#ifndef ITK_MANUAL_INSTANTIATION
85# include "itkPyVnl.hxx"
86#endif
87
88#endif // _itkPyVnl_h
Helper class get views of VNL data buffers in python arrays and back.
Definition itkPyVnl.h:47
vnl_matrix< TElement > MatrixType
Definition itkPyVnl.h:55
static PyObject * _GetArrayViewFromVnlVector(VectorType *vector)
vnl_vector< TElement > VectorType
Definition itkPyVnl.h:54
static PyObject * _GetArrayViewFromVnlMatrix(MatrixType *matrix)
static VectorType _GetVnlVectorFromArray(PyObject *arr, PyObject *shape)
PyVnl Self
Definition itkPyVnl.h:50
TElement DataType
Definition itkPyVnl.h:53
static MatrixType _GetVnlMatrixFromArray(PyObject *arr, PyObject *shape)
struct _object PyObject
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....