VTK
vtkMatlabMexAdapter.h
Go to the documentation of this file.
1 
2 /*=========================================================================
3 
4  Program: Visualization Toolkit
5  Module: vtkMatlabMexAdapter.h
6 
7  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8  All rights reserved.
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 
15 =========================================================================*/
16 /*-------------------------------------------------------------------------
17  Copyright 2009 Sandia Corporation.
18  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
19  the U.S. Government retains certain rights in this software.
20 -------------------------------------------------------------------------*/
21 
52 #ifndef vtkMatlabMexAdapter_h
53 #define vtkMatlabMexAdapter_h
54 
55 #include "mex.h" // Needed for Matlab mex.h mxArray
56 #include "matrix.h" // Needed for Matlab matrix.h mxArray
57 #include "vtkObject.h"
58 #include "vtkFiltersMatlabModule.h" // For export macro
59 
60 class vtkInformation;
62 class vtkDataArray;
63 class vtkArray;
64 class vtkGraph;
66 class vtkArrayData;
68 
69 class VTKFILTERSMATLAB_EXPORT vtkMatlabMexAdapter : public vtkObject
70 {
71 
72 public:
73 
75 
76  void PrintSelf(ostream& os, vtkIndent indent);
77 
79 
83  mxArray* vtkDataArrayToMxArray(vtkDataArray* aa, bool ShallowCopy = false);
84 
88  vtkDataArray* mxArrayTovtkDataArray(const mxArray* mxa, bool ShallowCopy = false);
89 
93  mxArray* vtkArrayToMxArray(vtkArray* va);
94 
98  vtkArray* mxArrayTovtkArray(mxArray* mxa);
99 
106 
112  vtkGraph* mxArrayTovtkGraph(mxArray* mxa);
113 
117  static mxClassID GetMatlabDataType(vtkDataArray* da);
118 
122  static vtkDataArray* GetVTKDataType(mxClassID cid);
123 
124 protected:
125 
128 
129 private:
130 
131  vtkMatlabMexAdapter(const vtkMatlabMexAdapter&) VTK_DELETE_FUNCTION;
132  void operator=(const vtkMatlabMexAdapter&) VTK_DELETE_FUNCTION;
133 
134  template<typename T> vtkArray* CopymxArrayToVTKArray(mxArray* mxa, int ValueType);
135 
136  vtkDataArrayCollection* vdac; // Collection of vtkDataArrays that have been converted from R.
137  vtkArrayData* vad; // Collection of vtkArrays that have been converted from R.
138  vtkDataObjectCollection* vdoc; // Collection of vtkTables that have been converted from R.
139 
140 };
141 
142 #endif
Pipeline data object that contains multiple vtkArray objects.
Definition: vtkArrayData.h:53
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:71
maintain an unordered list of dataarray objects
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
maintain an unordered list of data objects
Base class for graph data types.
Definition: vtkGraph.h:288
a simple class to control print indentation
Definition: vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
This is a utility class to convert VTK array data to and from the Matlab mxArray format.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
mxArray * vtkGraphToMxArray(vtkGraph *ga)
Create a mxArray copy of a vtkGraph (Allocates memory by default) The result is an n by n connectivit...
mxArray * vtkArrayToMxArray(vtkArray *va)
Create a mxArray copy of a vtkArray (Allocates memory by default)
mxArray * vtkDataArrayToMxArray(vtkDataArray *aa, bool ShallowCopy=false)
Create a mxArray copy of a vtkDataArray (Allocates memory by default)
vtkGraph * mxArrayTovtkGraph(mxArray *mxa)
Create a vtkGraph copy of a mxArray (Allocates memory by default) Input mxArray should be a n by n co...
static mxClassID GetMatlabDataType(vtkDataArray *da)
Match Matlab and VTK data types for conversion.
static vtkMatlabMexAdapter * New()
vtkDataArray * mxArrayTovtkDataArray(const mxArray *mxa, bool ShallowCopy=false)
Create a vtkDataArray copy of a Matlab mxArray (Allocates memory by default)
vtkArray * mxArrayTovtkArray(mxArray *mxa)
Create a vtkArray copy of a mxArray (Allocates memory by default)
static vtkDataArray * GetVTKDataType(mxClassID cid)
Match Matlab and VTK data types for conversion.
abstract base class for most VTK objects
Definition: vtkObject.h:60