7 #include "visuVTKAdaptor/SImageText.hpp" 9 #include <fwCom/Slot.hpp> 10 #include <fwCom/Slot.hxx> 11 #include <fwCom/Slots.hpp> 12 #include <fwCom/Slots.hxx> 14 #include <fwData/Image.hpp> 15 #include <fwData/Integer.hpp> 17 #include <fwDataTools/fieldHelper/Image.hpp> 18 #include <fwDataTools/fieldHelper/MedicalImageHelpers.hpp> 19 #include <fwDataTools/helper/Image.hpp> 21 #include <fwServices/macros.hpp> 23 #include <boost/format.hpp> 25 #include <vtkRenderer.h> 26 #include <vtkTextActor.h> 35 static const ::fwCom::Slots::SlotKeyType s_UPDATE_SLICE_INDEX_SLOT =
"updateSliceIndex";
37 static const ::fwServices::IService::KeyType s_IMAGE_INOUT =
"image";
38 static const ::fwServices::IService::KeyType s_TF_INOUT =
"tf";
42 SImageText::SImageText() noexcept
50 SImageText::~SImageText() noexcept
60 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_IMAGE_INOUT);
62 ::fwData::TransferFunction::sptr tf = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
90 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_IMAGE_INOUT);
96 size_t axialIndex =
static_cast<size_t>(
m_axialIndex->value());
97 size_t frontalIndex =
static_cast<size_t>(
m_frontalIndex->value());
102 double min = tf->getLevel() - tf->getWindow()/2.0;
103 double max = tf->getLevel() + tf->getWindow()/2.0;
105 double window = max - min;
106 double level = min + window*0.5;
108 ss << ( ::boost::format(
"[% 3li,% 3li]") % min % max ) << std::endl;
109 ss << ( ::boost::format(
"W:% 3lg L:% 3lg") % window % level ) << std::endl;
110 ss << ( ::boost::format(
"(% 4li,% 4li,% 4li): %s") % sagittalIndex % frontalIndex % axialIndex %
114 this->setText(ss.str());
124 if (key == s_TF_INOUT)
126 ::fwData::TransferFunction::sptr tf = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
127 ::fwData::Image::sptr image = this->getInOut< ::fwData::Image >(s_IMAGE_INOUT);
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_SLICE_INDEX_MODIFIED_SIG
Type of signal when image's buffer is added.
void updateSliceIndex(int axial, int frontal, int sagittal)
Slot: update image slice index.
This class is a helper to define the connections of a service and its data.
The namespace visuVTKAdaptor contains the list of adaptors available for the generic scene...
virtual VISUVTKADAPTOR_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
virtual VISUVTKADAPTOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
virtual VISUVTKADAPTOR_API void starting() override
Initialize the service activity.
VISUVTKADAPTOR_API void stopping() override
Uninitialize the service activity. The stop() method is always invoked before destroying a service...
FWRENDERVTK_API void requestRender()
notify a render request iff vtkPipeline is modified
virtual void swapping()
Swap the service from associated object to another object.
FWRENDERVTK_API void setVtkPipelineModified()
End-user have to call this method when a vtk structure has been modified, thus a render request will ...
VISUVTKADAPTOR_API void updating() override
Perform some computations according to object (this service is attached to) attribute values and its ...
VISUVTKADAPTOR_API void starting() override
Initialize the service activity.
Adaptor to display window image information (width, heigth, picked position)
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
VISUVTKADAPTOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
virtual VISUVTKADAPTOR_API void updateTFWindowing(double window, double level) override
Update the text according to the new windowing.
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.
virtual VISUVTKADAPTOR_API void updateTFPoints() override
Update the text according to the new windowing.
virtual VISUVTKADAPTOR_API void configuring() override
Configure the service before starting. Apply the configuration to service.
static FWSERVICES_APIconst::fwCom::Slots::SlotKeyType s_UPDATE_SLOT
Slot to call start method.
Base class for VTK adaptors.