7 #include "scene2D/processing/SComputeHistogram.hpp" 9 #include "scene2D/processing/ComputeHistogramFunctor.hxx" 11 #include <fwCom/Signal.hpp> 12 #include <fwCom/Signal.hxx> 13 #include <fwCom/Signals.hpp> 15 #include <fwData/Histogram.hpp> 16 #include <fwData/Image.hpp> 17 #include <fwData/mt/ObjectReadLock.hpp> 18 #include <fwData/mt/ObjectWriteLock.hpp> 20 #include <fwServices/macros.hpp> 22 #include <boost/lexical_cast.hpp> 31 static const ::fwServices::IService::KeyType s_IMAGE_INPUT =
"image";
32 static const ::fwServices::IService::KeyType s_HISTOGRAM_INPUT =
"histogram";
49 const std::vector < ::fwRuntime::ConfigurationElement::sptr > binsWidthCfg =
m_configuration->find(
"binsWidth");
50 SLM_ASSERT(
"Missing tag 'binsWidth'", !binsWidthCfg.empty());
52 const std::string binsWidth = binsWidthCfg.front()->getValue();
53 SLM_ASSERT(
"'binsWidth' must not be empty", !binsWidth.empty());
54 m_binsWidth = ::boost::lexical_cast<
float>(binsWidth);
68 ::fwData::Image::csptr image = this->getInput< ::fwData::Image>(s_IMAGE_INPUT);
74 ::fwData::Histogram::sptr histogram = this->getInOut< ::fwData::Histogram>(s_HISTOGRAM_INPUT);
80 param.histogram = histogram;
81 param.binsWidth = m_binsWidth;
This class is a helper to define the connections of a service and its data.
Class allowing to block a Connection.
A helper to lock object on read mode.
SCENE2D_API void starting() override
Starts the service. Calls updating().
A helper to lock object on exclusive mode.
virtual SCENE2D_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
SCENE2D_API void updating() override
Computes the histogram and notifies Histogram::s_MODIFIED_SIG.
This bundles contains data and services used to display a 2D Qt scene.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
This interface defines control service API. Does nothing particularly, can be considered as a default...
The SComputeHistogram service computes the histogram of the image.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
SCENE2D_API SComputeHistogram() noexcept
Constructor. Does nothing.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_BUFFER_MODIFIED_SIG
Type of signal when image's buffer is added.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
SCENE2D_API void swapping() override
Swaps the service. Calls updating().
SCENE2D_API void stopping() override
Stops the service. Does nothing.
static FWSERVICES_APIconst::fwCom::Slots::SlotKeyType s_UPDATE_SLOT
Slot to call start method.
virtual SCENE2D_API ~SComputeHistogram() noexcept
Destructor. Does nothing.
Parameters of the functor.
SCENE2D_API void configuring() override
Configure the service before starting. Apply the configuration to service.