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
52 #define __vtkMatlabMexAdapter
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 
58 class vtkInformation;
60 class vtkDataArray;
61 class vtkArray;
62 class vtkGraph;
64 class vtkArrayData;
66 
68 {
69 
70 public:
71 
73 
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
76  static vtkMatlabMexAdapter *New();
77 
78 //BTX
80  mxArray* vtkDataArrayToMxArray(vtkDataArray* aa, bool ShallowCopy = false);
81 
84  vtkDataArray* mxArrayTovtkDataArray(const mxArray* mxa, bool ShallowCopy = false);
85 
87  mxArray* vtkArrayToMxArray(vtkArray* va);
88 
90  vtkArray* mxArrayTovtkArray(mxArray* mxa);
91 
95  mxArray* vtkGraphToMxArray(vtkGraph* ga);
96 
100  vtkGraph* mxArrayTovtkGraph(mxArray* mxa);
101 
103  static mxClassID GetMatlabDataType(vtkDataArray* da);
104 
106  static vtkDataArray* GetVTKDataType(mxClassID cid);
107 
108 //ETX
109 
110 protected:
111 
114 
115 private:
116 
117  vtkMatlabMexAdapter(const vtkMatlabMexAdapter&); // Not implemented
118  void operator=(const vtkMatlabMexAdapter&); // Not implemented
119 
120  template<typename T> vtkArray* CopymxArrayToVTKArray(mxArray* mxa, int ValueType);
121 
122  vtkDataArrayCollection* vdac; // Collection of vtkDataArrays that have been converted from R.
123  vtkArrayData* vad; // Collection of vtkArrays that have been converted from R.
124  vtkDataObjectCollection* vdoc; // Collection of vtkTables that have been converted from R.
125 
126 };
127 
128 #endif
129