CustusX  16.5.0-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxStateService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 #include "cxStateService.h"
34 
35 #include <math.h>
36 #include <QColor>
37 #include "cxStateServiceNull.h"
38 #include "cxNullDeleter.h"
39 #include "cxVLCRecorder.h"
40 #include "cxDefinitions.h"
41 
42 namespace cx
43 {
44 
46 {
47 }
48 
49 Desktop::Desktop(QString layout, QByteArray mainwindowstate) :
50  mLayoutUid(layout), mMainWindowState(mainwindowstate)
51 {
52 }
53 
54 void Desktop::addPreset(QString name, int pos, bool tabbed)
55 {
56  Preset item;
57  item.name = name;
58  item.position = pos;
59  item.tabbed = tabbed;
60  mPresets.push_back(item);
61 }
62 
63 
65 {
66  static StateServicePtr mNull;
67  if (!mNull)
68  mNull.reset(new StateServiceNull, null_deleter());
69  return mNull;
70 }
71 
76 {
77  this->fillDefault("Automation/autoStartTracking", true);
78  this->fillDefault("Automation/autoStartStreaming", true);
79  this->fillDefault("Automation/autoReconstruct", true);
80  this->fillDefault("Automation/autoSelectActiveTool", true);
81  this->fillDefault("Automation/autoSave", true);
82  this->fillDefault("Automation/autoLoadRecentPatient", true);
83  this->fillDefault("Automation/autoLoadRecentPatientWithinHours", 8);
84  this->fillDefault("Automation/autoShowNewData", false);
85  this->fillDefault("Automation/autoShowNewDataInViewGroup0", true);
86  this->fillDefault("Automation/autoShowNewDataInViewGroup1", false);
87  this->fillDefault("Automation/autoShowNewDataInViewGroup3", false);
88  this->fillDefault("Automation/autoShowNewDataInViewGroup2", false);
89  this->fillDefault("Automation/autoShowNewDataInViewGroup4", false);
90  this->fillDefault("Automation/autoResetCameraToSuperiorViewWhenAutoShowingNewData", false);
91  this->fillDefault("Automation/autoCenterToImageCenterViewWhenAutoShowingNewData", false);
92  this->fillDefault("Automation/autoDeleteDICOMDatabase", true);
93 
94  this->fillDefault("TrackingPositionFilter/enabled", false);
95 
96  this->fillDefault("renderingInterval", 33);
97  this->fillDefault("backgroundColor", QColor(30,60,70)); // a dark, grey-blue hue
98  this->fillDefault("vlcPath", vlc()->getVLCPath());
99  this->fillDefault("globalPatientNumber", 1);
100  this->fillDefault("Ultrasound/acquisitionName", "US-Acq");
101  this->fillDefault("Ultrasound/8bitAcquisitionData", false);
102  this->fillDefault("Ultrasound/CompressAcquisition", true);
103  this->fillDefault("View3D/sphereRadius", 1.0);
104  this->fillDefault("View3D/labelSize", 2.5);
105  this->fillDefault("Navigation/anyplaneViewOffset", 0.25);
106  this->fillDefault("Navigation/followTooltip", true);
107  this->fillDefault("Navigation/followTooltipBoundary", 0.1);
108 
109  this->fillDefault("showSectorInRTView", true);
110  this->fillDefault("View/showOrientationAnnotation", true);
111  this->fillDefault("View3D/stereoType", stFRAME_SEQUENTIAL);
112  this->fillDefault("View3D/eyeAngle", 4.0);
113  this->fillDefault("View/showDataText", true);
114  this->fillDefault("View/showLabels", true);
115  this->fillDefault("View/showMetricNamesInCorner", false);
116  this->fillDefault("View3D/annotationModelSize", 0.2);
117  this->fillDefault("View3D/annotationModel", "woman.stl");
118  this->fillDefault("View3D/depthPeeling", false);
119  this->fillDefault("View3D/ImageRender3DVisualizer", "vtkGPUVolumeRayCastMapper");
120  this->fillDefault("View3D/maxRenderSize", 10 * pow(10.0,6));
121  this->fillDefault("View/shadingOn", true);
122 
123  this->fillDefault("stillUpdateRate", 0.001);
124 
125 #ifdef __APPLE__
126  this->fillDefault("useGPU2DRendering", true);
127 #elif WIN32
128  this->fillDefault("useGPU2DRendering", false);
129 #else
130  this->fillDefault("useGPU2DRendering", true);
131 #endif
132 
133  this->fillDefault("optimizedViews", true);
134  this->fillDefault("smartRender", true);
135 
136  this->fillDefault("IGSTKDebugLogging", false);
137  this->fillDefault("giveManualToolPhysicalProperties", false);
138  this->fillDefault("renderSpeedLogging", false);
139 
140  this->fillDefault("applyTransferFunctionPresetsToAll", false);
141 
142  this->fillDefault("USsimulation/type", "Original data");
143  this->fillDefault("USsimulation/volume", "");
144  this->fillDefault("USsimulation/gain", 0.70);
145 }
146 
147 
148 } //namespace cx
std::vector< Preset > mPresets
boost::shared_ptr< class StateService > StateServicePtr
stFRAME_SEQUENTIAL
void fillDefault(QString name, T value)
static StateServicePtr getNullObject()
void addPreset(QString name, int pos, bool tabbed=true)
VLCRecorder * vlc()
Shortcut for accessing the vlc recorder.