7 #include "ioGdcm/SDicomSeriesAnonymizer.hpp" 9 #include <fwCom/Signal.hxx> 11 #include <fwData/Vector.hpp> 13 #include <fwGdcmIO/helper/DicomSeriesAnonymizer.hpp> 15 #include <fwGui/Cursor.hpp> 16 #include <fwGui/dialog/MessageDialog.hpp> 18 #include <fwJobs/Aggregator.hpp> 19 #include <fwJobs/IJob.hpp> 21 #include <fwMedData/DicomSeries.hpp> 22 #include <fwMedData/SeriesDB.hpp> 24 #include <fwMedDataTools/helper/SeriesDB.hpp> 26 #include <fwServices/macros.hpp> 35 static const ::fwCom::Signals::SignalKeyType JOB_CREATED_SIGNAL =
"jobCreated";
73 ::fwData::Vector::sptr vector = this->getInOut< ::fwData::Vector >(
"selectedSeries");
76 dialog.
setTitle(
"Series anonymization");
81 dialog.setMessage(
"Are you sure you want to anonymize the selected series ?" );
82 dialog.setIcon(::fwGui::dialog::IMessageDialog::QUESTION);
83 dialog.addButton(::fwGui::dialog::IMessageDialog::YES);
84 dialog.addButton(::fwGui::dialog::IMessageDialog::CANCEL);
87 if ( answer == ::fwGui::dialog::IMessageDialog::YES )
98 dialog.setMessage(
"Please select which series you want to anonymize." );
99 dialog.setIcon(::fwGui::dialog::IMessageDialog::INFO);
100 dialog.addButton(::fwGui::dialog::IMessageDialog::OK);
109 _sstream <<
"SDicomSeriesAnonymizer::info";
116 ::fwMedData::SeriesDB::sptr seriesDB = this->getInOut< ::fwMedData::SeriesDB>(
"seriesDB");
117 ::fwData::Vector::sptr vector = this->getInOut< ::fwData::Vector >(
"selectedSeries");
121 ::fwGdcmIO::helper::DicomSeriesAnonymizer::sptr anonymizer =
122 ::fwGdcmIO::helper::DicomSeriesAnonymizer::New();
125 std::vector< ::fwMedData::DicomSeries::sptr > anonymizedDicomSeriesVector;
127 for(
const auto& value : vector->getContainer())
129 ::fwMedData::DicomSeries::sptr dicomSeries = ::fwMedData::DicomSeries::dynamicCast(value);
130 ::fwMedData::DicomSeries::sptr anonymizedDicomSeries = ::fwMedData::DicomSeries::New();
131 anonymizer->anonymize(dicomSeries, anonymizedDicomSeries);
132 anonymizedDicomSeriesVector.push_back(anonymizedDicomSeries);
134 m_cancelled = anonymizer->getJob()->cancelRequested();
143 for(
const auto& value : vector->getContainer())
145 ::fwMedData::DicomSeries::sptr dicomSeries = ::fwMedData::DicomSeries::dynamicCast(value);
146 sDBhelper.remove(dicomSeries);
149 for(
const auto& anonymizedDicomSeries : anonymizedDicomSeriesVector)
151 sDBhelper.add(anonymizedDicomSeries);
IOGDCM_API SDicomSeriesAnonymizer() noexcept
Constructor.
virtual FWGUI_API void setCursor(::fwGui::ICursor::CursorType cursor) override
Set the cursor.
virtual IOGDCM_API void stopping() override
Override.
Service to anonymize a DicomSeries.
IOGDCM_API void anonymize()
Override.
virtual IOGDCM_API ~SDicomSeriesAnonymizer() noexcept override
Destructor.
Defines the generic message box for IHM. Use the Delegate design pattern.
std::shared_ptr< JobCreatedSignal > m_sigJobCreated
Signal emitted when a job is created.
This interface defines control service API. Does nothing particularly, can be considered as a default...
virtual IOGDCM_API void starting() override
Override.
bool m_cancelled
Cancel information for jobs.
ioGdcm contains services use to deal with DICOM using the GDCM library.
Defines the generic cursor for IHM. Use the Delegate design pattern.
virtual IOGDCM_API void configuring() override
Do nothing.
IOGDCM_API void info(std::ostream &_sstream) override
Override.
virtual FWGUI_API void setTitle(const std::string &title) override
Set the title of the message box.
virtual FWGUI_API void setDefaultCursor() override
Set the default cursor.
IOGDCM_API void updating() override
Override.