![]() |
ImFusion SDK 4.3
|
#include <ImFusion/US/GlUltrasoundRuler.h>
OpenGL object that renders a ruler-like scale overlay on Ultrasound images. More...
Inheritance diagram for GlUltrasoundRuler:OpenGL object that renders a ruler-like scale overlay on Ultrasound images.
The object adapts to the conditions in the view, in particular, the zoom level. It is rendered to the side of the image.
The extent to which the ruler is rendered is governed by the FrameGeometry of the sweep or specific set geometry. The color can be adjusted with the default being white.
An indicator about the orientation of the scan as well as the focal depth can be displayed. The color of these can be adjusted with the default being orange. The position of the orientation indicator is determined from the FrameGeometry - it would be placed the top of the image beside the beginning of the image content. The focal depth is determined from the UltrasoundMetadata. If the metadata contains a region of interest (ROI), it would also be rendered.
The depth from which the ruler is rendered can be configured. The metric (mm, cm, etc) of the depth will always be rendered on top of the image. An optional text can be rendered above the metric. The metrics and the additional text take on the color of the ruler.
The user can set a different FrameGeometry or UltrasoundMetadata. The width of the ticks can also be adjusted.
The ruler is used in SweepDisplayDataController and StreamDisplayDataController. Example usage where the ruler is created and added to the view:
Public Member Functions | |
| GlUltrasoundRuler () | |
| Creates a new GlUltrasoundRuler with an initially empty sweep. | |
| void | draw (const GlView &view) override |
| Draw the object in 3D space. | |
| Geometry::AlignedBox | bounds () const override |
| Always returns empty bounds. | |
| std::string | typeName () const override |
| Return unique identifier for this object class used for serialization. | |
| void | setSweep (const UltrasoundSweep *sweep) |
| Sets the pointer to the US sweep we render the ruler for. | |
| void | setColor (const vec4 &color) |
| Sets the rendering color. | |
| void | setSecondaryColor (const vec4 &color) |
| Sets the rendering color of focal depth markers and orientation indicator. | |
| void | setTicksLineWidth (float lineWidth) |
| Sets the line width of ruler ticks in pixels. | |
| void | setRenderOrientationIndicator (bool value) |
| Sets the flag whether to render the orientation indicator. The indicator is a small triangle. | |
| void | setLabelText (std::string text) |
| Sets the text to be rendered on top of ruler. | |
| void | setDepthOffset (double distance) |
| Sets the depth offset in mm of the ruler with respect to the top of the image (i.e. | |
| void | setDrawOnRightSide (bool rightSide) |
| If set to true, the ruler will be drawn on the right side of the view. Otherwise, it would be to the left. | |
| void | setRenderFocalDepths (bool value) |
| Sets the flag whether to render the focal depths marks. | |
| void | setPerpendicularViewLateralOffset (double factor) |
| Sets the lateral offset in mm in perpendicular views. | |
| void | setRulerLengthTolerance (double tol) |
| Sets the ruler length tolerance, i.e. | |
| bool | compareImageDescriptor (const ImageDescriptor &desc) const |
| Returns whether the spacing and dimensions are the same for the given and the internal image descriptor. | |
| void | setImageWithGeometry (const ImageDescriptor &image, std::unique_ptr< US::FrameGeometry > geometry) |
| Sets the image descriptor we render the ruler for providing an additional US geometry descriptor. | |
| void | updateFromMetaData (const UltrasoundMetadata *meta) |
| Updates non-image-related meta data. meta may be nullptr. | |
Public Member Functions inherited from GlObject | |
| virtual Geometry::AlignedBox | boundsSpherical () const |
| Get the spherical bounds of this GlObject in world space. | |
| virtual void | setMatrix (const mat4 &m) |
| Set the modelview matrix of this object. | |
| virtual const mat4 & | matrix () const |
| Return the modelview matrix. | |
| virtual void | setVisible (bool visible) |
| Set object visibility. | |
| virtual bool | visible () const |
| Return object visibility. | |
| virtual void | setAlwaysVisible (bool alwaysVisible) |
| Set if object is always visible. | |
| virtual bool | alwaysVisible () const |
| Return if object is always visible. | |
| RenderingOrderGroup | renderingOrder () const |
| Return current rendering order value for this GlObject. | |
| void | setRenderingOrder (RenderingOrderGroup group) |
| Set rendering order value for this GlObject. | |
| void | setDraw3DIn2DView (bool draw3DIn2DView) |
| void | configure (const Properties *p) override |
| Configure this object instance by de-serializing the given Properties. | |
| void | configuration (Properties *p) const override |
| Serialize the current object configuration into the given Properties object. | |
Public Member Functions inherited from Configurable | |
| virtual void | configureDefaults () |
| Retrieve the properties of this object, replaces values with their defaults and sets it again. | |
| void | registerParameter (ParameterBase *param) |
| Register the given Parameter or SubProperty, so that it will be configured during configure()/configuration(). | |
| void | unregisterParameter (const ParameterBase *param) |
| Remove the given Parameter or SubProperty from the list of registered parameters. | |
| Configurable (const Configurable &rhs) | |
| Configurable (Configurable &&rhs) noexcept | |
| Configurable & | operator= (const Configurable &) |
| Configurable & | operator= (Configurable &&) noexcept |
Protected Member Functions | |
| void | renderLabel (GL::FixedFunctionPipeline &ffp, const std::string &text, const vec2 &position) |
| Renders a label with the given text at the given location. | |
Additional Inherited Members | |
Public Types inherited from GlObject | |
| enum | RenderingOrderGroup { RenderingGroupRest , RenderingGroupMesh , RenderingGroupManipulator } |
| Enumeration to determine rendering order of GlObjects in GlSliceView and GlVolumeView. More... | |
Public Attributes inherited from Configurable | |
| Signal | signalParametersChanged |
Emitted whenever one of the registered Parameters' or SubPropertys' signalValueChanged signal was emitted. | |
Protected Attributes inherited from GlObject | |
| mat4 | m_matrix = mat4::Identity() |
| Modelview transformation matrix of this object. | |
| bool | m_visible = true |
| Object visibility. | |
| bool | m_alwaysVisible = false |
| Object always visible. | |
| bool | m_draw3DIn2DView |
| Draw 3D objects in 2D views. This is to render 3D objects in projective 2D views. Property is not serialized. | |
| RenderingOrderGroup | m_renderingOrder = RenderingGroupRest |
Protected Attributes inherited from Configurable | |
| std::vector< Param > | m_params |
| List of all registered Parameter and SubProperty instances. | |
|
overridevirtual |
Always returns empty bounds.
Implements GlObject.
|
overridevirtual |
Return unique identifier for this object class used for serialization.
Implements GlObject.
| void setSweep | ( | const UltrasoundSweep * | sweep | ) |
Sets the pointer to the US sweep we render the ruler for.
If sweep is nullptr, GlUltrasoundRuler will not render anything. GlUltrasoundRuler does not take ownership.
| void setDepthOffset | ( | double | distance | ) |
Sets the depth offset in mm of the ruler with respect to the top of the image (i.e.
regularly with respect to the tip of the US transducer). Setting it to 20 mm will, for instance, let the ruler start with 2 cm instead of 0. Note that apart from this offset, also the start depth obtained from US metadata is used to displace the ruler. In fact, both of these offsets are applied in an additive fashion.
| void setPerpendicularViewLateralOffset | ( | double | factor | ) |
Sets the lateral offset in mm in perpendicular views.
While in the 2D view and in axial MPRs, the distance of the ruler from the center of the image is simply determined by the image size, such a measure does not work in non-axial/ perpendicular MPRs. There, the extent of the sweep relative to the focused US image can neither be quickly obtained from the sweep geometry itself, nor is it advisable to do so as a dynamic ruler positioning might irritate the user. This offset factor allows to define a static distance factor for a given application, default is 10.
| void setRulerLengthTolerance | ( | double | tol | ) |
Sets the ruler length tolerance, i.e.
the fraction of one ruler step by which the ruler may be longer than the actual geometry to make sure the last, depth-describing tick is included
|
protected |
Renders a label with the given text at the given location.
This function will cache rendered labels into textures for high-performance text rendering.