Hi Roman, short answer: rather use the ITK Command. see e.g. www.na-mic.org/Wiki/images/3/3d/Insight-Architecture.ppt <http://www.na-mic.org/Wiki/images/3/3d/Insight-Architecture.ppt> last few slides http://www.itk.org/pipermail/insight-users/2007-October/023836.html long answer: MITK has a non-gui dependent mitk-core and then depenting on this core a layer on top of it which is GUI-related (mostly QT (Qmitk)). Within the mitk, no GUI related classes should be included or used. If you are creating a class derived from QObject, you woul call it QmitkNameOfNewClass and put it somewhere in the Qmitk folder such as the Functionalities-folder. Now for the signal-slot feature, which you are looking for, I would suggest the itk::Command feature. It is GUI independent and thus can be used within mitk. Within your functionality you can connect your interactor to your gui class and send an event whenever it is needed. An example is implemented in mitkPointSet line 522 (http://www.mitk.org/documentation/doxygen/classmitk_1_1PointSet.html). Snipet with some docu: //create the event mitk::OperationEndEvent <http://www.mitk.org/documentation/doxygen/classmitk_1_1OperationEndEvent.html> endevent(operation); //send it to connected objects ((const itk::Object*)this)->InvokeEvent(endevent); Your Gui-object then can listen for the event. Best Regards, Ingmar ________________________________
Von: [EMAIL PROTECTED] im Auftrag von Roman Tulchiner Gesendet: So 08/24/08 13:49 An: [email protected] Betreff: Re: [mitk-users] emitting events from interactor Hi, I can suggest the following solution for using Qt's "signal-slot" with an mitk interactor. It's maybe not the coolest solution, but it is the one that works. First of all, the interactor should be placed locally in the directory where your functionality is. Otherwise "#include <qobject.h>" will fail (why? Maybe you know?). Than the interactor shouldn't have "MITK_CORE_EXPORT" makro, cause it's not a part of CORE any more. The interactor has to be derived from QObject and have "Q_OBJECT" in its declaration - just a usual procedure for using "signal-slot". Now you have to make sure, the corresponding meta object compiler file (moc) will be also created. To do so, just insert the line "your_ineractor_name".h into the "files.cmake" file of your functionality in the "SET( MOC_H_FILES" section. Now you can declare signals and slots and connect them e.g. with signals and slots of your functionality. If someone knows the solution, that fits better to the mitk environment, I would be glad to learn it. My regards, Roman Roman Tulchiner wrote: > Hallo everybody, > > is there a possibility to emit events (or signals or similar) from out > of mitk interactor? > > The following is a little sketch of what I'm trying to do: > > I have an interactor, which reads some parameters of a surface point > near the mouse click location. Reading is not a problem - so I have the > information I need within my interactor. Now I wish this information be > shown in the UI of my mitk functionality. > > I could certainly do it per "call-back". Like giving my interactor a > pointer to my functionality. So the interactor can directly notify the > functionality of new information. > But I would rather appreciate an "event-driven" approach with interactor > emitting an event if data is changed. > > I have tried it with Qt's "signal-slot". As I understand, if I want the > interactor to emit signals, I should derive it from QObject. But > "#include <qobject.h>" in my interactor breaks with a following compiler > error message: > 6>f:\mitk\src\core\interactions\PointNeighborhoodSelectInteractor.h(12) > : fatal error C1083: Cannot open include file: 'qobject.h': No such file > or directory > > So finally my question is :-) : > Isn't it possible to use Qt "signal-slots" from within mitk interactor? > Are there maybe some other "event-driven" approach provided, referenced > to my problem above? > > > Kind regards, > Roman > > ------------------------------------------------------------------------- > This SF.Net email is sponsored by the Moblin Your Move Developer's challenge > Build the coolest Linux based applications with Moblin SDK & win great prizes > Grand prize is a trip for two to an Open Source event anywhere in the world > http://moblin-contest.org/redirect.php?banner_id=100&url=/ > _______________________________________________ > mitk-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/mitk-users > ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
