ITK  4.11.0
Insight Segmentation and Registration Toolkit
itkPyVnl.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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  * http://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 #include <Python.h>
28 
29 namespace itk
30 {
31 
42 template <typename TElement>
43 class PyVnl
44 {
45 public:
47  typedef PyVnl Self;
48 
50  typedef TElement DataType;
51  typedef vnl_vector<TElement> VectorType;
52  typedef vnl_matrix<TElement> MatrixType;
53 
57  static PyObject * _GetArrayFromVnlVector( VectorType * vector);
58 
62  static const VectorType _GetVnlVectorFromArray( PyObject *arr, PyObject *shape);
63 
67  static PyObject * _GetArrayFromVnlMatrix( MatrixType * matrix);
68 
72  static const MatrixType _GetVnlMatrixFromArray( PyObject *arr, PyObject *shape);
73 
74 
75 protected:
76 
77 private:
78  PyVnl(const Self&); // Purposely not implemented.
79  void operator=(const Self&); // Purposely not implemented.
80 };
81 
82 } // namespace itk
83 
84 #ifndef ITK_MANUAL_INSTANTIATION
85 #include "itkPyVnl.hxx"
86 #endif
87 
88 #endif // _itkPyVnl_h
PyVnl Self
Definition: itkPyVnl.h:47
void operator=(const Self &)
static PyObject * _GetArrayFromVnlMatrix(MatrixType *matrix)
static const MatrixType _GetVnlMatrixFromArray(PyObject *arr, PyObject *shape)
TElement DataType
Definition: itkPyVnl.h:50
static PyObject * _GetArrayFromVnlVector(VectorType *vector)
static const VectorType _GetVnlVectorFromArray(PyObject *arr, PyObject *shape)
vnl_matrix< TElement > MatrixType
Definition: itkPyVnl.h:52
PyVnl(const Self &)
vnl_vector< TElement > VectorType
Definition: itkPyVnl.h:51
Helper class for converting VNL data buffers into python arrays.
Definition: itkPyVnl.h:43