7 #include "scene2D/adaptor/STransferFunction.hpp" 9 #include <fwCom/Signal.hpp> 10 #include <fwCom/Signal.hxx> 11 #include <fwCom/Slot.hpp> 12 #include <fwCom/Slot.hxx> 14 #include <fwData/Composite.hpp> 15 #include <fwData/String.hpp> 17 #include <fwDataTools/fieldHelper/Image.hpp> 18 #include <fwDataTools/fieldHelper/MedicalImageHelpers.hpp> 19 #include <fwDataTools/helper/Image.hpp> 21 #include <fwRenderQt/data/InitQtPen.hpp> 22 #include <fwRenderQt/data/Viewport.hpp> 23 #include <fwRenderQt/Scene2DGraphicsView.hpp> 25 #include <fwServices/macros.hpp> 27 #include <QColorDialog> 28 #include <QGraphicsItemGroup> 38 static const ::fwServices::IService::KeyType s_TF_INOUT =
"tf";
39 static const ::fwServices::IService::KeyType s_VIEWPORT_INPUT =
"viewport";
45 m_pointIsCaptured(false),
46 m_capturedCircle(
nullptr),
63 const ConfigType config = this->
getConfigTree().get_child(
"config.<xmlattr>");
66 if (config.count(
"lineColor"))
71 if (config.count(
"circleColor"))
76 if (config.count(
"pointSize"))
78 m_pointSize = config.get<
float>(
"pointSize");
84 void STransferFunction::buildTFPoints()
87 ::fwData::TransferFunction::sptr selectedTF = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
88 SLM_ASSERT(
"inout '" + s_TF_INOUT +
"' is not defined", selectedTF);
94 ::fwData::TransferFunction::TFValuePairType minMax = selectedTF->getMinMaxTFValues();
95 ::fwData::TransferFunction::TFValueType wlMin = selectedTF->getWLMinMax().first;
96 ::fwData::TransferFunction::TFValueType window = selectedTF->getWindow();
97 ::fwData::TransferFunction::TFValueType width = minMax.second - minMax.first;
99 for(const ::fwData::TransferFunction::TFDataType::value_type& elt : selectedTF->getTFData())
101 ::fwData::TransferFunction::TFValueType val;
102 val = (elt.first - minMax.first) / width;
103 val = val * window + wlMin;
104 m_TFPoints[val] = elt.second;
110 void STransferFunction::buildCircles()
112 ::fwRenderQt::data::Viewport::sptr viewport = this->
getScene2DRender()->getViewport();
117 const double viewportHeight = viewport->getHeight();
118 const double viewportWidth = viewport->getWidth();
126 m_circleWidth = m_pointSize;
129 m_circleHeight = m_pointSize * viewportHeight / viewportWidth;
130 m_circleHeight /= viewportWidthRatio;
135 m_circleWidth *= ratio.first;
136 m_circleHeight *= ratio.second;
139 for(QGraphicsEllipseItem* circle : m_circles)
148 for(const ::fwData::TransferFunction::TFDataType::value_type& elt : m_TFPoints)
151 m_circles.push_back(this->buildCircle(elt.first, elt.second));
157 QGraphicsEllipseItem* STransferFunction::buildCircle(::fwData::TransferFunction::TFValueType value,
164 QGraphicsEllipseItem* circle =
new QGraphicsEllipseItem(
165 coord.first - m_circleWidth / 2,
166 coord.second - m_circleHeight / 2,
170 circle->setBrush(QBrush(QColor(color.
r*255, color.
g*255, color.
b*255)));
171 circle->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
172 circle->setPen(m_circlePen);
173 circle->setZValue( 3 );
180 void STransferFunction::buildLinesAndPolygons()
182 ::fwData::TransferFunction::sptr selectedTF = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
183 SLM_ASSERT(
"inout '" + s_TF_INOUT +
"' is not defined", selectedTF);
186 for( QGraphicsItem* linesAndPolygons : m_linesAndPolygons)
189 delete linesAndPolygons;
192 m_linesAndPolygons.clear();
194 if (selectedTF->getInterpolationMode() == ::fwData::TransferFunction::LINEAR)
196 this->buildLinearLinesAndPolygons();
200 this->buildNearestLinesAndPolygons();
201 if (!selectedTF->getIsClamped())
210 void STransferFunction::buildBounds()
212 ::fwRenderQt::data::Viewport::sptr viewport = this->
getScene2DRender()->getViewport();
214 const QGraphicsEllipseItem* beginCircle = m_circles.front();
215 const QGraphicsEllipseItem* endCircle = m_circles.back();
217 double x1 = viewport->getX() - 10;
218 double x2 = beginCircle->rect().x() + beginCircle->pos().x() + m_circleWidth /2;
219 double y = beginCircle->rect().y() + beginCircle->pos().y() + m_circleHeight / 2;
221 QGraphicsLineItem* line =
new QGraphicsLineItem(x1, y, x2, y);
222 line->setPen(m_linePen);
223 line->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
224 line->setZValue( 2 );
226 m_linesAndPolygons.push_back(line);
229 QVector<QPointF> vect;
230 vect.append(QPointF(line->line().x1(), 0));
231 vect.append(QPointF(line->line().x1(), line->line().y1()));
232 vect.append(QPointF(line->line().x2(), line->line().y2()));
233 vect.append(QPointF(line->line().x2(), 0));
235 QGraphicsPolygonItem* poly =
new QGraphicsPolygonItem( QPolygonF( vect ) );
238 poly->setBrush( beginCircle->brush() );
239 poly->setOpacity(0.8);
240 poly->setPen(QPen(Qt::NoPen));
241 poly->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
242 poly->setZValue( 1 );
245 m_linesAndPolygons.push_back(poly);
247 x1 = endCircle->rect().x() + endCircle->pos().x() + m_circleWidth /2;
248 x2 = viewport->getX() + viewport->getWidth() + 10;
249 y = endCircle->rect().y() + endCircle->pos().y() + m_circleHeight / 2;
251 QGraphicsLineItem* line2 =
new QGraphicsLineItem(x1, y, x2, y);
252 line2->setPen(m_linePen);
253 line2->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
254 line2->setZValue( 2 );
256 m_linesAndPolygons.push_back(line2);
259 QVector<QPointF> vect2;
260 vect2.append(QPointF(line2->line().x1(), 0));
261 vect2.append(QPointF(line2->line().x1(), line2->line().y1()));
262 vect2.append(QPointF(line2->line().x2(), line2->line().y2()));
263 vect2.append(QPointF(line2->line().x2(), 0));
265 QGraphicsPolygonItem* poly2 =
new QGraphicsPolygonItem( QPolygonF( vect2 ) );
268 poly2->setBrush( endCircle->brush() );
269 poly2->setOpacity(0.8);
270 poly2->setPen(QPen(Qt::NoPen));
271 poly2->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
272 poly2->setZValue( 1 );
275 m_linesAndPolygons.push_back(poly2);
280 void STransferFunction::buildLinearLinesAndPolygons()
282 SLM_ASSERT(
"Circles must not be empty", !m_circles.empty());
284 ::fwData::TransferFunction::sptr selectedTF = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
285 SLM_ASSERT(
"inout '" + s_TF_INOUT +
"' is not defined", selectedTF);
287 ::fwRenderQt::data::Viewport::sptr viewport = this->
getScene2DRender()->getViewport();
289 QVector<QPointF> vect;
290 QLinearGradient grad;
292 const QGraphicsEllipseItem* firtsCircle = m_circles.front();
293 const QGraphicsEllipseItem* lastCircle = m_circles.back();
297 xBegin = firtsCircle->rect().x() + firtsCircle->pos().x() + m_circleWidth / 2;
298 xEnd = lastCircle->rect().x() + lastCircle->pos().x() + m_circleWidth / 2;
299 if (selectedTF->getIsClamped())
301 vect.append(QPointF(xBegin, 0));
305 if (xBegin > viewport->getX())
307 xBegin = viewport->getX()-10;
308 vect.append(QPointF(xBegin, 0));
309 vect.append(QPointF(xBegin, firtsCircle->rect().y() + firtsCircle->pos().y() + m_circleHeight / 2));
313 vect.append(QPointF(xBegin, 0));
315 if (xEnd < viewport->getX() + viewport->getWidth())
317 xEnd = viewport->getX() + viewport->getWidth() +10;
321 grad.setColorAt(0, firtsCircle->brush().color());
323 grad.setStart( xBegin, 0);
324 grad.setFinalStop( xEnd, 0 );
326 double distanceMax = xEnd - xBegin;
329 for (
auto circleIt = m_circles.cbegin(); circleIt != m_circles.cend()-1; ++circleIt)
331 QPointF p1((*circleIt)->rect().x() + (*circleIt)->pos().x() + m_circleWidth / 2,
332 (*circleIt)->rect().y() + (*circleIt)->pos().y() + m_circleHeight / 2);
333 QPointF p2((*(circleIt + 1))->rect().
x() + (*(circleIt + 1))->pos().
x() + m_circleWidth / 2,
334 (*(circleIt + 1))->rect().y() + (*(circleIt + 1))->pos().y() + m_circleHeight / 2);
340 grad.setColorAt((p1.x() - xBegin)/distanceMax, (*circleIt)->brush().color());
343 if (!selectedTF->getIsClamped())
345 if (xEnd == viewport->getX() + viewport->getWidth() + 10)
347 vect.append(QPointF(xEnd, lastCircle->rect().y() + lastCircle->pos().y() + m_circleHeight / 2));
349 double lastCircleX = lastCircle->rect().x() + lastCircle->pos().x() + m_circleWidth / 2;
350 grad.setColorAt((lastCircleX-xBegin)/distanceMax, lastCircle->brush().color());
352 vect.append(QPointF(xEnd, 0));
353 grad.setColorAt(1, lastCircle->brush().color());
355 QGraphicsPolygonItem* poly =
new QGraphicsPolygonItem( QPolygonF( vect ) );
357 poly->setBrush( QBrush( grad ) );
358 poly->setOpacity(0.8);
359 poly->setPen(m_linePen);
360 poly->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
361 poly->setZValue( 1 );
364 m_linesAndPolygons.push_back(poly);
369 void STransferFunction::buildNearestLinesAndPolygons()
372 for (
auto circleIt = m_circles.cbegin(); circleIt != m_circles.cend(); ++circleIt)
374 QGraphicsEllipseItem* circle = *circleIt;
375 QGraphicsEllipseItem* previousCircle;
376 if (circleIt == m_circles.cbegin())
378 previousCircle = circle;
382 previousCircle = *(circleIt-1);
384 QGraphicsEllipseItem* nextCircle;
385 if (circleIt == m_circles.cend()-1)
391 nextCircle = *(circleIt+1);
394 double x1 = previousCircle->rect().x() + previousCircle->pos().x() + (circle->pos().x() + circle->rect().x()
395 - (previousCircle->pos().x() +
396 previousCircle->rect().x()))/2 +
398 double x2 = circle->rect().x() + circle->pos().x() + (nextCircle->pos().x() + nextCircle->rect().x()
399 - (circle->pos().x() + circle->rect().x()))/2 +
401 double y = circle->rect().y() + circle->pos().y() + m_circleHeight / 2;
403 QGraphicsLineItem* line =
new QGraphicsLineItem(x1, y, x2, y);
404 line->setPen(m_linePen);
405 line->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
406 line->setZValue( 2 );
408 m_linesAndPolygons.push_back(line);
411 QVector<QPointF> vect;
412 vect.append(QPointF(line->line().x1(), 0));
413 vect.append(QPointF(line->line().x1(), line->line().y1()));
414 vect.append(QPointF(line->line().x2(), line->line().y2()));
415 vect.append(QPointF(line->line().x2(), 0));
417 QGraphicsPolygonItem* poly =
new QGraphicsPolygonItem( QPolygonF( vect ) );
420 poly->setBrush( circle->brush() );
421 poly->setOpacity(0.8);
422 poly->setPen(QPen(Qt::NoPen));
423 poly->setCacheMode( QGraphicsItem::DeviceCoordinateCache );
424 poly->setZValue( 1 );
427 m_linesAndPolygons.push_back(poly);
433 void STransferFunction::buildLayer()
436 for (
unsigned int i = 0; i < m_linesAndPolygons.size(); i++)
438 m_layer->addToGroup(m_linesAndPolygons.at(i));
441 for (
unsigned int i = 0; i < m_circles.size(); i++)
443 m_layer->addToGroup(m_circles.at(i));
456 void STransferFunction::updateImageTF()
459 ::fwData::TransferFunction::sptr selectedTF = this->getInOut< ::fwData::TransferFunction >(s_TF_INOUT);
460 SLM_ASSERT(
"inout '" + s_TF_INOUT +
"' is not defined", selectedTF);
462 ::fwData::TransferFunction::TFValuePairType minMax = selectedTF->getMinMaxTFValues();
463 ::fwData::TransferFunction::TFValueType window = selectedTF->getWindow();
464 ::fwData::TransferFunction::TFValueType wlMin = selectedTF->getWLMinMax().first;
465 ::fwData::TransferFunction::TFValueType val;
469 double width = minMax.second - minMax.first;
470 double min = m_TFPoints.begin()->first;
471 double max = m_TFPoints.rbegin()->first;
472 for(const ::fwData::TransferFunction::TFDataType::value_type& elt : m_TFPoints)
474 val = (elt.first - wlMin) / window;
475 val = val * width + minMax.first;
476 selectedTF->addTFColor(val, elt.second);
481 selectedTF->setWLMinMax(::fwData::TransferFunction::TFValuePairType(min, max));
485 selectedTF->setWLMinMax(::fwData::TransferFunction::TFValuePairType(max, min));
501 m_layer =
new QGraphicsItemGroup();
503 m_linePen.setCosmetic(
true );
504 m_linePen.setWidthF( 0 );
506 m_circlePen.setCosmetic(
true );
507 m_circlePen.setWidthF( 0 );
518 this->buildTFPoints();
519 this->buildCircles();
520 this->buildLinesAndPolygons();
529 for (
auto circleIt = m_circles.begin(); circleIt != m_circles.end(); ++circleIt )
535 for(
auto linesPolyIt = m_linesAndPolygons.begin(); linesPolyIt != m_linesAndPolygons.end(); ++linesPolyIt)
539 m_linesAndPolygons.clear();
550 SLM_ASSERT(
"Sizes of circles vector and tf points map are different", m_TFPoints.size() == m_circles.size());
552 QPoint scenePos = QPoint(_event.getCoord().getX(), _event.getCoord().getY());
554 QList<QGraphicsItem*> items = this->
getScene2DRender()->getView()->items(scenePos);
557 ::fwData::TransferFunction::TFDataType::iterator TFPointIt = m_TFPoints.begin();
558 for(QGraphicsEllipseItem* circle : m_circles)
560 if ( items.indexOf(circle) >= 0)
563 if ( _event.getType() == ::fwRenderQt::data::Event::MouseButtonDoubleClick )
565 this->doubleClickEvent(circle, TFPointIt->second);
569 else if ( _event.getType() == ::fwRenderQt::data::Event::MouseButtonPress
570 && _event.getButton() == ::fwRenderQt::data::Event::LeftButton )
573 this->leftButtonEvent(circle, _event);
576 else if ( _event.getType() == ::fwRenderQt::data::Event::MouseButtonPress
577 && _event.getButton() == ::fwRenderQt::data::Event::RightButton
578 && m_circles.size() > 2 )
580 this->rightButtonEvent(TFPointIt->first, _event);
585 if ( m_pointIsCaptured && m_capturedCircle == circle
586 && _event.getType() == ::fwRenderQt::data::Event::MouseMove )
588 this->mouseMoveEvent(circle, TFPointIt->first, _event);
592 else if ( m_pointIsCaptured && m_capturedCircle == circle
593 && _event.getType() == ::fwRenderQt::data::Event::MouseButtonRelease )
595 this->mouseButtonReleaseEvent(circle, _event);
602 if ( _event.getType() == ::fwRenderQt::data::Event::MouseButtonDoubleClick &&
603 _event.getButton() == ::fwRenderQt::data::Event::LeftButton )
606 this->doubleClickEvent(_event);
609 if( _event.getType() == ::fwRenderQt::data::Event::Resize)
614 if( oldSize.getWidth() == -1.0f )
619 if( oldSize.getHeight() == -1.0f )
633 const QColor shapeColor = ((QAbstractGraphicsShapeItem*)circle)->brush().color();
634 const QColor initialColor( shapeColor.red(), shapeColor.green(), shapeColor.blue(), tfColor.
a*255);
636 QColor circleColor = QColorDialog::getColor(initialColor,
638 QString(
"Choose the point color"),
639 QColorDialog::ShowAlphaChannel);
641 if (circleColor.isValid())
644 tfColor.
r = circleColor.redF();
645 tfColor.
g = circleColor.greenF();
646 tfColor.
b = circleColor.blueF();
647 tfColor.
a = circleColor.alphaF();
650 this->buildCircles();
651 this->buildLinesAndPolygons();
655 this->updateImageTF();
663 m_pointIsCaptured =
true;
666 m_capturedCircle = circle;
669 m_oldCoord = this->coordViewToCoordItem( _event.getCoord() );
672 QPen circlePen(Qt::yellow);
673 circlePen.setCosmetic(
true);
674 circle->setPen( circlePen );
676 _event.setAccepted(
true);
681 void STransferFunction::mouseMoveEvent(QGraphicsEllipseItem* circle,
682 ::fwData::TransferFunction::TFValueType tfPoint,
685 QGraphicsEllipseItem* lastPoint = m_circles.back();
687 std::vector< QGraphicsEllipseItem* >::iterator circleIt;
688 circleIt = std::find(m_circles.begin(), m_circles.end(), circle);
691 std::vector< QGraphicsEllipseItem* >::iterator previousCircle = circleIt;
692 if (circle != m_circles.front())
698 std::vector< QGraphicsEllipseItem* >::iterator nextCircle = circleIt;
699 if (circle != lastPoint)
708 const double previousXCircleRealPos = (*previousCircle)->rect().x() + (*previousCircle)->pos().x();
709 const double previousYRealNewPos = (*previousCircle)->rect().y() + (*previousCircle)->pos().y();
712 Point2DType previousXY(previousXCircleRealPos, previousYRealNewPos );
716 const double nextXCircleRealPos = (*nextCircle)->rect().x() + (*nextCircle)->pos().x();
717 const double nextYRealNewPos = (*nextCircle)->rect().y() + (*nextCircle)->pos().y();
720 const Point2DType nextXY(nextXCircleRealPos, nextYRealNewPos);
724 const double circleXRealNewPos = circle->rect().x() + circle->pos().x() + newCoord.getX() - m_oldCoord.getX();
725 const double circleYRealNewPos = circle->rect().y() + circle->pos().y() + newCoord.getY() - m_oldCoord.getY();
728 const Point2DType circleXY( circleXRealNewPos, circleYRealNewPos );
732 const Point2DType oldCoordXY( m_oldCoord.getX(), m_oldCoord.getY() );
736 const Point2DType newCoordXY( newCoord.getX(), newCoord.getY() );
740 if ( (circle == m_circles.front() || realValues.first > previousValues.first)
741 && (circle == lastPoint || realValues.first < nextValues.first)
742 && (realValues.second - m_circleHeight/2) >= 0
743 && (realValues.second - m_circleHeight/2) <= 1 )
746 circle->moveBy( newCoord.getX() - m_oldCoord.getX(), newCoord.getY() - m_oldCoord.getY() );
749 m_oldCoord = newCoord;
754 if ( ((circle != m_circles.front() && realValues.first < previousValues.first)
755 || (circle != lastPoint && realValues.first > nextValues.first))
756 && (realValues.second - m_circleHeight/2) >= 0
757 && (realValues.second - m_circleHeight/2) <= 1 )
760 double x = (newCoordPair.first > oldCoordPair.first) ? (nextValues.first - 1) : (previousValues.first + 1);
763 QRectF rect = circle->rect();
764 const double width = rect.width();
766 rect.setWidth( width );
767 circle->setRect( rect );
769 circle->setPos( 0, circle->pos().y() + (newCoord.getY() - m_oldCoord.getY()) );
771 m_oldCoord.setX( x );
772 m_oldCoord.setY(newCoord.getY());
776 if ( (circle == m_circles.front() || realValues.first > previousValues.first)
777 && (circle == lastPoint || realValues.first < nextValues.first)
778 && ((realValues.second - m_circleHeight/2) < 0 || (realValues.second - m_circleHeight/2) > 1) )
785 if( newCoordPair.second > oldCoordPair.second )
793 QRectF rect = circle->rect();
794 const double height = rect.height();
795 rect.setY( y - m_circleHeight / 2 );
796 rect.setHeight( height );
797 circle->setRect( rect );
799 circle->setPos( circle->pos().x() + (newCoord.getX() - m_oldCoord.getX()), 0);
802 m_oldCoord.setX(newCoord.getX());
803 m_oldCoord.setY( y );
807 this->buildLinesAndPolygons();
811 m_TFPoints.erase(tfPoint);
813 const Point2DType point(this->pointValue(circle), circle->rect().y() + circle->pos().y() + m_circleHeight / 2 );
818 circle->brush().color().redF(),
819 circle->brush().color().greenF(),
820 circle->brush().color().blueF(),
824 this->updateImageTF();
829 void STransferFunction::mouseButtonReleaseEvent(QGraphicsEllipseItem* circle, ::
fwRenderQt::data::Event& _event)
832 circle->setPen(m_circlePen);
833 m_pointIsCaptured =
false;
834 _event.setAccepted(
true);
839 void STransferFunction::rightButtonEvent(::fwData::TransferFunction::TFValueType tfPoint,
842 _event.setAccepted(
true);
845 m_TFPoints.erase(tfPoint);
847 this->updateImageTF();
857 const double y = this->
getScene2DRender()->mapToScene(_event.getCoord()).getY();
863 ::fwData::TransferFunction::TFDataType::iterator nextTFPointIt = m_TFPoints.begin();
864 ::fwData::TransferFunction::TFDataType::reverse_iterator lastTFPointIt = m_TFPoints.rbegin();
866 if (values.first < (*nextTFPointIt).first)
869 (*nextTFPointIt).second.b, values.second);
870 m_TFPoints[values.first] = color;
872 this->updateImageTF();
875 else if (values.first > (*lastTFPointIt).first)
878 (*lastTFPointIt).second.b, values.second);
879 m_TFPoints[values.first] = color;
881 this->updateImageTF();
887 while ((*nextTFPointIt).first < values.first)
891 ::fwData::TransferFunction::TFDataType::iterator prevTFPointIt = nextTFPointIt;
895 if ( (values.first != (*nextTFPointIt).first) && (values.first != (*prevTFPointIt).first) )
898 const double coef = (values.first - (*prevTFPointIt).first) /
899 ((*nextTFPointIt).first - (*prevTFPointIt).first);
902 const double newRed = coef * ((*nextTFPointIt).second.r - (*prevTFPointIt).second.r) +
903 (*prevTFPointIt).second.r;
904 const double newGreen = coef * ((*nextTFPointIt).second.g - (*prevTFPointIt).second.g) +
905 (*prevTFPointIt).second.g;
906 const double newBlue = coef * ((*nextTFPointIt).second.b - (*prevTFPointIt).second.b) +
907 (*prevTFPointIt).second.b;
908 const double newAlpha = coef * ((*nextTFPointIt).second.a - (*prevTFPointIt).second.a) +
909 (*prevTFPointIt).second.a;
914 this->updateImageTF();
922 double STransferFunction::pointValue(QGraphicsEllipseItem* circle)
925 return (circle->rect().x() + circle->pos().x() + m_circleWidth / 2);
Root class for all scene2d adaptors.
::fwRenderQt::data::Axis::sptr m_xAxis
The x Axis.
This class is a helper to define the connections of a service and its data.
ColorType r
red color (value [0,1])
std::pair< float, float > Scene2DRatio
<width, height>
Class allowing to block a Connection.
FWRENDERQT_API void initializeViewSize()
Initialize the source values used for computing view's size ratio.
ViewSizeRatio m_viewInitialSize
FWRENDERQT_API Point2DType mapAdaptorToScene(const Point2DType &_xy, const ::fwRenderQt::data::Axis::sptr &_xAxis, const ::fwRenderQt::data::Axis::sptr &_yAxis) const
FWRENDERQT_API std::shared_ptr< ::fwRenderQt::SRender > getScene2DRender() const
Get the render that manages the IAdaptor.
SCENE2D_API KeyConnectionsMap getAutoConnections() const override
Returns proposals to connect service slots to associated object signals, this method is used for obj/...
ColorType b
blue color (value [0,1])
std::pair< double, double > Point2DType
Point2D coordinate <X, Y>
static FWRENDERQT_API void setPenColor(QPen &_pen, std::string _color)
Set a pen a color.
SCENE2D_API void starting() override
SCENE2D_API STransferFunction() noexcept
Constructor, add handle events TRANSFERFUNCTION and WINDOWING.
ColorType a
alpha (value [0,1])
This bundles contains data and services used to display a 2D Qt scene.
virtual SCENE2D_API ~STransferFunction() noexcept
Basic destructor, do nothing.
UpdateSlotType::sptr m_slotUpdate
Slot to call update method.
FWRENDERQT_API Point2DType mapSceneToAdaptor(const Point2DType &_xy, const ::fwRenderQt::data::Axis::sptr &_xAxis, const ::fwRenderQt::data::Axis::sptr &_yAxis) const
IAdaptor implementation to display a transfer function.
#define SLM_ASSERT(message, cond)
work like 'assert' from 'cassert', with in addition a message logged by spylog (with FATAL loglevel) ...
FWRENDERQT_API void initializeViewportSize()
Initialize the source values used for computing viewport's size ratio.
SCENE2D_API void updating() override
::fwRenderQt::data::Axis::sptr m_yAxis
The y Axis.
SCENE2D_API void stopping() override
FWRENDERQT_API ViewportSizeRatio getViewportSizeRatio() const
Return the ratio between viewport's initial size and its current size.
FWRENDERQT_API void configureParams()
Parse the xml configuration for Axis, z value and opacity.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_MODIFIED_SIG
Key in m_signals map of signal m_sigModified.
ColorType g
green color (value [0,1])
SCENE2D_API void configuring() override
Configure the service before starting. Apply the configuration to service.
Macro for deep and shallow copies.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_WINDOWING_MODIFIED_SIG
Type of signal when points are modified.
This class manage events on the scene 2D (mouse event, keyboard event , ...).
static FWSERVICES_APIconst::fwCom::Slots::SlotKeyType s_UPDATE_SLOT
Slot to call start method.
static FWDATA_APIconst::fwCom::Signals::SignalKeyType s_POINTS_MODIFIED_SIG
Type of signal when points are modified.
SCENE2D_API void processInteraction(::fwRenderQt::data::Event &_event) override
FWSERVICES_API ConfigType getConfigTree() const
Return the configuration, in an boost property tree.