7 #include "uiMedDataQt/editor/SSeries.hpp" 9 #include "uiMedDataQt/widget/EquipmentEditor.hpp" 10 #include "uiMedDataQt/widget/PatientEditor.hpp" 11 #include "uiMedDataQt/widget/SeriesEditor.hpp" 12 #include "uiMedDataQt/widget/StudyEditor.hpp" 14 #include <fwCom/Signal.hxx> 15 #include <fwCom/Slots.hxx> 17 #include <fwData/Vector.hpp> 19 #include <fwGui/dialog/MessageDialog.hpp> 21 #include <fwGuiQt/container/QtContainer.hpp> 23 #include <fwMedData/Patient.hpp> 24 #include <fwMedData/Study.hpp> 26 #include <fwMedDataTools/functions.hpp> 27 #include <fwMedDataTools/helper/SeriesDB.hpp> 29 #include <fwServices/macros.hpp> 31 #include <fwTools/Object.hpp> 33 #include <QHBoxLayout> 36 #include <QPushButton> 37 #include <QVBoxLayout> 58 m_sigCanExport = CanExportSignalType::New();
59 m_sigSeriesExported = SeriesExportedSignalType::New();
61 ::fwCom::HasSignals::m_signals
84 ::fwGuiQt::container::QtContainer::sptr qtContainer
85 = ::fwGuiQt::container::QtContainer::dynamicCast(this->getContainer());
87 QWidget*
const container = qtContainer->getQtContainer();
88 SLM_ASSERT(
"container not instanced", container);
90 m_patientEditor = new ::uiMedDataQt::widget::PatientEditor();
91 m_studyEditor = new ::uiMedDataQt::widget::StudyEditor();
92 m_equipmentEditor = new ::uiMedDataQt::widget::EquipmentEditor();
93 m_seriesEditor = new ::uiMedDataQt::widget::SeriesEditor();
95 QVBoxLayout* studyEquipmentLayout =
new QVBoxLayout();
96 studyEquipmentLayout->addWidget(m_studyEditor);
97 studyEquipmentLayout->addWidget(m_equipmentEditor);
99 QHBoxLayout* editorLayout =
new QHBoxLayout();
100 editorLayout->addWidget(m_patientEditor);
101 editorLayout->addLayout(studyEquipmentLayout);
102 editorLayout->addWidget(m_seriesEditor);
104 QVBoxLayout* layout =
new QVBoxLayout(container);
105 layout->addLayout(editorLayout);
107 m_btnExport =
new QPushButton(tr(
"Export series"));
108 m_btnExport->setEnabled(
false);
109 m_btnExport->setVisible(m_sigCanExport->getNumberOfConnections() == 0);
110 m_sigCanExport->asyncEmit(
false);
111 QHBoxLayout* btnLayout =
new QHBoxLayout();
112 btnLayout->setAlignment(Qt::AlignRight);
113 btnLayout->setSizeConstraint(QLayout::SetFixedSize);
114 btnLayout->addWidget(m_btnExport);
115 layout->addLayout(btnLayout);
116 QObject::connect(m_btnExport, SIGNAL(clicked()),
this, SLOT(
onExportClicked()));
130 ::fwData::Vector::sptr vector = this->getObject< ::fwData::Vector >();
131 SLM_ASSERT(
"Failed to retrieve vector", vector);
133 m_btnExport->setVisible(m_sigCanExport->getNumberOfConnections() == 0);
139 SLM_ASSERT(
"Failed to retrieve object with UID '" + m_seriesId +
"'", obj);
140 ::fwMedData::Series::sptr seriesSrc = ::fwMedData::Series::dynamicCast(obj);
141 SLM_ASSERT(
"Failed to retrieve a ::fwMedData::Series from object '" << m_seriesId <<
"'", seriesSrc);
143 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast((*vector)[0]);
144 SLM_ASSERT(
"Failed to retrieve ::fwMedData::Series from vector", series);
145 series->setDescription(seriesSrc->getDescription());
146 series->setPerformingPhysiciansName(seriesSrc->getPerformingPhysiciansName());
148 m_patientEditor->setSeries(series);
149 m_studyEditor->setSeries(series);
150 m_equipmentEditor->setSeries(series);
151 m_seriesEditor->setSeries(series);
152 m_btnExport->setEnabled(
true);
153 m_sigCanExport->asyncEmit(
true);
157 m_btnExport->setEnabled(
false);
158 m_sigCanExport->asyncEmit(
false);
169 SLM_ASSERT(
"Failed to retrieve object with UID '" + m_seriesId +
"'", obj);
170 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast(obj);
171 SLM_ASSERT(
"Failed to retrieve a ::fwMedData::Series from object '" << m_seriesId <<
"'", series);
174 SLM_ASSERT(
"Failed to retrieve object with UID '" + m_seriesDBId +
"'", objDB);
175 ::fwMedData::SeriesDB::sptr seriesDB = ::fwMedData::SeriesDB::dynamicCast(objDB);
176 SLM_ASSERT(
"Failed to retrieve a ::fwMedData::SeriesDB from object '" << m_seriesDBId <<
"'", seriesDB);
178 if(m_patientEditor->isValid() && m_studyEditor->isValid()
179 && m_equipmentEditor->isValid() && m_seriesEditor->isValid())
182 ::fwData::Vector::sptr vector = this->getObject< ::fwData::Vector >();
183 SLM_ASSERT(
"Failed to retrieve vector", vector);
184 ::fwMedData::Series::sptr seriesVec = ::fwMedData::Series::dynamicCast((*vector)[0]);
185 SLM_ASSERT(
"Failed to retrieve ::fwMedData::Series from vector", seriesVec);
187 ::fwMedData::Patient::sptr patient = m_patientEditor->getPatient();
188 ::fwMedData::Study::sptr study = m_studyEditor->getStudy();
191 if(patient->getPatientId() != seriesVec->getPatient()->getPatientId())
196 series->setPatient(patient);
197 series->setStudy(study);
198 series->setEquipment(m_equipmentEditor->getEquipment());
200 ::fwMedData::Series::sptr seriesInfo = m_seriesEditor->getSeries();
201 series->setModality(seriesInfo->getModality());
202 series->setDate(seriesInfo->getDate());
203 series->setTime(seriesInfo->getTime());
204 series->setDescription(seriesInfo->getDescription());
205 series->setPerformingPhysiciansName(seriesInfo->getPerformingPhysiciansName());
209 if(it != seriesDB->end())
212 dlg.
setTitle(
"The series already exists");
213 dlg.
setMessage(
"This series has already been exported in series selector");
214 dlg.
setIcon(::fwGui::dialog::IMessageDialog::INFO);
223 m_sigSeriesExported->asyncEmit();
228 dlg.
setTitle(
"Error : information validation failed");
229 dlg.
setMessage(
"Given information are not valid : please fix incorrect values before exporting");
230 dlg.
setIcon(::fwGui::dialog::IMessageDialog::CRITICAL);
242 std::vector< ::fwRuntime::ConfigurationElement::sptr > seriesCfg =
m_configuration->find(
"seriesId");
243 SLM_ASSERT(
"Missing tag 'seriesId'", !seriesCfg.empty());
245 m_seriesId = seriesCfg.front()->getValue();
246 SLM_ASSERT(
"seriesId must not be empty", !m_seriesId.empty());
248 std::vector< ::fwRuntime::ConfigurationElement::sptr > seriesDBCfg =
m_configuration->find(
"seriesDBId");
249 SLM_ASSERT(
"Missing tag 'seriesDBId'", !seriesDBCfg.empty());
251 m_seriesDBId = seriesDBCfg.front()->getValue();
252 SLM_ASSERT(
"seriesDBId must not be empty", !m_seriesDBId.empty());
virtual UIMEDDATAQT_API KeyConnectionsType getObjSrvConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
The namespace uiMedDataQt contains editors for medical data.
static UIMEDDATAQT_APIconst::fwCom::Slots::SlotKeyType s_EXPORT_SLOT
Slot triggering export.
#define SLM_TRACE_FUNC()
Trace contextual function signature.
virtual FWGUI_API void setMessage(const std::string &msg) override
Set the message.
Defines the service interface managing the editor service for object.
Defines the generic message box for IHM. Use the Delegate design pattern.
FWGUI_API void destroy()
Stops sub-views and toobar services. Destroys view, sub-views and toolbar containers.
virtual UIMEDDATAQT_API ~SSeries() noexcept
Destructor.
virtual void starting() override
Installs GUI : create container and add selector.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_OBJECTS_SIG
Type of signal when objects are added.
UIMEDDATAQT_API SSeries()
Constructor.
#define FW_DEPRECATED_MSG(message, version)
Use this macro when deprecating a function to warn the developer.
static UIMEDDATAQT_APIconst::fwCom::Signals::SignalKeyType s_SERIES_EXPORTED_SIG
Signal type and key triggered when the series has been exported to related series DB...
This class defines a vector of objects.
ContainerType::iterator iterator
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual void updating() override
Fill selector with the series contained in SeriesDB.
virtual void stopping() override
Destroys GUI.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
::fwCom::helper::SigSlotConnection::KeyConnectionsType KeyConnectionsType
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
FWGUI_API void create()
Creates view, sub-views and toolbar containers. Manages sub-views and toobar services.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
void onExportClicked()
Triggered when export button is clicked.
static UIMEDDATAQT_APIconst::fwCom::Signals::SignalKeyType s_CAN_EXPORT_SIG
Signal type and key triggered when the service export ability changes.
std::shared_ptr< ::fwThread::Worker > m_associatedWorker
Associated worker.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_OBJECTS_SIG
Type of signal when objects are added.
Shows and edit fwMedData::Series information.
static FWSERVICES_APIconst::fwCom::Slots::SlotKeyType s_UPDATE_SLOT
Slot to call start method.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.
FWGUI_API void initialize()
Initialize managers.
virtual void configuring() override