-
Notifications
You must be signed in to change notification settings - Fork 5
/
wImage.h
186 lines (149 loc) · 4.56 KB
/
wImage.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//##########################################################################
//# This software is part of the Treescaper i
//# -- Version 0.1
//# Copyright (C) 2010 Wen Huang
//#
//# This program is free software; you can redistribute it and/or
//# modify it under the terms of the GNU General Public License
//# as published by the Free Software Foundation; either version 2
//# of the License, or (at your option) any later version.
//#
//# This program is distributed in the hope that it will be useful,
//# but WITHOUT ANY WARRANTY; without even the implied warranty of
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//# GNU General Public License for more details.
//# http://www.gnu.org/copyleft/gpl.html
//##########################################################################
//wplot.h
// using vtk to plot points
// by whuang 15/May/2010
#ifndef WIMAGE_H
#define WIMAGE_H
#include "wfile.h"
#include "wstring.h"
#include "warray.cpp"
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkDelaunay3D.h>
#include <vtkUnstructuredGrid.h>
#include <vtkSmartPointer.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
#include <vtkCellArray.h>
#include <vtkDataSetSurfaceFilter.h>
#include <vtkSmartPointer.h>
#include <vtkCellArray.h>
#include <vtkActor.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkPoints.h>
#include <vtkPointSource.h>
#include <vtkPolyData.h>
#include <vtkProperty.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkPointsProjectedHull.h>
#include <vtkPolyLine.h>
#include "vtkGlyph3D.h"
#include "vtkSphereSource.h"
#include "vtkMassProperties.h"
#include "vtkPlaneSource.h"
#include <vtkTriangleFilter.h>
#include <vtkSurfaceReconstructionFilter.h>
#include <vtkContourFilter.h>
#include <vtkReverseSense.h>
//#include "vtkMPEG2Writer.h"
#include <vtkWindowToImageFilter.h>
#include <vtkAVIWriter.h>
//#include <vtkFFMPEGWriter.h>
#include <vtkCamera.h>
#include <vtkWindow.h>
#include "vtkImageCast.h"
#include "vtkImageData.h"
#include "vtkImageMandelbrotSource.h"
#include "vtkImageMapToColors.h"
#include "vtkLookupTable.h"
#include "vtkCubeAxesActor2D.h"
#include "vtkLineSource.h"
#include <vtkLegendBoxActor.h>
struct image_parameters{
int cluster_num; // 15
int *cluster_index; //
int index_size; //
double outlier_e; // 0.01
double outlierpercent; // 0.5
double sep_factor; // 0
double point_size; // 5
int moviesizex; // 700
int moviesizey; // 700
double zoom; // 1.35
int color_type; // 0
int frame_num; // 100
};
class Image{
public:
Image(){};
~Image(){destructor();};
Image(String filename)
{
Initialize_Image(filename);
};
void Initialize_Image(String filename);
void Set_SelectedIDs(Array<int> &selected_ids){SelectedIDs = &selected_ids;}
void Generate_Colors(int num, double **Colors);
bool Load_COR(String filename);
bool Load_Points();
bool Load_points_with_selection();
void sort_volume();
void Create_Legend();
void Create_PointsActors();
void Create_HullsActors();
void Create_LinesActors();
void sort_HullsActors();
bool select_Points(String filename);
void compute_mean(double *mean, int *index, int i);
void compute_var(double *mean, int *index, int i, double &var, int &max_n);
void Plot_Points();
void Plot_Hulls();
void Plot_Lines();
void make_movie();
void destructor();
image_parameters parameters;
private:
void int_to_string(int n, char *str, int length);
String fname;
double **Colors;
double *COR;
bool *selectpts;
double *centers;
Array<int> *SelectedIDs;
int *IDMaps;
int dim;
int size;
vtkSmartPointer<vtkPoints> *points;
vtkSmartPointer<vtkPoints> *Hull_points;
vtkSmartPointer<vtkActor> *PointsActors;
vtkSphereSource **sphere;
vtkPolyData **model;
// vtkGlyph3D **glyph;
vtkPolyDataMapper **pointMapper;
vtkProperty **VP;
vtkSmartPointer<vtkLegendBoxActor> legend;
vtkSmartPointer<vtkRenderer> renderer;
vtkSmartPointer<vtkRenderWindow> renderWindow;
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor;
vtkSmartPointer<vtkActor> *HullsActors;
vtkPolyDataMapper **HullMapper;
vtkSmartPointer<vtkPolyData> *polydata;
vtkSmartPointer<vtkDelaunay3D> *delaunay;
vtkSmartPointer<vtkDataSetSurfaceFilter> *surfaceFilter;
vtkTriangleFilter **triangleFilter;
vtkMassProperties **massproperties;
int *ranks;
double *volumes;
vtkLineSource **lines;
vtkPolyDataMapper **linemappers;
vtkActor **lineActors;
};
#endif