forked from pixmeo/osirix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSRView.h
executable file
·432 lines (372 loc) · 12.7 KB
/
SRView.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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
/*=========================================================================
Program: OsiriX
Copyright (c) OsiriX Team
All rights reserved.
Distributed under GNU - LGPL
See http://www.osirix-viewer.com/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
=========================================================================*/
#import <AppKit/AppKit.h>
#import "DCMPix.h"
#import "Camera.h"
#ifdef __cplusplus
#include "VTKView.h"
#define id Id
#include "vtkCommand.h"
#include "vtkProperty.h"
#include "vtkActor.h"
#include "vtkPolyData.h"
#include "vtkRenderer.h"
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkVolume16Reader.h"
#include "vtkPolyDataMapper.h"
#include "vtkActor.h"
#include "vtkOutlineFilter.h"
#include "vtkImageReader.h"
#include "vtkImageImport.h"
#include "vtkCamera.h"
#include "vtkStripper.h"
#include "vtkLookupTable.h"
#include "vtkImageDataGeometryFilter.h"
#include "vtkProperty.h"
#include "vtkPolyDataNormals.h"
#include "vtkContourFilter.h"
#include "vtkImageData.h"
#include "vtkImageMapToColors.h"
#include "vtkImageActor.h"
#include "vtkLight.h"
#include "vtkPlane.h"
#include "vtkPlanes.h"
#include "vtkPlaneSource.h"
#include "vtkBoxWidget.h"
#include "vtkPlaneWidget.h"
#include "vtkPiecewiseFunction.h"
#include "vtkPiecewiseFunction.h"
#include "vtkColorTransferFunction.h"
#include "vtkVolumeProperty.h"
#include "vtkVolumeRayCastCompositeFunction.h"
#include "vtkVolumeRayCastMapper.h"
#include "vtkVolumeRayCastMIPFunction.h"
#include "vtkTransform.h"
#include "vtkSphere.h"
#include "vtkImplicitBoolean.h"
#include "vtkExtractGeometry.h"
#include "vtkDataSetMapper.h"
#include "vtkPicker.h"
#include "vtkCellPicker.h"
#include "vtkPointPicker.h"
#include "vtkLineSource.h"
#include "vtkPolyDataMapper2D.h"
#include "vtkActor2D.h"
#include "vtkExtractPolyDataGeometry.h"
#include "vtkProbeFilter.h"
#include "vtkCutter.h"
#include "vtkTransformPolyDataFilter.h"
#include "vtkXYPlotActor.h"
#include "vtkClipPolyData.h"
#include "vtkBox.h"
#include "vtkCallbackCommand.h"
#include "vtkImageResample.h"
#include "vtkDecimatePro.h"
#include "vtkSmoothPolyDataFilter.h"
#include "vtkImageFlip.h"
#include "vtkTextActor.h"
#include "vtkAnnotatedCubeActor.h"
#include "vtkOrientationMarkerWidget.h"
#include "vtkTextProperty.h"
#ifdef _STEREO_VISION_
// Added SilvanWidmer 10-08-09
// ****************************
#import "vtkCocoaGLView.h"
#include "vtkCocoaRenderWindowInteractor.h"
#include "vtkCocoaRenderWindow.h"
#include "vtkParallelRenderManager.h"
#include "vtkRendererCollection.h"
#include "vtkCallbackCommand.h"
#import "VTKStereoSRView.h"
// ****************************
#endif
#undef id
class vtkMyCallback;
#else
typedef char* vtkTransform;
typedef char* vtkImageActor;
typedef char* vtkImageMapToColors;
typedef char* vtkLookupTable;
typedef char* vtkImageReslice;
typedef char* vtkImageImport;
typedef char* vtkCamera;
typedef char* vtkActor;
typedef char* vtkPolyDataMapper;
typedef char* vtkOutlineFilter;
typedef char* vtkLineWidget;
typedef char* vtkTextActor;
typedef char* vtkVolumeRayCastMapper;
typedef char* vtkVolumeRayCastMIPFunction;
typedef char* vtkVolume;
typedef char* vtkPiecewiseFunction;
typedef char* vtkVolumeTextureMapper2D;
typedef char* vtkPolyData;
typedef char* vtkVolumeProperty;
typedef char* vtkPolyDataMapper2D;
typedef char* vtkColorTransferFunction;
typedef char* vtkActor2D;
typedef char* vtkMyCallback;
typedef char* vtkPlaneWidget;
typedef char* vtkBoxWidget;
typedef char* vtkImageFlip;
typedef char* vtkImageResample;
typedef char* vtkMatrix4x4;
typedef char* vtkDecimatePro;
typedef char* vtkSmoothPolyDataFilter;
typedef char* vtkContourFilter;
typedef char* vtkPolyDataNormals;
typedef char* vtkRenderer;
typedef char* vtkOrientationMarkerWidget;
#ifdef _STEREO_VISION_
// ****************************
// Added SilvanWidmer 10-08-09
typedef char* vtkCocoaRenderWindowInteractor;
typedef char* vtkCocoaRenderWindow;
typedef char* vtkParallelRenderManager;
typedef char* vtkRenderWindow;
typedef char* vtkRendererCollection;
typedef char* vtkCocoaGLView;
typedef char* vtkCallbackCommand;
typedef char* VTKStereoSRView;
// ****************************
#endif
#endif
#include <Accelerate/Accelerate.h>
#import "ViewerController.h"
#import "WaitRendering.h"
@class Camera;
@class SRController;
@class DICOMExport;
#ifdef _STEREO_VISION_
typedef struct renderSurface
{
long actor;
float resolution;
float transparency;
float r;
float g;
float b;
float isocontour;
float decimateVal;
BOOL useDecimate;
BOOL useSmooth;
long smoothVal;
} renderSurface;
#endif
#ifdef __cplusplus
#else
#define VTKView NSView
#endif
/** \brief Surface Rendering View */
@interface SRView : VTKView
{
int projectionMode;
NSMutableArray *blendingPixList;
DCMPix *blendingLastObject, *blendingFirstObject;
float *blendingData, blendingFactor;
ViewerController *blendingController;
vtkImageImport *blendingReader;
vtkImageFlip *flip, *blendingFlip;
vtkTextActor *textX;
vtkTextActor *oText[ 4];
NSCursor *cursor;
BOOL cursorSet;
NSMutableArray *pixList;
DCMPix *firstObject;
float *data, *dataFRGB;
short currentTool;
float cosines[ 9];
float blendingcosines[ 9];
IBOutlet NSWindow *export3DWindow;
IBOutlet NSSlider *framesSlider;
IBOutlet NSMatrix *rotation;
IBOutlet NSWindow *export3DVRWindow;
IBOutlet NSMatrix *VRFrames;
IBOutlet NSColorWell *backgroundColor;
double camPosition[ 3];
double camFocal[ 3];
long numberOfFrames;
float rotationValue;
long rotationOrientation;
// vtkCallbackCommand *cbStart;
// DICOM export
IBOutlet NSWindow *exportDCMWindow;
IBOutlet NSSlider *dcmframesSlider;
IBOutlet NSMatrix *dcmExportMode, *dcmrotation, *dcmorientation;
IBOutlet NSBox *dcmBox;
IBOutlet NSTextField *dcmSeriesName;
vtkRenderer *aRenderer;
vtkCamera *aCamera;
vtkActor *outlineRect;
vtkPolyDataMapper *mapOutline;
vtkOutlineFilter *outlineData;
vtkImageImport *reader;
BOOL noWaitDialog;
WaitRendering *splash;
DICOMExport *exportDCM;
vtkImageResample *isoResample;
vtkDecimatePro *isoDeci[ 2];
vtkSmoothPolyDataFilter *isoSmoother[ 2];
vtkContourFilter *isoExtractor [ 2];
vtkPolyDataNormals *isoNormals [ 2];
vtkPolyDataMapper *isoMapper [ 2];
vtkActor *iso [ 2];
vtkImageResample *BisoResample;
vtkDecimatePro *BisoDeci[ 2];
vtkSmoothPolyDataFilter *BisoSmoother[ 2];
vtkContourFilter *BisoExtractor [ 2];
vtkPolyDataNormals *BisoNormals [ 2];
vtkPolyDataMapper *BisoMapper [ 2];
vtkActor *Biso [ 2];
vtkMatrix4x4 *matrice;
vtkMatrix4x4 *matriceBlending;
vtkOrientationMarkerWidget *orientationWidget;
NSDate *startRenderingTime;
NSMutableArray *point3DActorArray;
NSMutableArray *point3DPositionsArray;
NSMutableArray *point3DRadiusArray;
NSMutableArray *point3DColorsArray;
NSMutableArray *point3DDisplayPositionArray;
NSMutableArray *point3DTextArray;
NSMutableArray *point3DPositionsStringsArray;
NSMutableArray *point3DTextSizesArray;
NSMutableArray *point3DTextColorsArray;
BOOL display3DPoints;
IBOutlet NSPanel *point3DInfoPanel;
IBOutlet NSTextField *point3DPositionTextField;
IBOutlet NSButton *point3DDisplayPositionButton;
IBOutlet NSSlider *point3DRadiusSlider, *point3DTextSizeSlider;
IBOutlet NSColorWell *point3DColorWell, *point3DTextColorWell;
IBOutlet NSButton *point3DPropagateToAll, *point3DSetDefault;
IBOutlet SRController *controller;
float point3DDefaultRadius, point3DDefaultColorRed, point3DDefaultColorGreen, point3DDefaultColorBlue, point3DDefaultColorAlpha;
BOOL _dragInProgress;
NSTimer *_mouseDownTimer;
NSImage *destinationImage;
NSPoint _mouseLocStart; // mouseDown start point
BOOL _resizeFrame;
short _tool;
NSRect savedViewSizeFrame;
// 3DConnexion SpaceNavigator
NSTimer *snCloseEventTimer;
BOOL snStopped;
UInt16 snConnexionClientID;
#ifdef _STEREO_VISION_
//Added SilvanWidmer 10-08-09
NSWindow *LeftFullScreenWindow;
NSWindow *RightFullScreenWindow;
BOOL StereoVisionOn;
vtkCocoaGLView *leftView;
VTKStereoSRView *rightView;
NSWindow *rootWindow;
NSView *LeftContentView;
NSRect rootSize;
NSSize rootBorder;
renderSurface first;
renderSurface second;
vtkCallbackCommand *rightResponder;
#endif
}
#ifdef _STEREO_VISION_
@property(readwrite) BOOL StereoVisionOn;
@property(readonly) short currentTool;
#endif
-(unsigned char*) getRawPixels:(long*) width :(long*) height :(long*) spp :(long*) bpp :(BOOL) screenCapture :(BOOL) force8bits;
-(NSDate*) startRenderingTime;
-(void) newStartRenderingTime;
-(void) runRendering;
-(void) startRendering;
-(void) stopRendering;
-(void) setViewSizeToMatrix3DExport;
-(void) setCurrentTool:(short) i;
-(id) initWithFrame:(NSRect)frame;
-(short) setPixSource:(NSMutableArray*)pix :(float*) volumeData;
-(void) dealloc;
-(void) setBlendingPixSource:(ViewerController*) bC;
- (void) changeActor:(long) actor :(float) resolution :(float) transparency :(float) r :(float) g :(float) b :(float) isocontour :(BOOL) useDecimate :(float) decimateVal :(BOOL) useSmooth :(long) smoothVal;
-(void) deleteActor:(long) actor;
-(void) BchangeActor:(long) actor :(float) resolution :(float) transparency :(float) r :(float) g :(float) b :(float) isocontour :(BOOL) useDecimate :(float) decimateVal :(BOOL) useSmooth :(long) smoothVal;
-(void) BdeleteActor:(long) actor;
-(IBAction) endQuicktimeSettings:(id) sender;
-(IBAction) exportQuicktime :(id) sender;
//-(IBAction) endQuicktimeVRSettings:(id) sender;
- (IBAction) setCurrentdcmExport:(id) sender;
-(IBAction) endDCMExportSettings:(id) sender;
-(void) exportDICOMFile:(id) sender;
-(float) rotation;
-(float) numberOfFrames;
-(void) Azimuth:(float) z;
-(void) Vertical:(float) a;
-(NSImage*) nsimageQuicktime;
-(NSImage*) nsimage:(BOOL) q;
-(IBAction) export3DFileFormat :(id) sender;
-(IBAction) SwitchStereoMode :(id) sender;
- (void) setCamera: (Camera*) cam;
- (Camera*) camera;
-(void) switchOrientationWidget:(id) sender;
- (void) computeOrientationText;
- (void) getOrientation: (float*) o;
-(void) saView:(id) sender;
-(void) axView:(id) sender;
-(void) coView:(id) sender;
-(void) saViewOpposite:(id) sender;
- (IBAction)changeColor:(id)sender;
-(IBAction) switchProjection:(id) sender;
-(void) restoreViewSizeAfterMatrix3DExport;
// 3D Points
- (void) add3DPoint: (double) x : (double) y : (double) z : (float) radius : (float) r : (float) g : (float) b;
- (void) add3DPoint: (double) x : (double) y : (double) z;
- (void) add3DPointActor: (vtkActor*) actor;
- (void) addRandomPoints: (int) n : (int) r;
- (void) throw3DPointOnSurface: (double) x : (double) y;
- (void) setDisplay3DPoints: (BOOL) on;
- (void) toggleDisplay3DPoints;
- (BOOL) isAny3DPointSelected;
- (unsigned int) selected3DPointIndex;
- (void) unselectAllActors;
- (void) remove3DPointAtIndex: (unsigned int) index;
- (void) removeSelected3DPoint;
- (IBAction) IBSetSelected3DPointColor: (id) sender;
- (IBAction) IBSetSelected3DPointRadius: (id) sender;
- (IBAction) IBPropagate3DPointsSettings: (id) sender;
- (void) setSelected3DPointColor: (NSColor*) color;
- (void) setAll3DPointsColor: (NSColor*) color;
- (void) set3DPointAtIndex:(unsigned int) index Color: (NSColor*) color;
- (void) setSelected3DPointRadius: (float) radius;
- (void) setAll3DPointsRadius: (float) radius;
- (void) set3DPointAtIndex:(unsigned int) index Radius: (float) radius;
- (IBAction) save3DPointsDefaultProperties: (id) sender;
- (void) load3DPointsDefaultProperties;
- (void) convert3Dto2Dpoint:(double*) pt3D :(double*) pt2D;
// 3D Points annotations
- (IBAction) IBSetSelected3DPointAnnotation: (id) sender;
- (void) setAnnotationWithPosition:(int)displayPosition for3DPointAtIndex:(unsigned int) index;
- (void) setAnnotation:(const char*) annotation for3DPointAtIndex:(unsigned int) index;
- (void) displayAnnotationFor3DPointAtIndex:(unsigned int) index;
- (void) hideAnnotationFor3DPointAtIndex:(unsigned int) index;
- (IBAction) IBSetSelected3DPointAnnotationColor: (id) sender;
- (IBAction) IBSetSelected3DPointAnnotationSize: (id) sender;
-(void) setCursorForView: (long) tool;
//Dragging
- (void) startDrag:(NSTimer*)theTimer;
- (void)deleteMouseDownTimer;
-(void) squareView:(id) sender;
- (void)yaw:(float)degrees;
- (void)panX:(float)x Y:(float)y;
// 3DConnexion SpaceNavigator
- (void)connect2SpaceNavigator;
void SRSpaceNavigatorMessageHandler(io_connect_t connection, natural_t messageType, void *messageArgument);
#ifdef _STEREO_VISION_
//Added SilvanWidmer 27-08-09
- (long) getTool: (NSEvent*) event;
#endif
@end