7 #include "ctrlSelection/ImageUpdateAxis.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 12 #include <fwData/Float.hpp> 13 #include <fwData/Image.hpp> 15 #include <fwServices/macros.hpp> 17 #include <boost/algorithm/string/case_conv.hpp> 18 #include <boost/algorithm/string/trim.hpp> 23 static const ::fwCom::Slots::SlotKeyType s_UPDATE_SLICE_TYPE_SLOT =
"updateSliceType";
31 ImageUpdateAxis::ImageUpdateAxis() noexcept
37 ImageUpdateAxis::~ImageUpdateAxis() noexcept
43 void ImageUpdateAxis::updateSliceType(
int from,
int to)
45 if( to == static_cast< int > ( m_orientation ) )
50 else if(from == static_cast<int>(m_orientation))
81 ::fwRuntime::ConfigurationElement::sptr config =
m_configuration->findConfigurationElement(
"axis");
82 SLM_ASSERT(
"Problem with configuration for ImageUpdateAxis type, one element \"axis\" must be present",
m_configuration->findAllConfigurationElement(
83 "axis").size() == 1 );
85 SLM_FATAL_IF(
"The attribute \"uid\" is missing, it represents the fwID of the ::fwData::Float to update",
86 !config->hasAttribute(
"uid") );
87 m_floatID = config->getExistingAttributeValue(
"uid");
89 SLM_FATAL_IF(
"The attribute \"orientation\" is missing, it represents the image orientation " 90 "(axial, frontal or sagittal)", !config->hasAttribute(
"orientation") );
91 std::string orientation = config->getExistingAttributeValue(
"orientation");
92 ::boost::algorithm::trim(orientation);
93 ::boost::algorithm::to_lower(orientation);
95 if(orientation ==
"axial" )
97 m_orientation = ::fwDataTools::helper::MedicalImageAdaptor::Z_AXIS;
99 else if(orientation ==
"frontal" )
101 m_orientation = ::fwDataTools::helper::MedicalImageAdaptor::Y_AXIS;
103 else if(orientation ==
"sagittal" )
105 m_orientation = ::fwDataTools::helper::MedicalImageAdaptor::X_AXIS;
109 SLM_FATAL(
"The value for the xml element \"value\" can only be axial, frontal or sagittal.");
125 OSLM_ASSERT(
"Object " << m_floatID <<
" is not a valid ::fwData::Float", dataFloat);
127 dataFloat->value() = (float) m_orientation;
128 OSLM_TRACE(dataFloat->getID() <<
" new value : " << *dataFloat);
virtual CTRLSELECTION_API void info(std::ostream &_sstream) override
Implements info method derived from IService. Print classname.
virtual CTRLSELECTION_API KeyConnectionsType getObjSrvConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
#define OSLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual CTRLSELECTION_API void stopping() override
Does nothing.
#define OSLM_TRACE(message)
#define FW_DEPRECATED_MSG(message, version)
Use this macro when deprecating a function to warn the developer.
This service updates a fwData::Float given in configuration with the image axis.
#define SLM_FATAL(message)
This interface defines control service API. Does nothing particularly, can be considered as a default...
virtual CTRLSELECTION_API void configuring() override
Configures the service.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
virtual CTRLSELECTION_API void updating() override
Updates the float from the image axis orientation.
::fwRuntime::ConfigurationElement::sptr m_configuration
Configuration element used to configure service internal state using a generic XML like structure TOD...
::fwCom::helper::SigSlotConnection::KeyConnectionsType KeyConnectionsType
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
#define SLM_FATAL_IF(message, cond)
virtual CTRLSELECTION_API void reconfiguring() override
Does nothing.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
This class defines an image.
The namespace ctrlSelection contains several interfaces for manager, updater and wrapper.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_TYPE_MODIFIED_SIG
Type of signal when image's buffer is added.
virtual CTRLSELECTION_API void swapping() override
Does nothing.
virtual CTRLSELECTION_API void starting() override
Calls updating().