7 #include "uiMeasurement/action/ShowDistance.hpp" 9 #include <fwCom/Slot.hpp> 10 #include <fwCom/Slot.hxx> 11 #include <fwCom/Slots.hpp> 12 #include <fwCom/Slots.hxx> 14 #include <fwCore/base.hpp> 16 #include <fwData/Boolean.hpp> 17 #include <fwData/Point.hpp> 18 #include <fwData/PointList.hpp> 20 #include <fwDataTools/fieldHelper/Image.hpp> 21 #include <fwDataTools/fieldHelper/MedicalImageHelpers.hpp> 23 #include <fwServices/macros.hpp> 34 static const ::fwCom::Slots::SlotKeyType s_SHOW_DISTANCE_SLOT =
"showDistance";
36 static const ::fwServices::IService::KeyType s_IMAGE_INOUT =
"image";
40 ShowDistance::ShowDistance( ) noexcept
42 newSlot(s_SHOW_DISTANCE_SLOT, &ShowDistance::showDistance,
this);
47 ShowDistance::~ShowDistance() noexcept
55 _sstream <<
"Action for show distance" << std::endl;
62 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_IMAGE_INOUT);
66 image = this->getObject< ::fwData::Image >();
74 ::fwData::Boolean::sptr showDistances =
75 image->getField<
::fwData::Boolean >(
"ShowDistances", ::fwData::Boolean::New(
true));
76 bool isShown = showDistances->
value();
78 bool toShow = !isShown;
79 image->setField(
"ShowDistances", ::fwData::Boolean::New(toShow));
88 sig->asyncEmit(toShow);
95 void ShowDistance::showDistance(
bool)
97 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_IMAGE_INOUT);
101 image = this->getObject< ::fwData::Image >();
103 ::fwData::Boolean::sptr showDistances =
104 image->getField<
::fwData::Boolean >(
"ShowDistances", ::fwData::Boolean::New(
true));
#define FW_DEPRECATED_KEY(newKey, access, version)
Use this macro when deprecating a service key to warn the developer.
This class is a helper to define the connections of a service and its data.
FWGUI_API void actionServiceStarting()
Method called when the action service is starting.
Class allowing to block a Connection.
The namespace uiMeasurement contains actions to add/show/remove distances and landmarks.
FWGUI_API void actionServiceStopping()
Method called when the action service is stopping.
Defines the service interface managing the menu items.
void updating() override
Perform some computations according to object (this service is attached to) attribute values and its ...
T & value() noexcept
Get the value (mutable version).
virtual FWGUI_API void setIsActive(bool isActive)
Set the action service is active/inactive.
void info(std::ostream &_sstream) override
Write information in a stream.
void starting() override
Initialize the service activity.
FWGUI_API void initialize()
Initialize the action.
virtual UIMEASUREMENT_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
This class defines an image.
void configuring() override
Configure the service before starting. Apply the configuration to service.
This action allows to show/hide image distances.
This class contains a boolean value.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_DISTANCE_DISPLAYED_SIG
Type of signal when image's buffer is added.