MAF Framework communication Msg send: OnEvent() Call Command execution Module separation: who send a message do not know the listener Logic Operation Manager Op
MAF What do the ‘App’ class? Create the parent frame of the application Make an instance of the logic Plug the views and the operations used inside the application Hide/Show the interface elements for the vertical application Terminate the application deleting the logic
MAF Logic: the application’s behavior Create and instance of each manager: mafViewManager, mafOpManager, mafVmeManager, mafInteractionManager Create the menu’ Create the toolbar Create the sidebar Create the timebar Create the log area Listen all the events raised from the managers and from the interface elements Call (virtual) methods to mange the events
MAF mafViewManager Create/Delete plugged views Manage view selection Add/Remove VMEs to/from the views Has knowledge about the selected view and selected VME
MAF mafOpManager Manage the operation execution Manage the undo stack Enable/Disable menu’ items and toolbar buttons according to the VME selected and to the operation execution
MAF mafVmeManager Add/Remove a VME to/from the tree Manage the file save, open, new Manage the file history Set the time to the VME tree
MAF mafInteractionManager Make a default instance of mouse device Manage interaction devices through DeviceManager Make an instance of the Positional Event Router (PER), used to interact dynamically with a device and the selected VME through VME’s behavior Make an instance of the Static Event Router (SER), used to interact statically with a device and a fixed VME
MAF How do the view work? Copy: make an instance of itself, set the listener to the mafViewManager and call method Create() Create: create the render window and create the view scene graph giving to it the information of which VMEs are creatable
MAF How do the view work? (2) VmeAdd/VmeRemove: add/remove a VME to the scene graph VmeCreatePipe/VmeDeletePipe: create/delete visualization pipeline for the VME that has to be shown/hidden (these are called by the mafSceneGraph on VmeShow call)
MAF How do the operation work? Copy: make a copy of itself OpRun: first method called by the mafOpManager; create the GUI for the operation OnEvent: listen the messages sent from the GUI OpStop: the operation is ending with wxOK or wxCANCEL, notify it to the OpManager OpDo: called if the operation is terminated with wxOK –the op is pushed inside the undo stack (if the m_canundo flag is true) OpUndo: called only when UnDo is required –The op is popped out from the undo stack –All the objects must be alive to establish previous situation
MAF VME CurrentDataPose MatrixVoid * ClientData mafVmeData class, created by Logic mflDataPipe: static vtk data or dynamically generated by a custom data pipe
MAF VME 4D data structure 4D data, positioned in space with a hierarchical organization VME Parent VME Matrix Array Data Array Attributes Current Time 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF VME 4D data structure The kind of data stored inside a node: VME Parent VME Matrix Array Data Array Attributes Current Time 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF VME 4D data structure Output: 4x4 matrix and VTK dataset VME Parent VME Matrix Array Data Array Attributes Current Time 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF VME 4D data structure VME consumers VME Parent VME Matrix Array Data Array Attributes Current Time 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF VME 4D data structure VME output changes according to input time VME Parent VME Matrix Array Data Array Attributes Current Time 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF VME 4D data structure Data manipulation by means of Operations VME Parent VME Matrix Array Data Array Attributes Current Time MAF Operation 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View
MAF Data Storage ROOT R-FemurL-Femur L-Tibia Storage VME Tree XML Hierarchy The VME tree is stored inside a folder as a single XML file (MSF file) storing hierarchy, pose and metadata, plus single data files of node’s data (VTK Datasets). Hierarchy Matrix Array Data Array Attributes
MAF VME Derived: Output Pipes New VME Parent VME Attributes VME GUI 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View Current Time Matrix PIPE Data PIPE Matrix Array Data Array MAF Operation VMEs can be customized to generated different output data and matrix using custom pipes.
MAF VME Derived: Custom GUI New VME Parent VME Attributes VME GUI 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View Current Time Matrix PIPE Data PIPE Matrix Array Data Array MAF Operation VMEs GUI can also be customized to set specific parameters…
MAF VME Derived: VME Links Links to other VME can be added to extend the tree into a Graph.
MAF VME Derived: VME Links (2) VME can listen to changes to linked VMES. VME Derived Parent VME Attributes MAF Operation 4x4 pose matrix 3D dataset Visual PIPE Render Window MAF View VME 2 VME 1 VME 3 Link Current Time Matrix PIPE Data PIPE
MAF VME Derived: VME Meter An example of VME Derived is the VME Meter: it’s a VME continuously computing the distance in between linked VMEs. VME Derived are sort of persistent operations which are saved in the data tree.
MAF MAF Interaction and Events Interaction inside MAF is accomplished by processing input events coming from GUI or input devices
MAF Discrete and Continuous Discrete Events: low frequency and typically causing application state change. Typically coming from GUI or discrete I/O device. Continuous Events: rised when user interacts inside views using a continuous input device, like a mouse or a tracker.
MAF MAF Interaction Model The typical MAF interaction model is composed by an event source (the device), an interpreter (the interactor) and a logic module (operations, logic or others) InteractorOperationDevice
MAF Events from Device Events coming from input devices are synchronized with the main application thread by Device Manager: Speech Mouse Tracker Haptic Device Manager S.E.R. Inter. Manager Async Events Sync Events
MAF Device Manager Responsible for devices: –Creation –Storing/Restoring of device setup –Input events synchronization
MAF Device Setup & Config
MAF Device Setup & Config Default devices User adds new devices
MAF Device Setup & Config Selected device settings Settings can be stored and restored
MAF Interaction with MAF Direct Interaction with devices: – Static Event Routing Interaction with objects in the scene: – Positional Event Routing
MAF Static Event Routing Interaction with devices is called “Static Event Routing”, where devices are assigned directly to “actions” by user, and interactors are connected to “actions” by application: Static Interactor Inter. Manager Logic Op Manager Running Op Static Event Routing Tracker Action S.E.R.
MAF SER Example Head Track Action S.E.R. Camera Interactor Current View Tracking device assigned to changing the point of view in the scene.
MAF Assign Device to Actions Static bindings of the device to the actions Actions are declared by application modules
MAF Actions declaration (for Ops) Define a GetActions() function in the operation returning the list of actions required by operation.
MAF Attach interactor to Action: Event IDAction Name Attach Interactors to Actions Interactor Action NameEvent ID Detach interactor from Action:
MAF Positional Event Routing A specialized interactor (P.E.R.), check where user is pointing in the view and routes events toward the interactor connected to the pointed object. S.E.R. P.E.R. View Manager Selected View Inter. Manager Logic VME ManagerOp Manager Pointed VME Behavior Running Op Positional Routing Camera Interactor
MAF Positional Event Routing (2) P.E.R. is an interactor statically assigned to “PointAndManipulate” action. Picking in the scene occurs only in response to “button down” events, therefore to be used with the P.E.R. an input device must be able to rise a button event.
MAF Attach Interactors to VME The interactor should be set in the m_behavior field of the VmeData object connected to the VME, which can be retrieved with GetClientData() function (MAF 1.x):
MAF Create a Mouse Interactor Create a Compositor Mouse interactor, and then use it to create interactors to be assigned to single mouse buttons: Mouse Compositor Interactor Translate Interactor Input Events Rotate Interactor Left Button Right Button Mouse
MAF Create a Mouse Interactor (2) Header file (Op.h): Left Button! Body file (.cpp)
MAF Exercise Open the ExampleApp project with Visual Studio 6 and: 1.Add visibility for mflVMELandmark type into mafViewCustom. 2.Change the visual pipe used to render the surfaces in mafPipeCustom
MAF Exercise Open the ExampleApp project and the mmoInteractonOp files and uncomment code to: 1.Declare a new Action 2.Create a mouse interactor 3.Attach mouse interactor to the action 4.Attach mouse interactor to the VME
MAF Ex: declare the new Action Uncomment code of GetAction() function inside the.cpp : also inside the.h file:
MAF Ex: Create the Interactor Uncomment code to create interactor in.cpp file: