Hi Miklos,
wow, I'm really happy that finally someone is using the property services. Hope
you'll like them. :)
It is not possible to call us::GetModuleContext() from a plugin. Instead, just
use the ctkPluginContext. It is a parameter of the start() method of your
plugin activator class. If you need access to the context from other classes in
your plugin, you need to store the context in a static class variable and make
it accessible through a static class function.
See the activator class of the properties plugin for an example. I wrote a
little templated helper function for convenient access to the property services
which you can find in mitkGetPropertyService.h (in the same folder as the
properties view activator class files). Instead of using the mitk::CoreServices
class you would write:
mitk::IPropertyExtensions* extensions =
mitk::GetPropertyService<mitk::IPropertyExtensions>();
if (extensions != NULL)
{
// ...
}
Best,
Stefan
PS (FYI): You can control how the properties view should use the property
services in its preferences.
________________________________________
Von: Miklos Espak [[email protected]]
Gesendet: Sonntag, 30. März 2014 21:37
An: mitk-users
Betreff: [mitk-users] registering property extensions from a plugin
Hi,
we'd like to add a [0.0, 1.0] range constraint for an opacity property.
We did this in our plugin that all our applications depend on:
mitk::IPropertyExtensions* propertyExtensions =
mitk::CoreServices::GetPropertyExtensions();
mitk::FloatPropertyExtension::Pointer opacityPropertyExtension =
mitk::FloatPropertyExtension::New(0.0, 1.0);
propertyExtensions->AddExtension("Image Rendering.Lowest Value Opacity",
opacityPropertyExtension.GetPointer());
propertyExtensions->AddExtension("Image Rendering.Highest Value Opacity",
opacityPropertyExtension.GetPointer());
propertyExtensions->AddExtension("black opacity",
opacityPropertyExtension.GetPointer());
But this causes the following linker error:
[ 90%] Building CXX object
Code/Gui/MITK/Plugins/uk.ac.ucl.cmic.gui.qt.commonapps/CMakeFiles/uk_ac_ucl_cmic_gui_qt_commonapps.dir/src/QmitkCommonAppsApplicationPlugin.cxx.o
Linking CXX shared library
../../../../../bin/plugins/libuk_ac_ucl_cmic_gui_qt_commonapps.dylib
Undefined symbols for architecture x86_64:
"us::GetModuleContext()", referenced from:
QmitkCommonAppsApplicationPlugin::QmitkCommonAppsApplicationPlugin()in
QmitkCommonAppsApplicationPlugin.cxx.o
QmitkCommonAppsApplicationPlugin::QmitkCommonAppsApplicationPlugin()in
QmitkCommonAppsApplicationPlugin.cxx.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make[2]: *** [bin/plugins/libuk_ac_ucl_cmic_gui_qt_commonapps.dylib] Error 1
make[1]: ***
[Code/Gui/MITK/Plugins/uk.ac.ucl.cmic.gui.qt.commonapps/CMakeFiles/uk_ac_ucl_cmic_gui_qt_commonapps.dir/all]
Error 2
make: *** [all] Error 2
20:34:02: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project NIFTK (kit: Debug)
When executing step 'Make'
Is there a way to access the property extensions from a plugin?
Thanks,
Miklos
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users