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 
51 #ifndef vtkMatlabMexAdapter_h
52 #define vtkMatlabMexAdapter_h
53 
54 #include "mex.h" // Needed for Matlab mex.h mxArray
55 #include "matrix.h" // Needed for Matlab matrix.h mxArray
56 #include "vtkObject.h"
57 #include "vtkFiltersMatlabModule.h"
58 
59 class vtkInformation;
61 class vtkDataArray;
62 class vtkArray;
63 class vtkGraph;
65 class vtkArrayData;
67 
68 class VTKFILTERSMATLAB_EXPORT vtkMatlabMexAdapter : public vtkObject
69 {
70 
71 public:
72 
74 
75  void PrintSelf(ostream& os, vtkIndent indent);
76 
78 
79 //BTX
81  mxArray* vtkDataArrayToMxArray(vtkDataArray* aa, bool ShallowCopy = false);
82 
85  vtkDataArray* mxArrayTovtkDataArray(const mxArray* mxa, bool ShallowCopy = false);
86 
88  mxArray* vtkArrayToMxArray(vtkArray* va);
89 
91  vtkArray* mxArrayTovtkArray(mxArray* mxa);
92 
96  mxArray* vtkGraphToMxArray(vtkGraph* ga);
97 
101  vtkGraph* mxArrayTovtkGraph(mxArray* mxa);
102 
104  static mxClassID GetMatlabDataType(vtkDataArray* da);
105 
107  static vtkDataArray* GetVTKDataType(mxClassID cid);
108 
109 //ETX
110 
111 protected:
112 
115 
116 private:
117 
118  vtkMatlabMexAdapter(const vtkMatlabMexAdapter&); // Not implemented
119  void operator=(const vtkMatlabMexAdapter&); // Not implemented
120 
121  template<typename T> vtkArray* CopymxArrayToVTKArray(mxArray* mxa, int ValueType);
122 
123  vtkDataArrayCollection* vdac; // Collection of vtkDataArrays that have been converted from R.
124  vtkArrayData* vad; // Collection of vtkArrays that have been converted from R.
125  vtkDataObjectCollection* vdoc; // Collection of vtkTables that have been converted from R.
126 
127 };
128 
129 #endif
vtkMatlabMexAdapter::mxArrayTovtkDataArray
vtkDataArray * mxArrayTovtkDataArray(const mxArray *mxa, bool ShallowCopy=false)
vtkMatlabMexAdapter::~vtkMatlabMexAdapter
~vtkMatlabMexAdapter()
vtkDataObjectCollection
maintain an unordered list of data objects
Definition: vtkDataObjectCollection.h:34
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:41
vtkMatlabMexAdapter
This is a utility class to convert VTK array data to and from the Matlab mxArray format....
Definition: vtkMatlabMexAdapter.h:69
vtkDataArrayCollection
maintain an unordered list of dataarray objects
Definition: vtkDataArrayCollection.h:31
vtkMatlabMexAdapter::GetMatlabDataType
static mxClassID GetMatlabDataType(vtkDataArray *da)
vtkTypeMacro
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:642
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:62
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:55
vtkArrayData
Pipeline data object that contains multiple vtkArray objects.
Definition: vtkArrayData.h:52
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatlabMexAdapter::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkArray
Abstract interface for N-dimensional arrays.
Definition: vtkArray.h:70
vtkObject.h
vtkMatlabMexAdapter::New
static vtkMatlabMexAdapter * New()
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:86
vtkMatlabMexAdapter::vtkMatlabMexAdapter
vtkMatlabMexAdapter()
vtkMatlabMexAdapter::vtkDataArrayToMxArray
mxArray * vtkDataArrayToMxArray(vtkDataArray *aa, bool ShallowCopy=false)
vtkMatlabMexAdapter::vtkGraphToMxArray
mxArray * vtkGraphToMxArray(vtkGraph *ga)
vtkMatlabMexAdapter::mxArrayTovtkArray
vtkArray * mxArrayTovtkArray(mxArray *mxa)
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:289
vtkMatlabMexAdapter::mxArrayTovtkGraph
vtkGraph * mxArrayTovtkGraph(mxArray *mxa)
vtkMatlabMexAdapter::vtkArrayToMxArray
mxArray * vtkArrayToMxArray(vtkArray *va)
vtkMatlabMexAdapter::GetVTKDataType
static vtkDataArray * GetVTKDataType(mxClassID cid)