GOFIGURE2
0.9.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
Code
GUI
lib
TraceEditing
QGoContourEditingWidgetManager.cxx
Go to the documentation of this file.
1
/*=========================================================================
2
Authors: The GoFigure Dev. Team.
3
at Megason Lab, Systems biology, Harvard Medical school, 2009-11
4
5
Copyright (c) 2009-11, President and Fellows of Harvard College.
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
Redistributions of source code must retain the above copyright notice,
12
this list of conditions and the following disclaimer.
13
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
Neither the name of the President and Fellows of Harvard College
17
nor the names of its contributors may be used to endorse or promote
18
products derived from this software without specific prior written
19
permission.
20
21
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
23
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
25
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
27
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
30
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33
=========================================================================*/
34
#include "
QGoContourEditingWidgetManager.h
"
35
#include "
QGoAlgorithmWidget.h
"
36
#include "
QGoAlgoParameter.h
"
37
#include "
QGoAlgorithmsManagerWidget.h
"
38
#include "
GoImageProcessor.h
"
39
40
#include "vtkSmartPointer.h"
41
#include "vtkImageExport.h"
42
#include "vtkImageData.h"
43
#include <iostream>
44
45
46
QGoContourEditingWidgetManager::QGoContourEditingWidgetManager
(
47
std::vector<QString> iVectChannels,
48
int
iTimeMin,
49
int
iTimeMax,
50
std::vector< vtkPoints* >* iSeeds,
51
GoImageProcessor
* iImages,
52
int
* iCurrentTimePoint,
53
QWidget
* iParent):
QGoTraceEditingWidgetManager
(
"Contour"
,
54
iVectChannels, iTimeMin, iTimeMax, iSeeds, iImages,
55
iCurrentTimePoint, iParent)
56
{
57
this->
SetSemiAutomaticAlgorithms
(iParent);
58
this->
SetManualMode
(this->
m_ListTimePoint
, iParent);
59
}
60
//-------------------------------------------------------------------------
61
62
//-------------------------------------------------------------------------
63
QGoContourEditingWidgetManager::~QGoContourEditingWidgetManager
()
64
{
65
}
66
//-------------------------------------------------------------------------
67
68
//-------------------------------------------------------------------------
69
void
QGoContourEditingWidgetManager::SetManualMode
(
70
QStringList
iListTimePoint,
QWidget
* iParent)
71
{
72
m_ManualMode
=
new
QGoContourManualSegmentation
(iParent);
73
74
this->
m_TraceEditingWidget
->
AddWidgetForManualMode
(
m_ManualMode
->
getWidget
(),
75
iListTimePoint,
false
);
76
77
this->
SetTSliceForClassicView
();
78
79
QObject::connect
( this->
m_ManualMode
,
80
SIGNAL (
changeContourRepresentationProperty
(
float
,
QColor
,
81
QColor
,
QColor
) ),
82
this
, SIGNAL(
changeContourRepresentationProperty
(
float
,
QColor
,
83
QColor
,
QColor
) ) );
84
85
QObject::connect
( this->
m_ManualMode
,
86
SIGNAL (validateContour() ),
87
this
, SLOT(
ContourToValidate
() ) );
88
89
QObject::connect
( this->
m_ManualMode
,
90
SIGNAL (
reinitializeContour
() ),
91
this
, SIGNAL(
reinitializeContour
() ) );
92
93
QObject::connect
( this->
m_TraceEditingWidget
,
94
SIGNAL(
SetSeedInteractorBehaviour
(
bool
) ),
95
this
,
96
SLOT(
StartManualSegmentation
(
bool
) ) );
97
98
}
99
//-------------------------------------------------------------------------
100
101
//-------------------------------------------------------------------------
102
void
QGoContourEditingWidgetManager::StartManualSegmentation
(
bool
iValue )
103
{
104
// if current is
105
if
(this->
m_TraceEditingWidget
->
GetCurrentModeName
().compare(
"Manual"
) == 0)
106
{
107
emit
ManualSegmentationActivated
(
true
);
108
}
109
else
110
{
111
emit
ManualSegmentationActivated
(
false
);
112
}
113
}
114
//-------------------------------------------------------------------------
115
116
//-------------------------------------------------------------------------
117
void
QGoContourEditingWidgetManager::ContourToValidate
()
118
{
119
int
CurrentTimePoint = this->
GetSelectedTimePoint
();
//for test purpose
120
emit
ContourValidated
( CurrentTimePoint );
121
}
122
//-------------------------------------------------------------------------
123
124
//-------------------------------------------------------------------------
125
void
QGoContourEditingWidgetManager::SetSemiAutomaticAlgorithms
(
QWidget
* iParent)
126
{
127
//level set:
128
m_LevelSetAlgo
=
new
QGoContourLevelSetAlgo
(this->
m_Seeds
, iParent);
129
QGoAlgorithmWidget
* LevelSetWidget =
m_LevelSetAlgo
->
GetAlgoWidget
();
130
this->
m_TraceEditingWidget
->
AddAlgoWidgetForSemiAutomaticMode
(LevelSetWidget);
131
132
QObject::connect
(LevelSetWidget, SIGNAL(ApplyAlgo() ),
133
this
, SLOT(
ApplyLevelSetAlgo
() ) );
134
135
/*//shape:
136
this->m_ShapeAlgo = new QGoMeshShapeAlgo(this->m_Seeds, iParent);
137
QGoAlgorithmWidget* ShapeWidget = this->m_ShapeAlgo->GetAlgoWidget();
138
this->m_TraceEditingWidget->AddAlgoWidgetForSemiAutomaticMode(ShapeWidget);
139
140
QObject::connect(ShapeWidget, SIGNAL(ApplyAlgo() ),
141
this, SLOT(ApplyShapeAlgo() ) );
142
143
//watershed:
144
this->m_WaterShedAlgo = new QGoMeshWaterShedAlgo(this->m_Seeds,
145
this->m_MaxThreshold, iParent);
146
QGoAlgorithmWidget* WaterShedWidget = m_WaterShedAlgo->GetAlgoWidget();
147
this->m_TraceEditingWidget->AddAlgoWidgetForSemiAutomaticMode(WaterShedWidget);
148
149
QObject::connect(WaterShedWidget, SIGNAL(ApplyAlgo() ),
150
this, SLOT(ApplyWaterShedAlgo() ) );*/
151
}
152
//-------------------------------------------------------------------------
153
154
//-------------------------------------------------------------------------
155
void
QGoContourEditingWidgetManager::ApplyLevelSetAlgo
()
156
{
157
this->GetPolydatasFromAlgo<QGoContourLevelSetAlgo>(this->
m_LevelSetAlgo
);
158
}
159
//-------------------------------------------------------------------------
160
161
//-------------------------------------------------------------------------
162
/*void QGoContourEditingWidgetManager::ApplyShapeAlgo()
163
{
164
this->GetPolydatasFromAlgo<QGoContourShapeAlgo>(this->m_ShapeAlgo);
165
}
166
//-------------------------------------------------------------------------
167
168
//-------------------------------------------------------------------------
169
void QGoContourEditingWidgetManager::ApplyWaterShedAlgo()
170
{
171
this->GetPolydatasFromAlgo<QGoMeshWaterShedAlgo>(this->m_WaterShedAlgo);
172
}*/
173
//-------------------------------------------------------------------------
174
175
//-------------------------------------------------------------------------
176
void
QGoContourEditingWidgetManager::SetReeditMode
(
bool
iReeditMode)
177
{
178
this->
m_ManualMode
->
SetReeditMode
(iReeditMode);
179
}
180
//-------------------------------------------------------------------------
181
182
//-------------------------------------------------------------------------
183
bool
QGoContourEditingWidgetManager::GetReeditMode
()
184
{
185
return
this->
m_ManualMode
->
GetReeditMode
();
186
}
187
//-------------------------------------------------------------------------
188
189
//-------------------------------------------------------------------------
190
void
QGoContourEditingWidgetManager::InitializeSettingsForManualMode
()
191
{
192
this->
m_ManualMode
->
GenerateContourRepresentationProperties
(
true
);
193
}
194
//-------------------------------------------------------------------------
195
196
//-------------------------------------------------------------------------
197
void
QGoContourEditingWidgetManager::SetVisible
(
bool
isVisible)
198
{
199
QGoTraceEditingWidgetManager::SetVisible
(isVisible);
200
201
if
(this->
m_TraceEditingWidget
->
GetCurrentModeName
() ==
"Manual"
)
202
{
203
emit
ManualSegmentationActivated
(isVisible);
204
}
205
}
Generated on Mon May 27 2013 08:47:30 for GOFIGURE2 by
1.8.1.2