Hi Matt, in addition to Daniel's answer: Please see tutorial step 10 for detailed information of the interaction mechanism (connection between event IDs and actions) and how to implement / modify them. http://docs.mitk.org/nightly-qt4/Step10Page.html
According to state machine pattern "global" which is used for GlobalInteraction, all registered listeners get the event first and then the best interactor (highest return value on CanHandleEvent()) gets the event. Listeners don't change data, e.g. only change visualization of data, interactors change the data via operations to enable the undo-mechanism. Best regards, Ingmar -----Ursprüngliche Nachricht----- Von: Daniel Maleike [mailto:[email protected]] Gesendet: Mittwoch, 6. Juli 2011 16:37 An: [email protected] Betreff: Re: [mitk-users] Query on PointSet interactors, Statemachines and Segmentation Tools On 07/05/2011 10:23 AM, Matt Clarkson wrote: > Hi there, > > I would like to have a mitk::Tool subclass that can use seed points to > run a region growing algorithm on a per slice basis. Hi Matt, a couple of comment that might help you.. > > However, I'm not sure I understand how to do this. Each mitk::Tool is > itself a subclass of StateMachine, so when registered will receive > events. When I construct my mitk::Tool subclass, the constructor string > parameter determines the correct pattern of state machine. So, by way > of example, the mitkAddContourTool, inherits from mitkContourTool which > specifies PressMoveReleaseWithCTRLInversion, and in StateMachine.xml the > transition graph is defined, with certain actions. > > Question 1: How do these action ID's get converted to method calls? In > tools like mitk::AddContourTool, the methods that are called are > OnMousePressed, OnMouseMoved etc. http://docs.mitk.org/nightly-qt4/mitkSegTool2D_8cpp_source.html#l00036 The constructor of SegTool2D implements the switching to different methods. The methods used there were an alternative to implementing only a single large ExecuteAction(..) method with a large if/else switch. You can find the implementation of the CONNECT_ACTION macro in mitkStateMachine.h. I chose this version over the classical ExecuteAction for its clearer separation into methods. > > In addition, the MITK Tutorial Step5.cpp suggests that I can create a > point set interactor, registered with the global interactor, which will > add/remove points. > > Question 2: So, should I create a PointSetInteractor within my own > subclass of mitk::Tool? Which one will get the events first? Multiple possibilities here. My suggestion is to implement all the PointSet modifying code in your new tool and not use another interactor. Perhaps you can separate generic point set modifications from your specific logic, then you'd implement a tiny hierarchy of tools. The question which handler would get an event is a MITK classic with the short answer "probably both". ToolMangers register their tools as "listeners", interactors are mostly registered as "interactors". The logic in GlobalInteraction is (order is unsure): - forward incoming events to ALL known listeners - ask each registered interactor for its "relevance" via method CanHandleEvent. The interactor which return the highest number will receive the event > > I also tried in my mitk::Tool subclass, specifying in the constructor > the pattern PressMoveReleaseWithCTRLInversion and implementing methods > OnMousePressed and OnInvertLogic. So, when OnMousePressed was triggered, > I could add points to the point set and they were visualised, but then > when the control key was pressed, I couldnt remove them as PointSet > doesn't have a remove method. > > Question 3: So, does all interaction with a PointSet have to be done > with an interactor? I can't just remove points programmatically myself > from within a Tool? This surprises me. Without changing the implementation of PointSet, you could to the same thing that PointSetInteractor does: Please see http://docs.mitk.org/nightly-qt4/mitkPointSetInteractor_8cpp_source.html#l00444 It uses some kind of operations for adding and removing points, which makes such events undoable. Regards Daniel -- Dr. Daniel Maleike Telefon: + 49 6221 42 2326 Mint Medical GmbH Im Neuenheimer Feld 582, 69120 Heidelberg Geschäftsführer: Dr. Matthias Baumhauer Registergericht Mannheim, HRB 709351 ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ mitk-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mitk-users
