GOFIGURE2  0.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
QGoTraceEditingWidget.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 "QGoTraceEditingWidget.h"
35 #include "QGoModesManagerWidget.h"
37 #include <QPushButton>
38 
40  std::string iTraceName,std::vector<QString> iVectChannels,
41  QStringList iListTimePoints, QWidget *iParent)
42 {
43  this->Initialize(iVectChannels, iListTimePoints, iParent);
44  this->setWindowTitle(tr("%1 Editing").arg(iTraceName.c_str()));
45 }
46 //-------------------------------------------------------------------------
47 
48 //-------------------------------------------------------------------------
50 {
51 }
52 //-------------------------------------------------------------------------
53 
54 //-------------------------------------------------------------------------
55 void QGoTraceEditingWidget::Initialize(std::vector<QString> iVectChannels,
56  QStringList iListTimePoints, QWidget *iParent)
57 {
58  this->m_ListTimePoints = iListTimePoints;
60  iVectChannels, iListTimePoints, this);
61 
62  this->m_VLayout = new QVBoxLayout;
63 
65  this->setLayout(this->m_VLayout);
66  this->m_VLayout->setSizeConstraint(QLayout::SetFixedSize);
67 }
68 //-------------------------------------------------------------------------
69 
70 //-------------------------------------------------------------------------
72  std::string iModeName, QWidget* iModeWidget, bool ModeNeedSeeds)
73 {
74  QWidget* ModeWidget = new QWidget;
75  if (iModeWidget != 0)
76  {
77  ModeWidget = iModeWidget;
78  }
79  this->m_ModeEditingWidget->AddWidgetWithModeName(iModeName, ModeWidget,
80  ModeNeedSeeds);
81 }
82 //-------------------------------------------------------------------------
83 
84 //-------------------------------------------------------------------------
86  bool ModeNeedSeeds)
87 {
88  this->m_ModeEditingWidget->AddWidgetWithModeName(iAlgoModeWidget->GetModeName(),
89  iAlgoModeWidget, ModeNeedSeeds);
90 }
91 //-------------------------------------------------------------------------
92 
93 //-------------------------------------------------------------------------
95 {
96  this->m_ModeEditingWidget = iModeWidget;
98 
100  SIGNAL (SetSeedInteractorBehaviour(bool) ),
101  this,
102  SIGNAL (SetSeedInteractorBehaviour(bool) ) );
103 
105  SIGNAL(ResetClicked() ),
106  this,
107  SIGNAL(ResetClicked() ) );
108 }
109 //-------------------------------------------------------------------------
110 
111 //-------------------------------------------------------------------------
113 {
114  delete this->m_ModeEditingWidget;
115  this->SetModesManager(iModeWidget);
116 }
117 //-------------------------------------------------------------------------
118 
119 //-------------------------------------------------------------------------
121  QGoAlgorithmWidget* iAlgoWidget)
122 {
124 }
125 //-------------------------------------------------------------------------
126 
127 //-------------------------------------------------------------------------
129  QGoAlgorithmWidget* iAlgoWidget)
130 {
132 }
133 //-------------------------------------------------------------------------
134 
135 //-------------------------------------------------------------------------
137  QStringList iListTimePoint, bool ModeNeedSeeds)
138 {
140  iListTimePoint, ModeNeedSeeds);
141 }
142 //-------------------------------------------------------------------------
143 
144 //-------------------------------------------------------------------------
146 {
148 }
149 //-------------------------------------------------------------------------
150 
151 //-------------------------------------------------------------------------
153 {
155 }
156 //-------------------------------------------------------------------------
157 
158 //-------------------------------------------------------------------------
160 {
161  return this->m_ModeEditingWidget->GetIsInvertedOn();
162 }
163 //-------------------------------------------------------------------------
164 
165 //-------------------------------------------------------------------------
167  {
168  if (IsVisible)
169  {
171  }
172  else
173  {
174  emit SetSeedInteractorBehaviour(false);
175  }
176  }
177  //-------------------------------------------------------------------------
178 
179 //-------------------------------------------------------------------------
181  {
183  }
184  //-------------------------------------------------------------------------
185 
186 //-------------------------------------------------------------------------
188  QHash<QString, QColor> iListTimePoints,
189  int iChannelNumber)
190  {
192  iListTimePoints, iChannelNumber);
193  }
194  //-------------------------------------------------------------------------
195 
196 //-------------------------------------------------------------------------
198 {
199  return this->m_ModeEditingWidget->GetCurrentModeName();
200 }
std::string GetCurrentImageName()
return the number of the selected channel
void SetTSliceForDopplerViewInAllAlgoModes(QHash< QString, QColor > iListTimePoints, int iChannelNumber)
void SetSeedInteractorBehaviour(bool enable)
void SetModesManager(QGoModesManagerWidget *iModeWidget)
void setSizeConstraint(SizeConstraint)
std::string GetCurrentModeName()
return the name of the current mode in the combobox
void SetTSliceForClassicView(int iTimePoint)
void AddAlgoWidgetForSemiAutomaticMode(QGoAlgorithmWidget *iAlgoWidget)
add the iAlgoWidget directly in the QgoAlgomanager corresponding to the Semi Automatic mode ...
void SetANewModesManager(QGoModesManagerWidget *iModeWidget)
replace the existing m_ModeEditingWidget with iModeWidget: all the previous mode will be erased ...
manages all the algorithms widget for a same mode, has a combobox with the name of the methods which ...
QString tr(const char *sourceText, const char *disambiguation, int n)
void AddWidgetForManualMode(QWidget *iWidget, QStringList iListTimePoint, bool ModeNeedSeeds)
widget that manages the different modes for the TraceEditingWidget, has a combobox with the mode name...
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
void SetTheRightMode(int iIndex=-1)
set the right mode according to the combobox if iIndex is different than -1 and emit a signal to enab...
void setLayout(QLayout *layout)
void AddAlgoWidgetForSemiAutomaticMode(QGoAlgorithmWidget *iAlgoWidget)
void AddWidgetWithModeName(std::string iModeName, QWidget *iWidget, bool ModeNeedSeeds)
add a widget in the StackedWidget with the mode name that will be added in the combobox.
void AddAlgoWidgetForAutomaticMode(QGoAlgorithmWidget *iAlgoWidget)
void Initialize(std::vector< QString > iVectChannels, QStringList iListTimePoints, QWidget *iParent=0)
QGoTraceEditingWidget(std::string iTraceName, std::vector< QString > iVectChannels, QStringList iListTimePoints, QWidget *iParent=0)
void SetTSliceForDopplerView(QHash< QString, QColor > iListTimePoints, int iChannelNumber)
void AddAlgoWidgetForAutomaticMode(QGoAlgorithmWidget *iAlgoWidget)
add the iAlgoWidget directly in the QgoAlgomanager corresponding to the Automatic mode ...
void setWindowTitle(const QString &)
QWidget(QWidget *parent, QFlags< Qt::WindowType > f)
std::string GetModeName()
return the name of the mode
void CheckTheCurrentMode(bool IsVisible)
check which mode is selected and if the seeds are needed or not and emit the corresponding signals ba...
void AddWidgetForManualMode(QWidget *iWidget, QStringList iListTimePoint, bool ModeNeedSeeds)
create the "manual" mode and makes it correspond to the provided widget
std::string GetCurrentModeName()
return the mode name currently selected in the combobox
void SetTSliceForClassicViewInAllAlgoModes(int iTimePoint)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void AddMode(std::string iModeName, QWidget *iModeWidget, bool ModeNeedSeeds)
add iModeWidget as a widget to be displayed when iModeName is selected in the combobox of m_ModeEditi...
QGoModesManagerWidget * m_ModeEditingWidget