ImFusion SDK 3.12
FAQ (Frequently Asked Questions)

I want to use the ImFusion SDK, how do I get started?

Please have a look at the available Tutorials/How-to Guides. These include directions on how to setup your build environment as well as guides to the essential concepts and data structures of the ImFusion SDK.

What is the correct way to initialize the ImFusionLib and its plugins?

Ordered initialization and deinitialization of the ImFusion SDK (e.g. factories, OpenGL context handling) is handled by the functions located in the Framework namespace. Have a look at the documentation of Framework::init() for a code example of proper initialization. If you want do use additional plugins you must initialize them correctly either individually using Framework::loadPlugin() or all plugins that can be found in a set of search paths using Framework::loadPlugins().

Warning
When linking directly against individual ImFusion plugins, you will still need to initialize it using the functions in the Framework namespace or the ApplicationController class. Though technically, you can initialize the plugin by instantiating its corresponding ImFusionPlugin class, this will not ensure that dependent parts or even the core ImFusionLib are initialized correctly.

The ImFusionLib will create its main OpenGL context in the thread which calls Framework::init(). All calls to the ImFusionLib API are expected to originate from this thread (see also Threading). Thus, it is usually appropriate to initialize the SDK from the main (GUI) thread.

As alternative to the free functions in the Framework namespace, you can use the ApplicationController class. Constructing an instance of ApplicationController can also take care of correctly initializing the ImFusionLib and its destruction will eventually deinitialize it again.

What are the matrix conventions within the ImFusion SDK?

For questions regarding matrix conventions, please refer to the page on Coordinate Systems.

How does the ImFusion SDK behave in a multi-threaded environment?

For questions regarding multi-threading within the ImFusion SDK, please refer to the page on Threading.

How can I synchronize images between their different representations?

Images can by synchronized across multiple locations (MemImage, GlImage, ClImage) using the SharedImage class. When wrapping an Image in a SharedImage it will take care of automatically converting between the different representations. The individual representations will be cached in the SharedImage so that the conversion happens only when necessary. When altering an image wrapped in a SharedImage, make sure to mark it as dirty so that the changes are propagated correctly to the other representations.

For more information, please have a look at the Tutorial on Image Data.

How can I link annotations to images?

By default, all annotations are specified in the world coordinate system. If you want to link a GlAnnotation to an image such that it is specified in the image coordinate system (i.e. when changing the image transformation, the annotation's transforms accordingly), you need to implement this manually. The easiest solution to this is to implement a TransformationListener and to subscribe to the transformationChanged event of the SharedImageSet. This enables you to keep the image's matrix and the annotation's matrix in sync.

Why are my views not visible when I call setVisible(true)?

The InteractiveView::setVisible method does not directly show a view but only asks the DisplayWidgetMulti to add it to the current layout. Depending on the current DisplayWidgetMulti::LayoutMode, the display might reject this request for a particular kind of view and the view stays hidden. A view is only consider visible if its InteractiveView::boundingRect is non-empty.

Another issue could be that the display does not have a size yet and therefore cannot assign a valid size to a view. In this case you might want to set a dummy size right after creating the display, e.g.:

auto display = std::make_unique<DisplayWidgetMulti>();
display->setCustomViewport(QRect(0, 0, 100, 100));
Search Tab / S to search, Esc to close