SIVIC API  0.9.26
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
svkSatBandsXML.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2009-2014 The Regents of the University of California.
3  * All Rights Reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * • Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  * • Redistributions in binary form must reproduce the above copyright notice,
10  * this list of conditions and the following disclaimer in the documentation
11  * and/or other materials provided with the distribution.
12  * • None of the names of any campus of the University of California, the name
13  * "The Regents of the University of California," or the names of any of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
21  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
26  * OF SUCH DAMAGE.
27  */
28 
29 
30 
31 /*
32  * $URL$
33  * $Rev$
34  * $Author$
35  * $Date$
36  *
37  * Authors:
38  * Jason C. Crane, Ph.D.
39  * Beck Olson
40  */
41 
42 
43 #ifndef SVK_SAT_BANDS_XML_H
44 #define SVK_SAT_BANDS_XML_H
45 
46 
47 #ifdef __cplusplus
48 
49 #include <vtkObject.h>
50 #include <vtkXMLDataElement.h>
51 
52 #include "svkTypes.h"
53 
54 
55 namespace svk {
56 
57 
58 using namespace std;
59 
60 
78 class svkSatBandsXML: public vtkObject
79 {
80 
81  public:
82 
83  static svkSatBandsXML* New();
84  vtkTypeMacro( svkSatBandsXML, vtkObject);
85 
86  int SetXMLFileName( vtkstd::string xmlFileName );
87  int ParseXML( vtkXMLDataElement* satBandsElement );
88  vtkstd::string GetXMLFileName( );
89  void ClearXMLFile( );
90  void SetVerbose( bool isVerbose );
91  int GetNumberOfPressBoxSats();
92  int GetNumberOfAutoSats();
93  int GetXMLVersion();
94  void GetPressBoxSat(
95  int satNumber,
96  string* label,
97  float* normalX,
98  float* normalY,
99  float* normalZ,
100  float* thickness,
101  float* distance
102  );
103  int GetAutoSat(
104  int satNumber,
105  string* label,
106  float normal[3],
107  float* thickness,
108  float* distance
109  );
110  int GetAutoSat(
111  int satNumber,
112  string* label,
113  float* normalX,
114  float* normalY,
115  float* normalZ,
116  float* thickness,
117  float* distance
118  );
119  void GetPRESSBoxParameters(
120  float pressOrigin[3],
121  float pressThickness[3],
122  float pressAngles[3]
123  );
124 
125 
126  int GetAutoSatParameters(
127  int satNumber,
128  float normal[3],
129  float* thickness,
130  float* distance
131  );
132 
133  int ConvertDatToXML( string rootName );
134  int ConvertDatToXML2( string rootName );
135 
136  vtkXMLDataElement* GetXMLDataElement();
137 
138  void WriteXMLFile( string xmlFileName);
139 
140 
141 
142  protected:
143 
144  svkSatBandsXML();
145  ~svkSatBandsXML();
146 
147 
148  private:
149 
150  float GetFloatElementData( vtkXMLDataElement* element );
151  void InitSatBandInfo(
152  vtkXMLDataElement* satBandElement,
153  string* label,
154  float* normalX,
155  float* normalY,
156  float* normalZ,
157  float* thickness,
158  float* distance
159  );
160  bool IsNormalUnique( float normal[3], float normals[3][3] );
161  bool IsConventionalNormal( float normalIn[3] );
162  void InitPressBoxNormals( float normals[3][3] );
163  void MakePRESSOrthonormal( float normals[3][3] );
164  void InitPressDistances(float normals[3][3], float distances[3][2]);
165  void RotationMatrixToEulerAngles( float normals[3][3], float eulerAngles[3] );
166  void LPSToRAS( float normals[3][3] );
167  void TransposeNormals( float normals[3][3] );
168  void PSDAutSatAnglesToNormal( float angle1, float angle2, float normal[3] );
169  int InitPressBoxFromDat( string rootName );
170  int InitPressBoxFromDat2( string rootName );
171  int InitSatsFromDat( string rootName );
172  void SortNormalArrayRLAPSI( float normals[3][3] );
173  // out of 6 plane representation
174  void GetPRESSBoxParametersVer10(
175  float pressOrigin[3],
176  float pressThickness[3],
177  float pressAngles[3]
178  );
179  // out of 3 plane representation
180  void GetPRESSBoxParametersVer20(
181  float pressOrigin[3],
182  float pressThickness[3],
183  float pressAngles[3]
184  );
185 
186  // Members:
187  float versionNumber;
188  bool isVerbose;
189  vtkstd::string xmlFileName;
190  vtkXMLDataElement* satBandsXML;
191  vtkXMLDataElement* versionElement;
192  vtkXMLDataElement* pressBoxElement;
193  vtkXMLDataElement* autoSatsElement;
194 
195 
196 };
197 
198 
199 } //svk
200 #endif
201 
202 #endif //SVK_SAT_BANDS_XML_H
203 
204 #ifdef __cplusplus
205 extern "C" {
206 #endif
207 
208 
209 void* svkSatBandsXML_New(const char* xmlFileName, int* status);
210 void* svkSatBandsXML_Delete( void* xml );
212 int svkSatBandsXML_GetNumberOfAutoSats( void* xml );
214  void* xml,
215  int satNumber,
216  float* normalX,
217  float* normalY,
218  float* normalZ,
219  float* thickness,
220  float* distance
221  );
223  void* xml,
224  float* pressOrigin,
225  float* pressThickness,
226  float* pressAngles
227  );
228 
230  void* xml,
231  int satNumber,
232  float* normalX,
233  float* normalY,
234  float* normalZ,
235  float* thickness,
236  float* distance
237  );
238 
240  void* xml,
241  int satNumber,
242  float* normal,
243  float* thickness,
244  float* distance
245  );
246 
247 #ifdef __cplusplus
248 }
249 #endif
void svkSatBandsXML_GetPRESSBoxParameters(void *xml, float *pressOrigin, float *pressThickness, float *pressAngles)
Definition: svkSatBandsXML.cc:1822
int svkSatBandsXML_GetAutoSatParameters(void *xml, int satNumber, float *normal, float *thickness, float *distance)
Definition: svkSatBandsXML.cc:1832
Definition: svkSatBandsXML.h:78
int svkSatBandsXML_GetNumberOfPressBoxSats(void *xml)
Definition: svkSatBandsXML.cc:1763
void * svkSatBandsXML_New(const char *xmlFileName, int *status)
Definition: svkSatBandsXML.cc:1741
void svkSatBandsXML_GetPressBoxSat(void *xml, int satNumber, float *normalX, float *normalY, float *normalZ, float *thickness, float *distance)
Definition: svkSatBandsXML.cc:1782
int svkSatBandsXML_GetNumberOfAutoSats(void *xml)
Definition: svkSatBandsXML.cc:1772
int svkSatBandsXML_GetAutoSat(void *xml, int satNumber, float *normalX, float *normalY, float *normalZ, float *thickness, float *distance)
Definition: svkSatBandsXML.cc:1801
void * svkSatBandsXML_Delete(void *xml)
Definition: svkSatBandsXML.cc:1753