7 #include "ioDicom/SSeriesDBMerger.hpp" 9 #include <fwData/Vector.hpp> 11 #include <fwGui/dialog/MessageDialog.hpp> 13 #include <fwMedDataTools/helper/SeriesDB.hpp> 15 #include <fwServices/macros.hpp> 17 #include <boost/foreach.hpp> 40 _sstream <<
"SSeriesDBMerger::info";
65 auto destinationSeriesDB = this->getInOut< ::fwMedData::SeriesDB>(
"seriesDB");
66 SLM_ASSERT(
"'seriesDB' key is not found.", destinationSeriesDB);
69 ::fwMedData::SeriesDB::ContainerType container = destinationSeriesDB->getContainer();
70 ::fwData::Vector::csptr selectedSeries = this->getInput< ::fwData::Vector >(
"selectedSeries");
73 std::vector< ::fwMedData::Series::sptr > addedSeries;
76 for(const ::fwData::Object::sptr& obj: selectedSeries->getContainer())
78 ::fwMedData::Series::sptr series = ::fwMedData::Series::dynamicCast(obj);
80 if(series && std::find(container.begin(),container.end(), series) == container.end())
82 sDBhelper.
add(series);
83 addedSeries.push_back(series);
90 messageBox.
setIcon(::fwGui::dialog::IMessageDialog::INFO);
91 messageBox.
addButton(::fwGui::dialog::IMessageDialog::OK);
94 if(selectedSeries->empty())
96 messageBox.
setMessage(
"Unable to push series, there is no series selected." );
98 else if(addedSeries.empty())
100 messageBox.
setMessage(
"Unable to push series, the series are already present in the database." );
104 std::stringstream ss;
105 if(addedSeries.size()==1)
107 ss << addedSeries.size() <<
" series has been correctly pushed in the database:\n";
111 ss << addedSeries.size() <<
" series have been correctly pushed in the database:\n";
114 for(const ::fwMedData::Series::sptr& series: addedSeries)
116 std::string description = series->getDescription();
117 description = (description.empty()) ?
"[No description]" : description;
118 ss <<
"- " << description << std::endl;
virtual FWGUI_API void setMessage(const std::string &msg) override
Set the message.
Defines the generic message box for IHM. Use the Delegate design pattern.
Defines the service interface managing the menu items.
IODICOM_API SSeriesDBMerger() noexcept
Constructor.
This class defines a vector of objects.
virtual FWGUI_API void addButton(IMessageDialog::Buttons button) override
Add a button (OK, YES_NO, YES, NO, CANCEL)
This service is used to merge selected series with a SeriesDB. All the series in the vector are pushe...
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
ioDicom contains services used to deal with the DICOM standard.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual IODICOM_API ~SSeriesDBMerger() noexcept
Destructor.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
IODICOM_API void info(std::ostream &_sstream) override
Override.
virtual IODICOM_API void starting() override
Override.
virtual IODICOM_API void configuring() override
Do nothing.
IODICOM_API void updating() override
Override.
virtual IODICOM_API void stopping() override
Override.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.