7 #include "uiMedDataQt/action/SExportSeries.hpp" 9 #include <fwActivities/registry/Activities.hpp> 11 #include <fwCom/Slot.hpp> 12 #include <fwCom/Slot.hxx> 13 #include <fwCom/Slots.hpp> 14 #include <fwCom/Slots.hxx> 16 #include <fwCore/base.hpp> 18 #include <fwGui/dialog/InputDialog.hpp> 20 #include <fwMedData/ActivitySeries.hpp> 21 #include <fwMedData/SeriesDB.hpp> 23 #include <fwMedDataTools/helper/SeriesDB.hpp> 25 #include <fwServices/macros.hpp> 27 #include <fwTools/Os.hpp> 38 const ::fwCom::Slots::SlotKeyType SExportSeries::s_CHECK_ADDED_SERIES_SLOT =
"checkAddedSeries";
39 const ::fwCom::Slots::SlotKeyType SExportSeries::s_CHECK_REMOVED_SERIES_SLOT =
"CheckRemovesSeries";
41 const static std::string s_SERIESDB_INOUT =
"seriesDB";
47 newSlot(s_CHECK_ADDED_SERIES_SLOT, &SExportSeries::checkAddedSeries,
this);
48 newSlot(s_CHECK_REMOVED_SERIES_SLOT, &SExportSeries::checkRemovedSeries,
this);
80 ::fwMedData::SeriesDB::sptr seriesDB = this->getInOut< ::fwMedData::SeriesDB>(s_SERIESDB_INOUT);
82 for( ::fwMedData::Series::sptr series : seriesDB->getContainer() )
84 if(series == this->getSeries())
102 ::fwMedData::SeriesDB::sptr seriesDB = this->getInOut< ::fwMedData::SeriesDB>(s_SERIESDB_INOUT);
103 ::fwMedData::Series::sptr series = this->getSeries();
105 std::string description = series->getDescription();
107 ::fwMedData::ActivitySeries::sptr activitySeries = ::fwMedData::ActivitySeries::dynamicCast(series);
111 std::string
id = activitySeries->getActivityConfigId();
112 OSLM_ASSERT(
"Activity information not found for" <<
id, registry->hasInfo(
id));
115 activityInfo = registry->getInfo(
id);
117 description = activitySeries->getDescription();
118 if(description.empty())
120 description = activityInfo.description;
125 "Export activity",
"Enter the series description", description);
127 if(!description.empty())
129 ::fwMedData::DicomValuesType physicians = series->getPerformingPhysiciansName();
130 if(physicians.empty())
132 std::string username = ::fwTools::os::getEnv(
"USERNAME",
fwTools::os::getEnv(
"LOGNAME",
"Unknown"));
133 physicians.push_back(username);
136 series->setPerformingPhysiciansName(physicians);
137 series->setDescription(description);
140 seriesDBHelper.
add(series);
151 _sstream << std::string(
"SExportSeries");
156 ::fwMedData::Series::sptr SExportSeries::getSeries()
158 ::fwMedData::Series::sptr series = this->getInOut< ::fwMedData::Series>(
"series");
164 void SExportSeries::checkAddedSeries(::fwMedData::SeriesDB::ContainerType addedSeries)
166 for( ::fwMedData::Series::sptr series : addedSeries )
168 if(series == this->getSeries())
177 void SExportSeries::checkRemovedSeries(::fwMedData::SeriesDB::ContainerType removedSeries)
179 for( ::fwMedData::Series::sptr series : removedSeries )
181 if(series == this->getSeries())
The namespace uiMedDataQt contains editors for medical data.
Contains fwAtomsFilter::registry details.
This class is a helper to define the connections of a service and its data.
virtual FWGUI_API void setIsExecutable(bool isExecutable)
Set the action service executable or not.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Holds Activities configuration.
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
static FWACTIVITIES_API Activities::sptr getDefault()
Return the default global instance of Activities.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
This action allows to export the series specified in config to the SeriesDB. The export is performed ...
virtual UIMEDDATAQT_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
Defines the service interface managing the menu items.
static FWMEDDATA_APIconst::fwCom::Signals::SignalKeyType s_ADDED_SERIES_SIG
Type of signal when series are added.
static FWMEDDATA_APIconst::fwCom::Signals::SignalKeyType s_REMOVED_SERIES_SIG
Type of signal when series are added.
virtual UIMEDDATAQT_API ~SExportSeries() noexcept
Destructor.
virtual void updating() override
Adds the series specified by m_seriesId in the SeriesDB.
FWGUI_API void initialize()
Initialize the action.
virtual void stopping() override
Stops service. Does nothing.
virtual void starting() override
Starts service. If series associated with m_seriesId exists in SeriesDB, this action is not executabl...
virtual void info(std::ostream &_sstream) override
Write information in a stream.
virtual void configuring() override
This method is used to configure the service parameters.
UIMEDDATAQT_API SExportSeries()
Constructor.