7 #include "ioGdcm/SDicomSeriesConverter.hpp" 9 #include <fwCom/HasSignals.hpp> 10 #include <fwCom/Signal.hpp> 11 #include <fwCom/Signal.hxx> 13 #include <fwGdcmIO/reader/SeriesDB.hpp> 15 #include <fwGui/dialog/LoggerDialog.hpp> 16 #include <fwGui/dialog/MessageDialog.hpp> 17 #include <fwGui/dialog/ProgressDialog.hpp> 19 #include <fwJobs/IJob.hpp> 20 #include <fwJobs/Observer.hpp> 22 #include <fwMedDataTools/helper/SeriesDB.hpp> 24 #include <fwServices/macros.hpp> 26 #include <boost/foreach.hpp> 33 static const ::fwCom::Signals::SignalKeyType JOB_CREATED_SIGNAL =
"jobCreated";
51 _sstream <<
"SDicomSeriesConverter::info";
77 ::fwMedData::SeriesDB::sptr destinationSeriesDB = this->getInOut< ::fwMedData::SeriesDB>(
"target");
78 SLM_ASSERT(
"The 'target' key doesn't exist.", destinationSeriesDB);
80 ::fwMedData::SeriesDB::csptr dicomSeriesDB = this->getInput< ::fwMedData::SeriesDB >(
"source");
81 ::fwMedData::SeriesDB::sptr dummy = ::fwMedData::SeriesDB::New();
83 if(dicomSeriesDB->empty())
86 messageBox.
setIcon(::fwGui::dialog::IMessageDialog::INFO);
87 messageBox.
addButton(::fwGui::dialog::IMessageDialog::OK);
88 messageBox.
setTitle(
"Read DICOM series");
89 messageBox.
setMessage(
"There is no DICOM series that can be read." );
94 ::fwGdcmIO::reader::SeriesDB::sptr reader = ::fwGdcmIO::reader::SeriesDB::New();
95 reader->setObject(dummy);
96 auto job = reader->getJob();
101 reader->readFromDicomSeriesDB(dicomSeriesDB, this->getSptr());
103 ::fwLog::Logger::sptr logger = reader->getLogger();
106 std::stringstream ss;
107 ss <<
"The reading process is over : <b>" << dummy->size() <<
" series</b> " 108 << ((dummy->size() > 1) ?
"have" :
"has") <<
" been found. " 109 <<
"<br>Please verify the log report to be informed of the potential errors.";
112 if(!job->cancelRequested())
118 if(!result || job->cancelRequested())
126 sDBhelper.
merge(dummy);
130 catch (
const std::exception& e)
132 std::stringstream ss;
133 ss <<
"Warning during loading : " << e.what();
135 "Warning", ss.str(), ::fwGui::dialog::IMessageDialog::WARNING);
140 "Warning",
"Warning during loading", ::fwGui::dialog::IMessageDialog::WARNING);
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.
static FWGUI_API IMessageDialog::Buttons showMessageDialog(const std::string &title, const std::string &message,::fwGui::dialog::IMessageDialog::Icons icon=INFO)
Defines the service interface managing the menu items.
std::shared_ptr< JobCreatedSignal > m_sigJobCreated
Signal emitted when a job is created.
virtual IOGDCM_API ~SDicomSeriesConverter() noexcept override
Destructor.
virtual FWGUI_API void addButton(IMessageDialog::Buttons button) override
Add a button (OK, YES_NO, YES, NO, CANCEL)
virtual FWGUI_API IMessageDialog::Buttons show() override
Show the message box and return the clicked button.
IOGDCM_API void info(std::ostream &_sstream) override
Override.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual IOGDCM_API void configuring() override
Configuring method. This method is used to configure the service.
virtual IOGDCM_API void starting() override
Override.
virtual FWGUI_API void setIcon(IMessageDialog::Icons icon) override
Set the icon (CRITICAL, WARNING, INFO or QUESTION)
ioGdcm contains services use to deal with DICOM using the GDCM library.
IOGDCM_API void updating() override
Override.
virtual IOGDCM_API void stopping() override
Override.
static FWGUI_API bool showLoggerDialog(const std::string &title, const std::string &message, const ::fwLog::Logger::sptr &logger)
This service is used to convert DicomSeries from source SeriesDB and push result (ImageSeries, ModelSeries, ...) in target SeriesDB.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.
IOGDCM_API SDicomSeriesConverter() noexcept
Constructor.