diff --git a/Core/Code/Interactions/StateMachine.xml b/Core/Code/Interactions/StateMachine.xml
index af135a413c..e4ee5a9729 100644
--- a/Core/Code/Interactions/StateMachine.xml
+++ b/Core/Code/Interactions/StateMachine.xml
@@ -1,3684 +1,3715 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/Code/Interactions/mitkInteractionConst.h b/Core/Code/Interactions/mitkInteractionConst.h
index 464ecf16b9..b12336b962 100644
--- a/Core/Code/Interactions/mitkInteractionConst.h
+++ b/Core/Code/Interactions/mitkInteractionConst.h
@@ -1,741 +1,743 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef MITKINTERACTCONST_H
#define MITKINTERACTCONST_H
//##Documentation
//## @file mitkInteractionConst.h
//## @brief Constants for most interaction classes, due to the generic StateMachines.
//##
//## Changes in Type, ButtonState or Key has to be don in mitkEventMapper.cpp, too.
//## @ingroup Interaction
/*Prefixes for Constants:
E = Enumeration
EID = EventId's
Op = Operations
Ac = Action
Type_ = Type of Event
BS_ = ButtonStates and Buttons
Key_ = Keys like in QT
*/
namespace mitk{
//Constants for EventIds; use the according constant to through an event in the code
enum EEventIds
{
EIDNULLEVENT = 0,
EIDLEFTMOUSEBTN = 1,
EIDRIGHTMOUSEBTN = 2,
EIDLEFTMOUSEBTNANDSHIFT = 3,
EIDMIDDLEMOUSEBTN = 4,
EIDLEFTMOUSEBTNANDCTRL = 5,
EIDMIDDLEMOUSEBTNANDCTRL = 6,
EIDRIGHTMOUSEBTNANDCTRL = 7,
EIDLEFTMOUSEBTNDOUBLECLICK = 8,
EIDMOUSEWHEEL = 9,
EIDLEFTMOUSERELEASE = 505,
EIDMIDDLEMOUSERELEASE = 506,
EIDRIGHTMOUSERELEASE = 507,
EIDLEFTMOUSERELEASEANDSHIFT = 508,
EIDMOUSEMOVE = 520,
EIDLEFTMOUSEBTNANDMOUSEWHEEL = 521,
EIDRIGHTMOUSEBTNANDMOUSEWHEEL = 522,
EIDMIDDLEMOUSEBTNANDMOUSEWHEEL = 523,
EIDLEFTMOUSEBTNANDMOUSEMOVE = 530,
EIDRIGHTMOUSEBTNANDMOUSEMOVE = 531,
EIDMIDDLEMOUSEBTNANDMOUSEMOVE = 533,
EIDCTRLANDLEFTMOUSEBTNANDMOUSEMOVE = 534,
EIDCTRLANDRIGHTMOUSEBTNANDMOUSEMOVE = 535,
EIDCTRLANDMIDDLEMOUSEBTNANDMOUSEMOVE = 536,
EIDCTRLANDLEFTMOUSEBTNRELEASE = 537,
EIDCTRLANDRIGHTMOUSEBTNRELEASE = 538,
EIDCTRLANDMIDDLEMOUSEBTNRELEASE = 539,
EIDSHIFTANDCTRLANDMIDDLEMOUSEBTN = 540,
EIDSHIFTANDLEFTMOUSEBTNANDMOUSEMOVE = 541,
EIDSHIFTANDCTRLANDMOUSEMOVE = 542,
EIDSHIFTANDCTRLANDMOUSERELEASE = 543,
EIDALTANDLEFTMOUSEBTN = 600,
EIDALTANDLEFTMOUSEBTNANDMOUSEMOVE = 610,
EIDALTANDLEFTMOUSERELEASE = 620,
EIDSHIFTANDRIGHTMOUSEPRESS = 2000,
EIDSHIFTANDRIGHTMOUSEMOVE = 2001,
EIDSHIFTANDRIGHTMOUSERELEASE = 2002,
EIDSHIFTANDMIDDLEMOUSEPRESS = 2003,
EIDSHIFTANDMIDDLEMOUSEMOVE = 2004,
EIDSHIFTANDMIDDLEMOUSERELEASE = 2005,
EIDSPACENAVIGATORINPUT = 4001, // 3d Mouse, SpaceNavigator input
EIDSPACENAVIGATORKEYDOWN = 4002, // 3d Mouse, KeyDown
EIDWIIMOTEINPUT = 4003, // WiiMote input
EIDWIIMOTEBUTTON = 4004, // WiiMote home button
EIDWIIMOTEBUTTONB = 4005, // WiiMote b button
EIDSTRGANDN = 10,
EIDSTRGANDE = 11,
EIDDELETE = 12,
EIDN = 13,
EIDESCAPE = 14,
EIDP = 15,
EIDR = 16,
EIDT = 17,
EIDS = 18,
EIDE = 19,
EIDSTRGANDALTANDA = 20,
EIDSTRGANDALTANDB = 21,
EIDH = 22,
EIDRETURN = 23,
EIDENTER = 24,
EIDSPACE = 25,
EIDPLUS = 26,
EIDMINUS = 27,
EIDSTRGANDALTANDH = 30,
EIDSTRGANDALTANDI = 31,
EIDSTRGANDALTANDS = 40,
EIDALT = 90,
EIDSTRGANDB = 91,
EIDNEW = 1000,
EIDOLD = 1001,
EIDFINISHED = 1002,
EIDNO = 1003,
EIDYES = 1004,
EIDSAME = 1005,
EIDNOANDLASTOBJECT = 1006,
EIDNOANDNOTLASTOBJECT = 1007,
EIDLAST = 1008,
EIDNOTLAST = 1009,
EIDSTSMALERNMINUS1 = 1010,
EIDSTLARGERNMINUS1 = 1011,
EIDPOSITIONEVENT = 1012,
EIDEDIT = 1013,
EIDSMALLERN = 1014,
EIDEQUALSN = 1015,
EIDLARGERN = 1016,
EIDEMPTY = 1017,
EIDSUBDESELECT = 1020,
EIDSMTOSELECTED = 1030,
EIDSMTODESELECTED = 1031,
EIDTIP = 1050,
EIDHEAD = 1051,
EIDBODY = 1052,
EIDCLEAR = 1100,
EIDACTIVATETOOL = 1300,
EIDPRINT = 3001,
EV_INIT = 5551001,
EV_PREVIOUS = 5551002,
EV_PATH_COLLECTION_SELECTED = 5551003,
EV_NAVIGATION_SELECTED = 5551004,
EV_LESS_THEN_MIN_COUNT = 5551005,
EV_READY = 5551006,
EV_NEXT = 5551007,
EV_DONE = 5551008,
EV_NEW_LANDMARK = 5551009,
EV_REMOVE_LANDMARK = 5551010,
- EIDINSIDE = 2500
+ EIDINSIDE = 2500,
+ EIDFIGUREHOVER = 12340,
+ EIDNOFIGUREHOVER = 12341
};
//##Constants for Operations
//## xomments are always examples of the usage
enum EOperations
{
OpNOTHING = 0,
OpTEST = 1,
OpNEWCELL = 10, //add a new cell
OpADD = 100, //add a point or a vessel
OpUNDOADD = 101,
OpADDLINE = 1001, //add a line
OpINSERT = 200, //insert a point at position
OpINSERTLINE = 201, //insert a line at position
OpINSERTPOINT = 202,
OpCLOSECELL = 250, //close a cell (to a polygon)
OpOPENCELL = 251, //close a cell (to a polygon)
OpMOVE = 300, //move a point
OpMOVELINE = 301, //move a line
OpMOVECELL = 302, //move a line
OpUNDOMOVE = 303,
OpMOVEPOINTUP = 304,
OpMOVEPOINTDOWN = 305,
OpREMOVE = 400, //remove a point at position
OpREMOVELINE = 401, //remove a line at position
OpREMOVECELL = 402, //remove a cell
OpREMOVEPOINT = 403,
OpDELETE = 500, //delete
OpDELETELINE = 501, //delete the last line in a cell
OpUNDELETE = 502,
OpDELETECELL = 505,
OpSTATECHANGE = 600, //change a state
OpTIMECHANGE = 601, //change a state
OpTERMINATE = 666, //change a state
OpSELECTPOINT = 700,
OpSELECTLINE = 701,
OpSELECTCELL = 702,
OpSELECTSUBOBJECT = 703, //for VesselGraphInteractor
//OpSELECTNEWSUBOBJECT = 704, //for VesselGraphInteractor
OpSELECT = 705,
OpDESELECTPOINT = 800,
OpDESELECTLINE = 801,
OpDESELECTCELL = 802,
OpDESELECTSUBOBJECT = 803, //for VesselGraphInteractor
OpDESELECTALL = 804, //for VesselGraphInteractor
OpDESELECT = 805,
OpNAVIGATE = 900,
OpZOOM = 1000,
OpSCALE = 1100,
OpROTATE = 1200,
OpORIENT = 1201,
OpSETPOINTTYPE = 1210,
OpMODECHANGE = 1500,
OpSENDCOORDINATES = 1600,
OpPERIPHERYSEARCH = 2000, //used in VesselGraphInteractor
OpROOTSEARCH = 2001, //used in VesselGraphInteractor
OpTHICKSTVESSELSEARCH = 2002, //used in VesselGraphInteractor
OpSHORTESTPATHSEARCH = 2003, //used in VesselGraphInteractor
OpATTRIBUTATION = 2004, //used in VesselGraphInteractor
OpDEFAULT = 2006, //used in VesselGraphInteractor
OpSURFACECHANGED = 3000, // used for changing polydata in surfaces
};
//##Constants for EventMapping...
//##connects the statemachine.xml-File with the implemented conditions.
//##within one statemachine the choice of the actionconstants is freely
//##
//## ActionId
enum EActions
{
AcDONOTHING = 0,
AcINITNEWOBJECT = 5,
AcINITEDITOBJECT = 6,
AcINITEDITGROUP = 7,
AcINITMOVEMENT = 8,
AcINITMOVE = 9,
AcINITFOREGROUND = 45, // used in SeedsInteractor for setting the foreground seeds
AcINITBACKGROUND = 46, // used in SeedsInteractor for setting the background seeds
AcINITNEUTRAL = 47, // used in SeedsInteractor for setting the neutral seeds (rubber)
AcINITUPDATE = 1235, // For shape model deformation
AcADDPOINT = 10,
AcADD = 11,
AcADDLINE = 12,
AcADDANDFINISH = 13,
AcADDSELECTEDTOGROUP = 64,
AcCHECKPOINT = 21,
AcCHECKLINE = 22,
AcCHECKCELL = 23,
AcCHECKELEMENT = 30, // check if there is a element close enough (picking)
AcCHECKOBJECT = 31, // check if an object is hit
AcCHECKNMINUS1 = 32, // check if the number of elements is equal to N-1
AcCHECKEQUALS1 = 33, // check if the number of elements in the data is equal to 1
AcCHECKNUMBEROFPOINTS = 330, //check the number of elements in the data
AcCHECKSELECTED = 34, // check if the given element is selected or not
AcCHECKONESELECTED = 340, //check if there is an element that is selected
AcCHECKHOVERING = 341, //check if there is an element that is selected
AcCHECKGREATERZERO = 35, // check if the current number of elements is greater than 0
AcCHECKGREATERTWO = 36, // check if the current number of elements is greater than two
AcCHECKOPERATION = 37, // check if the operation is of one spectial type
AcCHECKONESUBINTERACTOR = 38,
AcCHECKSUBINTERACTORS = 39,
AcFINISHOBJECT = 40,
AcFINISHGROUP = 41,
AcFINISHMOVEMENT = 42,
AcFINISHMOVE = 43,
AcFINISH = 44,
AcSEARCHOBJECT = 50,
AcSEARCHGROUP = 51,
AcSEARCHANOTHEROBJECT = 52, // one object is selected and another object is to be added to selection
AcSELECTPICKEDOBJECT = 60, // select the picked object and deselect others
AcSELECTANOTHEROBJECT = 61,
AcSELECTGROUP = 62,
AcSELECTALL = 63,
AcSELECT = 65,
AcSELECTPOINT = 66,
AcSELECTLINE = 68,
AcSELECTCELL = 67,
AcSELECTSUBOBJECT = 69, // used in VesselGraphInteractor
AcDESELECTOBJECT = 70, // deselect picked from group
AcDESELECTALL = 72,
AcDESELECT = 75,
AcDESELECTPOINT = 76,
AcDESELECTLINE = 78,
AcDESELECTCELL = 77,
AcNEWPOINT = 80,
AcNEWSUBOBJECT = 81,
AcMOVEPOINT = 90,
AcMOVESELECTED = 91,
AcMOVE = 92,
AcMOVEPOINTUP = 93,
AcMOVEPOINTDOWN = 94,
AcREMOVEPOINT = 100,
AcREMOVE = 101,
AcREMOVELINE = 102,
AcREMOVEALL = 103,
AcREMOVESELECTEDSUBOBJECT = 104, // used in VesselGraphInteractor
AcWHEEL = 105,
AcPLUS = 106,
AcMINUS = 107,
AcDELETEPOINT = 120,
AcCLEAR = 130, // clear all elements from a list
AcINSERTPOINT = 110,
AcINSERTLINE = 111,
AC_SET_NEXT_BUTTON_VISIBLE = 5550001,
AC_SET_NEXT_BUTTON_INVISIBLE = 5550002,
AC_SET_PREVIOUS_BUTTON_VISIBLE = 5550003,
AC_SET_PREVIOUS_BUTTON_INVISIBLE = 5550004,
AC_SET_ASSISTAND_WIDGET_STECK = 5550005,
AC_SETMAX_COUNT_REF_POINTS = 5550006,
AC_SET_NEXT_BUTTON_TEXT = 5550007,
AC_CHECK_LANDMARK_COUNT = 5550008,
AC_SET_DONE_FALSE = 5550009,
AC_INIT = 55500010,
AC_SET_APPLICATION_SELECTED_FALSE = 55500011,
AC_SENSOR_ATTACHED = 55500012,
AC_CLOSE_ASSISTENT = 55500013,
AC_START_APPLICATION_TEXT = 55500014,
AC_START_NAVIGATION = 55500015,
AC_START_PATHCOLLECTION = 55500016,
AC_LOAD_LANDMARKS = 55500017,
AC_CALCULATE_LANDMARK_TRANSFORM = 55500018,
AcTERMINATE_INTERACTION = 666,
AcTRANSLATESTART = 1000,
AcTRANSLATE = 1001,
AcSCALESTART = 1002,
AcSCALE = 1003,
AcROTATESTART = 1004,
AcROTATE = 1005,
AcINITAFFINEINTERACTIONS = 1006,
AcFINISHAFFINEINTERACTIONS = 1007,
AcTRANSLATEEND = 1008,
AcSCALEEND = 1009,
AcROTATEEND = 1010,
AcINITZOOM = 1011,
AcZOOM = 1012,
AcSCROLL = 1013,
AcLEVELWINDOW = 1014,
AcSETSTARTPOINT = 1050,
AcMODEDESELECT = 1100, // set interactor in not selected mode
AcMODESELECT = 1101, // set interactor in selected mode
AcMODESUBSELECT = 1102, // set interacor in sub selected mode
AcINFORMLISTENERS = 1200, // GlobalInteraction
AcASKINTERACTORS = 1201, // GlobalInteraction
AcCHECKGREATERONE = 1500,
AcCHECKBOUNDINGBOX = 1510,
AcFORCESUBINTERACTORS = 1550,
AcSENDCOORDINATES = 1600,
AcTRANSMITEVENT = 2000, // to transmit an event to a lower Interactor/Statemachine
AcPERIPHERYSEARCH = 3000, // used in VesselGraphInteractor
AcROOTSEARCH = 3001, // used in VesselGraphInteractor
AcTHICKSTVESSELSEARCH = 3002, // used in VesselGraphInteractor
AcSHORTESTPATHSEARCH = 3003, // used in VesselGraphInteractor
AcSINGLE = 3004, // used in VesselGraphInteractor
AcATTRIBUTATION = 3005, // used in VesselGraphInteractor
AcDEFAULT = 3007, // used in VesselGraphInteractor
AcSETVESSELELEMENT = 3008, // used in VesselGraphInteractor
AcCHECKBARRIERSTATUS = 3010, // used in VesselGraphInteractor
AcUPDATEMESH = 1234, // For Shape Model Interaction
AcINCREASE = 49012,
AcDECREASE = 49013,
AcMODIFY = 49014,
AcUNDOUPDATE = 1236, // For restoring a mesh after an update
AcENTEROBJECT = 48000,
AcLEAVEOBJECT = 48001,
AcSWITCHOBJECT = 48002,
AcUPDATELINE = 48003,
AcINITLINE = 48004,
AcTERMINATELINE = 48005,
AcCREATEBOX = 48006,
AcCREATEOBJECTFROMLINE = 48007,
AcCANCEL = 48008,
AcACTIVATETOOL = 48009,
AcROTATEAROUNDPOINT1 = 49002,
AcROTATEAROUNDPOINT2 = 49003,
AcMOVEPOINT1 = 49004,
AcMOVEPOINT2 = 49005,
AcUPDATEPOINT = 49006,
AcDISPLAYOPTIONS = 49009,
AcCYCLE = 49010,
AcACCEPT = 49011,
AcONSPACENAVIGATORMOUSEINPUT = 4001, // On input of 3D Mouse
AcONPACENAVIGATORKEYDOWN = 4002, // On input of 3D Mouse
AcONWIIMOTEINPUT = 4003, // used for wiimote to signal IR input
AcRESETVIEW = 4004, // used for wiimote to reset view
AcONWIIMOTEBUTTONRELEASED = 4005, // stops the surface interaction
AcCHECKPOSITION = 5000,
AcINITIALIZECONTOUR = 5001,
AcCALCULATENEWSEGMENTATION_SP= 5002,
AcINTERACTOR = 5003,
AcCALCULATENEWSEGMENTATION_BB= 5004
};
/*
//!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!
//EventMechanism:
//If you change anything from here on, then change in mitkEventMapper.cpp (Array of constants) as well.
//!!!!!!!!!!!!!!!!!!!!!!!!
//!!!!!!!!!!!!!!!!!!!!!!!!
*/
//Type of an Event;
enum EEventType
{
Type_None = 0, // invalid event
Type_Timer = 1, // timer event
Type_MouseButtonPress = 2, // mouse button pressed
Type_MouseButtonRelease = 3, // mouse button released
Type_MouseButtonDblClick = 4, // mouse button double click
Type_MouseMove = 5, // mouse move
Type_KeyPress = 6, // key pressed
Type_KeyRelease = 7, // key released
Type_FocusIn = 8, // keyboard focus received
Type_FocusOut = 9, // keyboard focus lost
Type_Enter = 10, // mouse enters widget
Type_Leave = 11, // mouse leaves widget
Type_Paint = 12, // paint widget
Type_Move = 13, // move widget
Type_Resize = 14, // resize widget
Type_Create = 15, // after object creation
Type_Destroy = 16, // during object destruction
Type_Show = 17, // widget is shown
Type_Hide = 18, // widget is hidden
Type_Close = 19, // request to close widget
Type_Quit = 20, // request to quit application
Type_Reparent = 21, // widget has been reparented
Type_ShowMinimized = 22, // widget is shown minimized
Type_ShowNormal = 23, // widget is shown normal
Type_WindowActivate = 24, // window was activated
Type_WindowDeactivate = 25, // window was deactivated
Type_ShowToParent = 26, // widget is shown to parent
Type_HideToParent = 27, // widget is hidden to parent
Type_ShowMaximized = 28, // widget is shown maximized
Type_ShowFullScreen = 29, // widget is shown full-screen
Type_Accel = 30, // accelerator event
Type_Wheel = 31, // wheel event
Type_AccelAvailable = 32, // accelerator available event
Type_CaptionChange = 33, // caption changed
Type_IconChange = 34, // icon changed
Type_ParentFontChange = 35, // parent font changed
Type_ApplicationFontChange = 36, // application font changed
Type_ParentPaletteChange = 37, // parent palette changed
Type_ApplicationPaletteChange = 38, // application palette changed
Type_PaletteChange = 39, // widget palette changed
Type_Clipboard = 40, // internal clipboard event
Type_Speech = 42, // reserved for speech input
Type_SockAct = 50, // socket activation
Type_AccelOverride = 51, // accelerator override event
Type_DeferredDelete = 52, // deferred delete event
Type_DragEnter = 60, // drag moves into widget
Type_DragMove = 61, // drag moves in widget
Type_DragLeave = 62, // drag leaves or is cancelled
Type_Drop = 63, // actual drop
Type_DragResponse = 64, // drag accepted/rejected
Type_ChildInserted = 70, // new child widget
Type_ChildRemoved = 71, // deleted child widget
Type_LayoutHint = 72, // child min/max size changed
Type_ShowWindowRequest = 73, // widget's window should be mapped
Type_ActivateControl = 80, // ActiveX activation
Type_DeactivateControl = 81, // ActiveX deactivation
Type_ContextMenu = 82, // context popup menu
Type_IMStart = 83, // input method composition start
Type_IMCompose = 84, // input method composition
Type_IMEnd = 85, // input method composition end
Type_Accessibility = 86, // accessibility information is requested
Type_TabletMove = 87, // Wacom tablet event
Type_LocaleChange = 88, // the system locale changed
Type_LanguageChange = 89, // the application language changed
Type_LayoutDirectionChange = 90, // the layout direction changed
Type_Style = 91, // internal style event
Type_TabletPress = 92, // tablet press
Type_TabletRelease = 93, // tablet release
Type_User = 1000, // first user event id
Type_SpaceNavigatorInput = 1094, // 3D mouse input occured
Type_SpaceNavigatorKeyDown = 1095, // 3D mouse input occured
Type_WiiMoteInput = 1096, // WiiMote input occured
Type_WiiMoteButton= 1097, // WiiMote button pressed
Type_MaxUser = 65535
};
//##ButtonState
// mouse/keyboard state values
//QT combinations if MOUSEBUTTONRelease: left MouseButton + ControlButton: 0x201
enum EButtonStates
{
BS_NoButton = 0x0000,
BS_LeftButton = 0x0001,
BS_RightButton = 0x0002,
BS_MidButton = 0x0004,
BS_MouseButtonMask = 0x0007,
BS_ShiftButton = 0x0100,
BS_ControlButton = 0x0200,
BS_AltButton = 0x0400,
BS_MetaButton = 0x0800,
BS_KeyButtonMask = 0x0f00,
BS_Keypad = 0x4000
};
//##Key
enum EKeys
{
Key_Escape = 0x1000, // misc keys
Key_Tab = 0x1001,
Key_Backtab = 0x1002,
Key_BackTab = 0x1002, //= Key_Backtab
Key_Backspace = 0x1003,
Key_BackSpace = 0x1003, //= Key_Backspace
Key_Return = 0x1004,
Key_Enter = 0x1005,
Key_Insert = 0x1006,
Key_Delete = 0x1007,
Key_Pause = 0x1008,
Key_Print = 0x1009,
Key_SysReq = 0x100a,
Key_Home = 0x1010, // cursor movement
Key_End = 0x1011,
Key_Left = 0x1012,
Key_Up = 0x1013,
Key_Right = 0x1014,
Key_Down = 0x1015,
Key_Prior = 0x1016,
Key_PageUp = 0x1016, //=Key_Prior
Key_Next = 0x1017,
Key_PageDown = 0x1017, //=Key_Next
Key_Shift = 0x1020, // modifiers
Key_Control = 0x1021,
Key_Meta = 0x1022,
Key_Alt = 0x1023,
Key_CapsLock = 0x1024,
Key_NumLock = 0x1025,
Key_ScrollLock = 0x1026,
Key_F1 = 0x1030, // function keys
Key_F2 = 0x1031,
Key_F3 = 0x1032,
Key_F4 = 0x1033,
Key_F5 = 0x1034,
Key_F6 = 0x1035,
Key_F7 = 0x1036,
Key_F8 = 0x1037,
Key_F9 = 0x1038,
Key_F10 = 0x1039,
Key_F11 = 0x103a,
Key_F12 = 0x103b,
Key_F13 = 0x103c,
Key_F14 = 0x103d,
Key_F15 = 0x103e,
Key_F16 = 0x103f,
Key_F17 = 0x1040,
Key_F18 = 0x1041,
Key_F19 = 0x1042,
Key_F20 = 0x1043,
Key_F21 = 0x1044,
Key_F22 = 0x1045,
Key_F23 = 0x1046,
Key_F24 = 0x1047,
Key_F25 = 0x1048, // F25 .. F35 only on X11
Key_F26 = 0x1049,
Key_F27 = 0x104a,
Key_F28 = 0x104b,
Key_F29 = 0x104c,
Key_F30 = 0x104d,
Key_F31 = 0x104e,
Key_F32 = 0x104f,
Key_F33 = 0x1050,
Key_F34 = 0x1051,
Key_F35 = 0x1052,
Key_Super_L = 0x1053, // extra keys
Key_Super_R = 0x1054,
Key_Menu = 0x1055,
Key_Hyper_L = 0x1056,
Key_Hyper_R = 0x1057,
Key_Help = 0x1058,
// International input method support (X keycode - = 0xEE00)
// Only interesting if you are writing your own input method
Key_Muhenkan = 0x1122, // Cancel Conversion
Key_Henkan = 0x1123, // Start/Stop Conversion
Key_Hiragana_Katakana = 0x1127, // Hiragana/Katakana toggle
Key_Zenkaku_Hankaku = 0x112A, // Zenkaku/Hankaku toggle
Key_Space = 0x20, // 7 bit printable ASCII
Key_Any = 0x20, //= Key_Space
Key_Exclam = 0x21,
Key_QuoteDbl = 0x22,
Key_NumberSign = 0x23,
Key_Dollar = 0x24,
Key_Percent = 0x25,
Key_Ampersand = 0x26,
Key_Apostrophe = 0x27,
Key_ParenLeft = 0x28,
Key_ParenRight = 0x29,
Key_Asterisk = 0x2a,
Key_Plus = 0x2b,
Key_Comma = 0x2c,
Key_Minus = 0x2d,
Key_Period = 0x2e,
Key_Slash = 0x2f,
Key_0 = 0x30,
Key_1 = 0x31,
Key_2 = 0x32,
Key_3 = 0x33,
Key_4 = 0x34,
Key_5 = 0x35,
Key_6 = 0x36,
Key_7 = 0x37,
Key_8 = 0x38,
Key_9 = 0x39,
Key_Colon = 0x3a,
Key_Semicolon = 0x3b,
Key_Less = 0x3c,
Key_Equal = 0x3d,
Key_Greater = 0x3e,
Key_Question = 0x3f,
Key_At = 0x40,
Key_A = 0x41,
Key_B = 0x42,
Key_C = 0x43,
Key_D = 0x44,
Key_E = 0x45,
Key_F = 0x46,
Key_G = 0x47,
Key_H = 0x48,
Key_I = 0x49,
Key_J = 0x4a,
Key_K = 0x4b,
Key_L = 0x4c,
Key_M = 0x4d,
Key_N = 0x4e,
Key_O = 0x4f,
Key_P = 0x50,
Key_Q = 0x51,
Key_R = 0x52,
Key_S = 0x53,
Key_T = 0x54,
Key_U = 0x55,
Key_V = 0x56,
Key_W = 0x57,
Key_X = 0x58,
Key_Y = 0x59,
Key_Z = 0x5a,
Key_BracketLeft = 0x5b,
Key_Backslash = 0x5c,
Key_BracketRight = 0x5d,
Key_AsciiCircum = 0x5e,
Key_Underscore = 0x5f,
Key_QuoteLeft = 0x60,
Key_BraceLeft = 0x7b,
Key_Bar = 0x7c,
Key_BraceRight = 0x7d,
Key_AsciiTilde = 0x7e,
Key_nobreakspace = 0x0a0,
Key_exclamdown = 0x0a1,
Key_cent = 0x0a2,
Key_sterling = 0x0a3,
Key_currency = 0x0a4,
Key_yen = 0x0a5,
Key_brokenbar = 0x0a6,
Key_section = 0x0a7,
Key_diaeresis = 0x0a8,
Key_copyright = 0x0a9,
Key_ordfeminine = 0x0aa,
Key_guillemotleft = 0x0ab, // left angle quotation mark
Key_notsign = 0x0ac,
Key_hyphen = 0x0ad,
Key_registered = 0x0ae,
Key_macron = 0x0af,
Key_degree = 0x0b0,
Key_plusminus = 0x0b1,
Key_twosuperior = 0x0b2,
Key_threesuperior = 0x0b3,
Key_acute = 0x0b4,
Key_mu = 0x0b5,
Key_paragraph = 0x0b6,
Key_periodcentered = 0x0b7,
Key_cedilla = 0x0b8,
Key_onesuperior = 0x0b9,
Key_masculine = 0x0ba,
Key_guillemotright = 0x0bb, // right angle quotation mark
Key_onequarter = 0x0bc,
Key_onehalf = 0x0bd,
Key_threequarters = 0x0be,
Key_questiondown = 0x0bf,
Key_Agrave = 0x0c0,
Key_Aacute = 0x0c1,
Key_Acircumflex = 0x0c2,
Key_Atilde = 0x0c3,
Key_Adiaeresis = 0x0c4,
Key_Aring = 0x0c5,
Key_AE = 0x0c6,
Key_Ccedilla = 0x0c7,
Key_Egrave = 0x0c8,
Key_Eacute = 0x0c9,
Key_Ecircumflex = 0x0ca,
Key_Ediaeresis = 0x0cb,
Key_Igrave = 0x0cc,
Key_Iacute = 0x0cd,
Key_Icircumflex = 0x0ce,
Key_Idiaeresis = 0x0cf,
Key_ETH = 0x0d0,
Key_Ntilde = 0x0d1,
Key_Ograve = 0x0d2,
Key_Oacute = 0x0d3,
Key_Ocircumflex = 0x0d4,
Key_Otilde = 0x0d5,
Key_Odiaeresis = 0x0d6,
Key_multiply = 0x0d7,
Key_Ooblique = 0x0d8,
Key_Ugrave = 0x0d9,
Key_Uacute = 0x0da,
Key_Ucircumflex = 0x0db,
Key_Udiaeresis = 0x0dc,
Key_Yacute = 0x0dd,
Key_THORN = 0x0de,
Key_ssharp = 0x0df,
Key_agrave = 0x0e0,
Key_aacute = 0x0e1,
Key_acircumflex = 0x0e2,
Key_atilde = 0x0e3,
Key_adiaeresis = 0x0e4,
Key_aring = 0x0e5,
Key_ae = 0x0e6,
Key_ccedilla = 0x0e7,
Key_egrave = 0x0e8,
Key_eacute = 0x0e9,
Key_ecircumflex = 0x0ea,
Key_ediaeresis = 0x0eb,
Key_igrave = 0x0ec,
Key_iacute = 0x0ed,
Key_icircumflex = 0x0ee,
Key_idiaeresis = 0x0ef,
Key_eth = 0x0f0,
Key_ntilde = 0x0f1,
Key_ograve = 0x0f2,
Key_oacute = 0x0f3,
Key_ocircumflex = 0x0f4,
Key_otilde = 0x0f5,
Key_odiaeresis = 0x0f6,
Key_division = 0x0f7,
Key_oslash = 0x0f8,
Key_ugrave = 0x0f9,
Key_uacute = 0x0fa,
Key_ucircumflex = 0x0fb,
Key_udiaeresis = 0x0fc,
Key_yacute = 0x0fd,
Key_thorn = 0x0fe,
Key_ydiaeresis = 0x0ff,
Key_unknown = 0xffff,
Key_none = 0xffff//= Key_unknown
};
}//namespace mitk
#endif //ifndef MITKINTERACTCONST_H
diff --git a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
index 97595aea40..46a38090fa 100644
--- a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
+++ b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/StateMachine.xml
@@ -1,3713 +1,3744 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
index 7ef09fbd46..c7792a98cc 100644
--- a/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
+++ b/CoreUI/Bundles/org.mitk.gui.qt.common/resources/mitkEventAndActionConstants.xml
@@ -1,381 +1,385 @@
+
+
+
+
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
index 5fe91577da..584945583c 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.cpp
@@ -1,1233 +1,1265 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "QmitkControlVisualizationPropertiesView.h"
#include "mitkNodePredicateDataType.h"
#include "mitkDataNodeObject.h"
#include "mitkOdfNormalizationMethodProperty.h"
#include "mitkOdfScaleByProperty.h"
#include "mitkResliceMethodProperty.h"
#include "mitkRenderingManager.h"
#include "mitkDiffusionImage.h"
#include "mitkPlanarFigure.h"
#include "mitkFiberBundle.h"
#include "QmitkDataStorageComboBox.h"
#include "QmitkStdMultiWidget.h"
+#include "mitkFiberBundleInteractor.h"
+
+#include "mitkGlobalInteraction.h"
#include "berryIWorkbenchWindow.h"
#include "berryIWorkbenchPage.h"
#include "berryISelectionService.h"
#include "berryConstants.h"
#include "berryPlatformUI.h"
#include "itkRGBAPixel.h"
#include "qwidgetaction.h"
#include "qcolordialog.h"
const std::string QmitkControlVisualizationPropertiesView::VIEW_ID = "org.mitk.views.controlvisualizationpropertiesview";
using namespace berry;
struct CvpSelListener : ISelectionListener
{
berryObjectMacro(CvpSelListener);
CvpSelListener(QmitkControlVisualizationPropertiesView* view)
{
m_View = view;
}
void ApplySettings(mitk::DataNode::Pointer node)
{
bool do_vis;
node->GetBoolProperty("VisibleOdfs_T", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_T->setIcon(*m_View->m_IconGlyON_T);
m_View->m_Controls->m_VisibleOdfsON_T->setChecked(true);
m_View->m_GlyIsOn_T = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_T->setIcon(*m_View->m_IconGlyOFF_T);
m_View->m_Controls->m_VisibleOdfsON_T->setChecked(false);
m_View->m_GlyIsOn_T = false;
}
node->GetBoolProperty("VisibleOdfs_C", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_C->setIcon(*m_View->m_IconGlyON_C);
m_View->m_Controls->m_VisibleOdfsON_C->setChecked(true);
m_View->m_GlyIsOn_C = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_C->setIcon(*m_View->m_IconGlyOFF_C);
m_View->m_Controls->m_VisibleOdfsON_C->setChecked(false);
m_View->m_GlyIsOn_C = false;
}
node->GetBoolProperty("VisibleOdfs_S", do_vis);
if(do_vis)
{
m_View->m_Controls->m_VisibleOdfsON_S->setIcon(*m_View->m_IconGlyON_S);
m_View->m_Controls->m_VisibleOdfsON_S->setChecked(true);
m_View->m_GlyIsOn_S = true;
}
else
{
m_View->m_Controls->m_VisibleOdfsON_S->setIcon(*m_View->m_IconGlyOFF_S);
m_View->m_Controls->m_VisibleOdfsON_S->setChecked(false);
m_View->m_GlyIsOn_S = false;
}
bool tex_int;
node->GetBoolProperty("texture interpolation", tex_int);
if(tex_int)
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
m_View->m_Controls->m_TextureIntON->setChecked(true);
m_View->m_TexIsOn = true;
}
else
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
m_View->m_Controls->m_TextureIntON->setChecked(false);
m_View->m_TexIsOn = false;
}
int val;
node->GetIntProperty("ShowMaxNumber", val);
m_View->m_Controls->m_ShowMaxNumber->setValue(val);
m_View->m_Controls->m_NormalizationDropdown->setCurrentIndex(dynamic_cast(node->GetProperty("Normalization"))->GetValueAsId());
float fval;
node->GetFloatProperty("Scaling",fval);
m_View->m_Controls->m_ScalingFactor->setValue(fval);
m_View->m_Controls->m_AdditionalScaling->setCurrentIndex(dynamic_cast(node->GetProperty("ScaleBy"))->GetValueAsId());
node->GetFloatProperty("IndexParam1",fval);
m_View->m_Controls->m_IndexParam1->setValue(fval);
node->GetFloatProperty("IndexParam2",fval);
m_View->m_Controls->m_IndexParam2->setValue(fval);
}
void DoSelectionChanged(ISelection::ConstPointer selection)
{
// save current selection in member variable
m_View->m_CurrentSelection = selection.Cast();
m_View->m_Controls->m_VisibleOdfsON_T->setVisible(false);
m_View->m_Controls->m_VisibleOdfsON_S->setVisible(false);
m_View->m_Controls->m_VisibleOdfsON_C->setVisible(false);
m_View->m_Controls->m_TextureIntON->setVisible(false);
m_View->m_Controls->m_ImageControlsFrame->setVisible(false);
m_View->m_Controls->m_PlanarFigureControlsFrame->setVisible(false);
m_View->m_Controls->m_BundleControlsFrame->setVisible(false);
m_View->m_SelectedNode = 0;
if(m_View->m_CurrentSelection.IsNull())
return;
if(m_View->m_CurrentSelection->Size() == 1)
{
mitk::DataNodeObject::Pointer nodeObj = m_View->m_CurrentSelection->Begin()->Cast();
if(nodeObj.IsNotNull())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
if(dynamic_cast(node->GetData()) != 0)
{
m_View->m_Controls->m_PlanarFigureControlsFrame->setVisible(true);
m_View->m_SelectedNode = node;
}
if(dynamic_cast(node->GetData()) != 0)
{
m_View->m_Controls->m_BundleControlsFrame->setVisible(true);
m_View->m_SelectedNode = node;
}
}
}
if(m_View->m_CurrentSelection->Size() > 0 && m_View->m_SelectedNode == 0)
{
m_View->m_Controls->m_ImageControlsFrame->setVisible(true);
bool foundDiffusionImage = false;
bool foundQBIVolume = false;
bool foundTensorVolume = false;
bool foundImage = false;
bool foundMultipleOdfImages = false;
bool foundRGBAImage = false;
// do something with the selected items
if(m_View->m_CurrentSelection)
{
// iterate selection
for (IStructuredSelection::iterator i = m_View->m_CurrentSelection->Begin();
i != m_View->m_CurrentSelection->End(); ++i)
{
// extract datatree node
if (mitk::DataNodeObject::Pointer nodeObj = i->Cast())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
// only look at interesting types
if(QString("DiffusionImage").compare(node->GetData()->GetNameOfClass())==0)
{
foundDiffusionImage = true;
bool tex_int;
node->GetBoolProperty("texture interpolation", tex_int);
if(tex_int)
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
m_View->m_Controls->m_TextureIntON->setChecked(true);
m_View->m_TexIsOn = true;
}
else
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
m_View->m_Controls->m_TextureIntON->setChecked(false);
m_View->m_TexIsOn = false;
}
int val;
node->GetIntProperty("DisplayChannel", val);
m_View->m_Controls->m_DisplayIndex->setValue(val);
QString label = "Channel %1";
label = label.arg(val);
m_View->m_Controls->label_channel->setText(label);
int maxVal = (dynamic_cast* >(node->GetData()))->GetVectorImage()->GetVectorLength();
m_View->m_Controls->m_DisplayIndex->setMaximum(maxVal-1);
}
else if(QString("QBallImage").compare(node->GetData()->GetNameOfClass())==0)
{
foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
foundQBIVolume = true;
ApplySettings(node);
}
else if(QString("TensorImage").compare(node->GetData()->GetNameOfClass())==0)
{
foundMultipleOdfImages = foundQBIVolume || foundTensorVolume;
foundTensorVolume = true;
ApplySettings(node);
}
else if(QString("Image").compare(node->GetData()->GetNameOfClass())==0)
{
foundImage = true;
mitk::Image::Pointer img = dynamic_cast(node->GetData());
if(img.IsNotNull() && img->GetPixelType().GetItkTypeId() == &typeid(itk::RGBAPixel) )
{
foundRGBAImage = true;
}
bool tex_int;
node->GetBoolProperty("texture interpolation", tex_int);
if(tex_int)
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexON);
m_View->m_Controls->m_TextureIntON->setChecked(true);
m_View->m_TexIsOn = true;
}
else
{
m_View->m_Controls->m_TextureIntON->setIcon(*m_View->m_IconTexOFF);
m_View->m_Controls->m_TextureIntON->setChecked(false);
m_View->m_TexIsOn = false;
}
}
}
}
}
m_View->m_Controls->m_DisplayIndex->setVisible(foundDiffusionImage);
m_View->m_Controls->label_channel->setVisible(foundDiffusionImage);
m_View->m_FoundSingleOdfImage = (foundQBIVolume || foundTensorVolume)
&& !foundMultipleOdfImages;
m_View->m_Controls->m_NumberGlyphsFrame->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_NormalizationDropdown->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->label->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_ScalingFactor->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_AdditionalScaling->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_NormalizationScalingFrame->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->OpacMinFrame->setVisible(foundRGBAImage || m_View->m_FoundSingleOdfImage);
// changed for SPIE paper, Principle curvature scaling
//m_View->m_Controls->params_frame->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->params_frame->setVisible(false);
m_View->m_Controls->m_VisibleOdfsON_T->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_VisibleOdfsON_S->setVisible(m_View->m_FoundSingleOdfImage);
m_View->m_Controls->m_VisibleOdfsON_C->setVisible(m_View->m_FoundSingleOdfImage);
bool foundAnyImage = foundDiffusionImage ||
foundQBIVolume || foundTensorVolume || foundImage;
m_View->m_Controls->m_Reinit->setVisible(foundAnyImage);
m_View->m_Controls->m_TextureIntON->setVisible(foundAnyImage);
m_View->m_Controls->m_TSMenu->setVisible(foundAnyImage);
if(m_View->m_IsInitialized)
{
//m_View->GetSite()->GetWorkbenchWindow()->GetActivePage()
// ->HideView(IViewPart::Pointer(m_View));
//berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow()->GetActivePage()
// ->ShowView(QmitkControlVisualizationPropertiesView::VIEW_ID,
// "", berry::IWorkbenchPage::VIEW_VISIBLE);
}
}
}
void SelectionChanged(IWorkbenchPart::Pointer part, ISelection::ConstPointer selection)
{
// check, if selection comes from datamanager
if (part)
{
QString partname(part->GetPartName().c_str());
if(partname.compare("Datamanager")==0)
{
// apply selection
DoSelectionChanged(selection);
}
}
}
QmitkControlVisualizationPropertiesView* m_View;
};
QmitkControlVisualizationPropertiesView::QmitkControlVisualizationPropertiesView()
: QmitkFunctionality(),
m_Controls(NULL),
m_MultiWidget(NULL),
m_IconTexOFF(new QIcon(":/QmitkDiffusionImaging/texIntOFFIcon.png")),
m_IconTexON(new QIcon(":/QmitkDiffusionImaging/texIntONIcon.png")),
m_IconGlyOFF_T(new QIcon(":/QmitkDiffusionImaging/glyphsoff_T.png")),
m_IconGlyON_T(new QIcon(":/QmitkDiffusionImaging/glyphson_T.png")),
m_IconGlyOFF_C(new QIcon(":/QmitkDiffusionImaging/glyphsoff_C.png")),
m_IconGlyON_C(new QIcon(":/QmitkDiffusionImaging/glyphson_C.png")),
m_IconGlyOFF_S(new QIcon(":/QmitkDiffusionImaging/glyphsoff_S.png")),
m_IconGlyON_S(new QIcon(":/QmitkDiffusionImaging/glyphson_S.png")),
m_CurrentSelection(0)
{
currentThickSlicesMode = 1;
m_MyMenu = NULL;
}
QmitkControlVisualizationPropertiesView::QmitkControlVisualizationPropertiesView(const QmitkControlVisualizationPropertiesView& other)
{
Q_UNUSED(other)
throw std::runtime_error("Copy constructor not implemented");
}
QmitkControlVisualizationPropertiesView::~QmitkControlVisualizationPropertiesView()
{
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->RemovePostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
}
void QmitkControlVisualizationPropertiesView::OnThickSlicesModeSelected( QAction* action )
{
currentThickSlicesMode = action->data().toInt();
switch(currentThickSlicesMode)
{
default:
case 1:
this->m_Controls->m_TSMenu->setText("MIP");
break;
case 2:
this->m_Controls->m_TSMenu->setText("SUM");
break;
case 3:
this->m_Controls->m_TSMenu->setText("WEIGH");
break;
}
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow2()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow3()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer->GetRenderingManager()->RequestUpdateAll();
}
void QmitkControlVisualizationPropertiesView::OnTSNumChanged(int num)
{
if(num==0)
{
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( 0 ) );
}
else
{
mitk::DataNode* n;
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices", mitk::ResliceMethodProperty::New( currentThickSlicesMode ) );
n = GetDataStorage()->GetNamedNode("widget1Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
n = GetDataStorage()->GetNamedNode("widget2Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
n = GetDataStorage()->GetNamedNode("widget3Plane"); if(n) n->SetProperty( "reslice.thickslices.num", mitk::IntProperty::New( num ) );
}
m_TSLabel->setText(QString::number(num*2+1));
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow2()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer = this->GetActiveStdMultiWidget()->GetRenderWindow3()->GetRenderer();
if(renderer.IsNotNull())
{
renderer->SendUpdateSlice();
}
renderer->GetRenderingManager()->RequestUpdateAll(mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS);
}
void QmitkControlVisualizationPropertiesView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
// create GUI widgets
m_Controls = new Ui::QmitkControlVisualizationPropertiesViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
m_MyMenu = new QMenu(parent);
connect( m_MyMenu, SIGNAL( aboutToShow() ), this, SLOT(OnMenuAboutToShow()) );
// button for changing rotation mode
m_Controls->m_TSMenu->setMenu( m_MyMenu );
//m_CrosshairModeButton->setIcon( QIcon( iconCrosshairMode_xpm ) );
m_Controls->params_frame->setVisible(false);
QIcon icon5(":/QmitkDiffusionImaging/Refresh_48.png");
m_Controls->m_Reinit->setIcon(icon5);
m_Controls->m_TextureIntON->setCheckable(true);
m_Controls->m_VisibleOdfsON_T->setCheckable(true);
m_Controls->m_VisibleOdfsON_S->setCheckable(true);
m_Controls->m_VisibleOdfsON_C->setCheckable(true);
#ifndef DIFFUSION_IMAGING_EXTENDED
int size = m_Controls->m_AdditionalScaling->count();
for(int t=0; tm_AdditionalScaling->itemText(t).toStdString() == "Scale by ASR")
{
m_Controls->m_AdditionalScaling->removeItem(t);
}
}
#endif
m_Controls->m_OpacitySlider->setRange(0.0,1.0);
m_Controls->m_OpacitySlider->setLowerValue(0.0);
m_Controls->m_OpacitySlider->setUpperValue(0.0);
m_Controls->m_ScalingFrame->setVisible(false);
m_Controls->m_NormalizationFrame->setVisible(false);
}
m_IsInitialized = false;
m_SelListener = berry::ISelectionListener::Pointer(new CvpSelListener(this));
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->AddPostSelectionListener(/*"org.mitk.views.datamanager",*/ m_SelListener);
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast();
m_SelListener.Cast()->DoSelectionChanged(sel);
m_IsInitialized = true;
}
void QmitkControlVisualizationPropertiesView::OnMenuAboutToShow ()
{
// THICK SLICE SUPPORT
QMenu *myMenu = m_MyMenu;
myMenu->clear();
QActionGroup* thickSlicesActionGroup = new QActionGroup(myMenu);
thickSlicesActionGroup->setExclusive(true);
mitk::BaseRenderer::Pointer renderer =
this->GetActiveStdMultiWidget()->GetRenderWindow1()->GetRenderer();
int currentTSMode = 0;
{
mitk::ResliceMethodProperty::Pointer m = dynamic_cast(renderer->GetCurrentWorldGeometry2DNode()->GetProperty( "reslice.thickslices" ));
if( m.IsNotNull() )
currentTSMode = m->GetValueAsId();
}
const int maxTS = 30;
int currentNum = 0;
{
mitk::IntProperty::Pointer m = dynamic_cast(renderer->GetCurrentWorldGeometry2DNode()->GetProperty( "reslice.thickslices.num" ));
if( m.IsNotNull() )
{
currentNum = m->GetValue();
if(currentNum < 0) currentNum = 0;
if(currentNum > maxTS) currentNum = maxTS;
}
}
if(currentTSMode==0)
currentNum=0;
QSlider *m_TSSlider = new QSlider(myMenu);
m_TSSlider->setMinimum(0);
m_TSSlider->setMaximum(maxTS-1);
m_TSSlider->setValue(currentNum);
m_TSSlider->setOrientation(Qt::Horizontal);
connect( m_TSSlider, SIGNAL( valueChanged(int) ), this, SLOT( OnTSNumChanged(int) ) );
QHBoxLayout* _TSLayout = new QHBoxLayout;
_TSLayout->setContentsMargins(4,4,4,4);
_TSLayout->addWidget(m_TSSlider);
_TSLayout->addWidget(m_TSLabel=new QLabel(QString::number(currentNum*2+1),myMenu));
QWidget* _TSWidget = new QWidget;
_TSWidget->setLayout(_TSLayout);
QActionGroup* thickSliceModeActionGroup = new QActionGroup(myMenu);
thickSliceModeActionGroup->setExclusive(true);
QWidgetAction *m_TSSliderAction = new QWidgetAction(myMenu);
m_TSSliderAction->setDefaultWidget(_TSWidget);
myMenu->addAction(m_TSSliderAction);
QAction* mipThickSlicesAction = new QAction(myMenu);
mipThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
mipThickSlicesAction->setText("MIP (max. intensity proj.)");
mipThickSlicesAction->setCheckable(true);
mipThickSlicesAction->setChecked(currentThickSlicesMode==1);
mipThickSlicesAction->setData(1);
myMenu->addAction( mipThickSlicesAction );
QAction* sumThickSlicesAction = new QAction(myMenu);
sumThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
sumThickSlicesAction->setText("SUM (sum intensity proj.)");
sumThickSlicesAction->setCheckable(true);
sumThickSlicesAction->setChecked(currentThickSlicesMode==2);
sumThickSlicesAction->setData(2);
myMenu->addAction( sumThickSlicesAction );
QAction* weightedThickSlicesAction = new QAction(myMenu);
weightedThickSlicesAction->setActionGroup(thickSliceModeActionGroup);
weightedThickSlicesAction->setText("WEIGHTED (gaussian proj.)");
weightedThickSlicesAction->setCheckable(true);
weightedThickSlicesAction->setChecked(currentThickSlicesMode==3);
weightedThickSlicesAction->setData(3);
myMenu->addAction( weightedThickSlicesAction );
connect( thickSliceModeActionGroup, SIGNAL(triggered(QAction*)), this, SLOT(OnThickSlicesModeSelected(QAction*)) );
}
void QmitkControlVisualizationPropertiesView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget)
{
m_MultiWidget = &stdMultiWidget;
}
void QmitkControlVisualizationPropertiesView::StdMultiWidgetNotAvailable()
{
m_MultiWidget = NULL;
}
void QmitkControlVisualizationPropertiesView::CreateConnections()
{
if ( m_Controls )
{
connect( (QObject*)(m_Controls->m_DisplayIndex), SIGNAL(valueChanged(int)), this, SLOT(DisplayIndexChanged(int)) );
connect( (QObject*)(m_Controls->m_TextureIntON), SIGNAL(clicked()), this, SLOT(TextIntON()) );
connect( (QObject*)(m_Controls->m_Reinit), SIGNAL(clicked()), this, SLOT(Reinit()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_T), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_T()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_S), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_S()) );
connect( (QObject*)(m_Controls->m_VisibleOdfsON_C), SIGNAL(clicked()), this, SLOT(VisibleOdfsON_C()) );
connect( (QObject*)(m_Controls->m_ShowMaxNumber), SIGNAL(editingFinished()), this, SLOT(ShowMaxNumberChanged()) );
connect( (QObject*)(m_Controls->m_NormalizationDropdown), SIGNAL(currentIndexChanged(int)), this, SLOT(NormalizationDropdownChanged(int)) );
connect( (QObject*)(m_Controls->m_ScalingFactor), SIGNAL(valueChanged(double)), this, SLOT(ScalingFactorChanged(double)) );
connect( (QObject*)(m_Controls->m_AdditionalScaling), SIGNAL(currentIndexChanged(int)), this, SLOT(AdditionalScaling(int)) );
connect( (QObject*)(m_Controls->m_IndexParam1), SIGNAL(valueChanged(double)), this, SLOT(IndexParam1Changed(double)) );
connect( (QObject*)(m_Controls->m_IndexParam2), SIGNAL(valueChanged(double)), this, SLOT(IndexParam2Changed(double)) );
connect( (QObject*)(m_Controls->m_ScalingCheckbox), SIGNAL(clicked()), this, SLOT(ScalingCheckbox()) );
connect( (QObject*)(m_Controls->m_OpacitySlider), SIGNAL(spanChanged(double,double)), this, SLOT(OpacityChanged(double,double)) );
connect((QObject*) m_Controls->m_Wire, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationWire()));
connect((QObject*) m_Controls->m_Tube, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationTube()));
connect((QObject*) m_Controls->m_Color, SIGNAL(clicked()), (QObject*) this, SLOT(BundleRepresentationColor()));
connect((QObject*) m_Controls->m_Focus, SIGNAL(clicked()), (QObject*) this, SLOT(PlanarFigureFocus()));
+ connect((QObject*) m_Controls->m_SetInteractor, SIGNAL(clicked()), (QObject*) this, SLOT(SetInteractor()));
+
}
}
void QmitkControlVisualizationPropertiesView::Activated()
{
berry::ISelection::ConstPointer sel(
this->GetSite()->GetWorkbenchWindow()->GetSelectionService()->GetSelection("org.mitk.views.datamanager"));
m_CurrentSelection = sel.Cast();
m_SelListener.Cast()->DoSelectionChanged(sel);
QmitkFunctionality::Activated();
}
void QmitkControlVisualizationPropertiesView::Deactivated()
{
QmitkFunctionality::Deactivated();
}
int QmitkControlVisualizationPropertiesView::GetSizeFlags(bool width)
{
if(!width)
{
return berry::Constants::MIN | berry::Constants::MAX | berry::Constants::FILL;
}
else
{
return 0;
}
}
int QmitkControlVisualizationPropertiesView::ComputePreferredSize(bool width, int /*availableParallel*/, int /*availablePerpendicular*/, int preferredResult)
{
if(width==false)
{
return m_FoundSingleOdfImage ? 120 : 80;
}
else
{
return preferredResult;
}
}
mitk::DataStorage::SetOfObjects::Pointer
QmitkControlVisualizationPropertiesView::ActiveSet(std::string classname)
{
if (m_CurrentSelection)
{
mitk::DataStorage::SetOfObjects::Pointer set =
mitk::DataStorage::SetOfObjects::New();
int at = 0;
for (IStructuredSelection::iterator i = m_CurrentSelection->Begin();
i != m_CurrentSelection->End();
++i)
{
if (mitk::DataNodeObject::Pointer nodeObj = i->Cast())
{
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
if(QString(classname.c_str()).compare(node->GetData()->GetNameOfClass())==0)
{
set->InsertElement(at++, node);
}
}
}
return set;
}
return 0;
}
void QmitkControlVisualizationPropertiesView::SetBoolProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, bool value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetBoolProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetIntProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, int value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetIntProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetFloatProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, float value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetFloatProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetLevelWindowProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, mitk::LevelWindow value)
{
if(set.IsNotNull())
{
mitk::LevelWindowProperty::Pointer prop = mitk::LevelWindowProperty::New(value);
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetProperty(name.c_str(), prop);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::SetEnumProp(
mitk::DataStorage::SetOfObjects::Pointer set,
std::string name, mitk::EnumerationProperty::Pointer value)
{
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetProperty(name.c_str(), value);
++itemiter;
}
}
}
void QmitkControlVisualizationPropertiesView::DisplayIndexChanged(int dispIndex)
{
QString label = "Channel %1";
label = label.arg(dispIndex);
m_Controls->label_channel->setText(label);
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("DiffusionImage");
if(set.IsNotNull())
{
mitk::DataStorage::SetOfObjects::const_iterator itemiter( set->begin() );
mitk::DataStorage::SetOfObjects::const_iterator itemiterend( set->end() );
while ( itemiter != itemiterend )
{
(*itemiter)->SetIntProperty("DisplayChannel", dispIndex);
++itemiter;
}
//m_MultiWidget->RequestUpdate();
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::Reinit()
{
if (m_CurrentSelection)
{
mitk::DataNodeObject::Pointer nodeObj =
m_CurrentSelection->Begin()->Cast();
mitk::DataNode::Pointer node = nodeObj->GetDataNode();
mitk::BaseData::Pointer basedata = node->GetData();
if (basedata.IsNotNull())
{
mitk::RenderingManager::GetInstance()->InitializeViews(
basedata->GetTimeSlicedGeometry(), mitk::RenderingManager::REQUEST_UPDATE_ALL, true );
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
}
}
void QmitkControlVisualizationPropertiesView::TextIntON()
{
if(m_TexIsOn)
{
m_Controls->m_TextureIntON->setIcon(*m_IconTexOFF);
}
else
{
m_Controls->m_TextureIntON->setIcon(*m_IconTexON);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("DiffusionImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("TensorImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("QBallImage");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
set = ActiveSet("Image");
SetBoolProp(set,"texture interpolation", !m_TexIsOn);
m_TexIsOn = !m_TexIsOn;
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_S()
{
if(m_GlyIsOn_S)
{
m_Controls->m_VisibleOdfsON_S->setIcon(*m_IconGlyOFF_S);
}
else
{
m_Controls->m_VisibleOdfsON_S->setIcon(*m_IconGlyON_S);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_S", !m_GlyIsOn_S);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_S", !m_GlyIsOn_S);
m_GlyIsOn_S = !m_GlyIsOn_S;
VisibleOdfsON(0);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_T()
{
if(m_GlyIsOn_T)
{
m_Controls->m_VisibleOdfsON_T->setIcon(*m_IconGlyOFF_T);
}
else
{
m_Controls->m_VisibleOdfsON_T->setIcon(*m_IconGlyON_T);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_T", !m_GlyIsOn_T);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_T", !m_GlyIsOn_T);
m_GlyIsOn_T = !m_GlyIsOn_T;
VisibleOdfsON(1);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON_C()
{
if(m_GlyIsOn_C)
{
m_Controls->m_VisibleOdfsON_C->setIcon(*m_IconGlyOFF_C);
}
else
{
m_Controls->m_VisibleOdfsON_C->setIcon(*m_IconGlyON_C);
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetBoolProp(set,"VisibleOdfs_C", !m_GlyIsOn_C);
set = ActiveSet("TensorImage");
SetBoolProp(set,"VisibleOdfs_C", !m_GlyIsOn_C);
m_GlyIsOn_C = !m_GlyIsOn_C;
VisibleOdfsON(2);
}
void QmitkControlVisualizationPropertiesView::VisibleOdfsON(int view)
{
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ShowMaxNumberChanged()
{
int maxNr = m_Controls->m_ShowMaxNumber->value();
if ( maxNr < 1 )
{
m_Controls->m_ShowMaxNumber->setValue( 1 );
maxNr = 1;
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetIntProp(set,"ShowMaxNumber", maxNr);
set = ActiveSet("TensorImage");
SetIntProp(set,"ShowMaxNumber", maxNr);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::NormalizationDropdownChanged(int normDropdown)
{
typedef mitk::OdfNormalizationMethodProperty PropType;
PropType::Pointer normMeth = PropType::New();
switch(normDropdown)
{
case 0:
normMeth->SetNormalizationToMinMax();
break;
case 1:
normMeth->SetNormalizationToMax();
break;
case 2:
normMeth->SetNormalizationToNone();
break;
case 3:
normMeth->SetNormalizationToGlobalMax();
break;
default:
normMeth->SetNormalizationToMinMax();
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetEnumProp(set,"Normalization", normMeth.GetPointer());
set = ActiveSet("TensorImage");
SetEnumProp(set,"Normalization", normMeth.GetPointer());
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ScalingFactorChanged(double scalingFactor)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"Scaling", scalingFactor);
set = ActiveSet("TensorImage");
SetFloatProp(set,"Scaling", scalingFactor);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::AdditionalScaling(int additionalScaling)
{
typedef mitk::OdfScaleByProperty PropType;
PropType::Pointer scaleBy = PropType::New();
switch(additionalScaling)
{
case 0:
scaleBy->SetScaleByNothing();
break;
case 1:
scaleBy->SetScaleByGFA();
//m_Controls->params_frame->setVisible(true);
break;
#ifdef DIFFUSION_IMAGING_EXTENDED
case 2:
scaleBy->SetScaleByPrincipalCurvature();
// commented in for SPIE paper, Principle curvature scaling
//m_Controls->params_frame->setVisible(true);
break;
#endif
default:
scaleBy->SetScaleByNothing();
}
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetEnumProp(set,"ScaleBy", scaleBy.GetPointer());
set = ActiveSet("TensorImage");
SetEnumProp(set,"ScaleBy", scaleBy.GetPointer());
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::IndexParam1Changed(double param1)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"IndexParam1", param1);
set = ActiveSet("TensorImage");
SetFloatProp(set,"IndexParam1", param1);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::IndexParam2Changed(double param2)
{
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetFloatProp(set,"IndexParam2", param2);
set = ActiveSet("TensorImage");
SetFloatProp(set,"IndexParam2", param2);
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::OpacityChanged(double l, double u)
{
mitk::LevelWindow olw;
olw.SetRangeMinMax(l*255, u*255);
mitk::DataStorage::SetOfObjects::Pointer set =
ActiveSet("QBallImage");
SetLevelWindowProp(set,"opaclevelwindow", olw);
set = ActiveSet("TensorImage");
SetLevelWindowProp(set,"opaclevelwindow", olw);
set = ActiveSet("Image");
SetLevelWindowProp(set,"opaclevelwindow", olw);
m_Controls->m_OpacityMinFaLabel->setText(QString::number(l,'f',2) + " : " + QString::number(u,'f',2));
if(m_MultiWidget)
m_MultiWidget->RequestUpdate();
}
void QmitkControlVisualizationPropertiesView::ScalingCheckbox()
{
m_Controls->m_ScalingFrame->setVisible(
m_Controls->m_ScalingCheckbox->isChecked());
}
void QmitkControlVisualizationPropertiesView::BundleRepresentationWire()
{
if(m_SelectedNode)
{
m_SelectedNode->SetProperty("LineWidth",mitk::IntProperty::New(m_Controls->m_LineWidth->value()));
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(15));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(18));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(1));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(2));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(3));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(4));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::BundleRepresentationTube()
{
if(m_SelectedNode)
{
m_SelectedNode->SetProperty("TubeRadius",mitk::FloatProperty::New(m_Controls->m_TubeRadius->value()));
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(17));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(13));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(16));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::BundleRepresentationColor()
{
if(m_SelectedNode)
{
QColor color = QColorDialog::getColor();
m_SelectedNode->SetProperty("color",mitk::ColorProperty::New(color.red()/255.0, color.green()/255.0, color.blue()/255.0));
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(14));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(3));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
m_SelectedNode->SetProperty("ColorCoding",mitk::IntProperty::New(0));
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
}
void QmitkControlVisualizationPropertiesView::PlanarFigureFocus()
{
if(m_SelectedNode)
{
mitk::PlanarFigure* _PlanarFigure = 0;
_PlanarFigure = dynamic_cast (m_SelectedNode->GetData());
if (_PlanarFigure)
{
m_SelectedNode->SetProperty("layer",mitk::IntProperty::New(1000));
m_SelectedNode->SetProperty("selected",mitk::BoolProperty::New(false));
m_SelectedNode->SetProperty("visible",mitk::BoolProperty::New(true));
m_SelectedNode->SetProperty("planarfigure.default.line.color",mitk::ColorProperty::New(1,1,1));
m_SelectedNode->SetProperty("planarfigure.default.line.color",mitk::ColorProperty::New(1,1,1));
m_SelectedNode->SetProperty("planarfigure.hover.line.color",mitk::ColorProperty::New(1,1,1));
m_SelectedNode->SetProperty("planarfigure.hover.line.color",mitk::ColorProperty::New(1,1,1));
m_SelectedNode->SetProperty("planarfigure.selected.line.color",mitk::ColorProperty::New(1,1,1));
m_SelectedNode->SetProperty("planarfigure.selected.line.color",mitk::ColorProperty::New(1,1,1));
QmitkRenderWindow* selectedRenderWindow = 0;
QmitkRenderWindow* RenderWindow1 =
this->GetActiveStdMultiWidget()->GetRenderWindow1();
QmitkRenderWindow* RenderWindow2 =
this->GetActiveStdMultiWidget()->GetRenderWindow2();
QmitkRenderWindow* RenderWindow3 =
this->GetActiveStdMultiWidget()->GetRenderWindow3();
QmitkRenderWindow* RenderWindow4 =
this->GetActiveStdMultiWidget()->GetRenderWindow4();
bool PlanarFigureInitializedWindow = false;
// find initialized renderwindow
if (m_SelectedNode->GetBoolProperty("PlanarFigureInitializedWindow",
PlanarFigureInitializedWindow, RenderWindow1->GetRenderer()))
{
selectedRenderWindow = RenderWindow1;
}
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
RenderWindow2->GetRenderer()))
{
selectedRenderWindow = RenderWindow2;
}
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
RenderWindow3->GetRenderer()))
{
selectedRenderWindow = RenderWindow3;
}
if (!selectedRenderWindow && m_SelectedNode->GetBoolProperty(
"PlanarFigureInitializedWindow", PlanarFigureInitializedWindow,
RenderWindow4->GetRenderer()))
{
selectedRenderWindow = RenderWindow4;
}
const mitk::PlaneGeometry
* _PlaneGeometry =
dynamic_cast (_PlanarFigure->GetGeometry2D());
// make node visible
if (selectedRenderWindow)
{
mitk::Point3D centerP = _PlaneGeometry->GetOrigin();
selectedRenderWindow->GetSliceNavigationController()->ReorientSlices(
centerP, _PlaneGeometry->GetNormal());
selectedRenderWindow->GetSliceNavigationController()->SelectSliceByPoint(
centerP);
}
}
}
}
+
+void QmitkControlVisualizationPropertiesView::SetInteractor()
+{
+
+ mitk::DataStorage::SetOfObjects::ConstPointer _NodeSet = this->GetDefaultDataStorage()->GetAll();
+ mitk::DataNode* node = 0;
+ mitk::FiberBundle* bundle = 0;
+ mitk::FiberBundleInteractor::Pointer bundleInteractor = 0;
+
+ // finally add all nodes to the model
+ for(mitk::DataStorage::SetOfObjects::ConstIterator it=_NodeSet->Begin(); it!=_NodeSet->End()
+ ; it++)
+ {
+ node = const_cast(it->Value().GetPointer());
+ bundle = dynamic_cast(node->GetData());
+
+ if(bundle)
+ {
+ bundleInteractor = dynamic_cast(node->GetInteractor());
+
+ if(bundleInteractor.IsNull())
+ bundleInteractor = mitk::FiberBundleInteractor::New("FiberBundleInteractor", node);
+
+ mitk::GlobalInteraction::GetInstance()->AddInteractor(bundleInteractor);
+ }
+ }
+}
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
index b89d48122e..03d5d77b49 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesView.h
@@ -1,150 +1,152 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $
Version: $Revision: 17495 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _QMITKControlVisualizationPropertiesView_H_INCLUDED
#define _QMITKControlVisualizationPropertiesView_H_INCLUDED
#include
#include
#include "berryISelectionListener.h"
#include "berryIStructuredSelection.h"
#include "berryISizeProvider.h"
#include "ui_QmitkControlVisualizationPropertiesViewControls.h"
#include "mitkEnumerationProperty.h"
/*!
* \ingroup org_mitk_gui_qt_diffusionquantification_internal
*
* \brief QmitkControlVisualizationPropertiesView
*
* Document your class here.
*
* \sa QmitkFunctionality
*/
class QmitkControlVisualizationPropertiesView : public QmitkFunctionality//, public berry::ISizeProvider
{
friend struct CvpSelListener;
// this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkControlVisualizationPropertiesView();
QmitkControlVisualizationPropertiesView(const QmitkControlVisualizationPropertiesView& other);
virtual ~QmitkControlVisualizationPropertiesView();
virtual void CreateQtPartControl(QWidget *parent);
/// \brief Creation of the connections of main and control widget
virtual void CreateConnections();
/// \brief Called when the functionality is activated
virtual void Activated();
virtual void Deactivated();
virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget);
virtual void StdMultiWidgetNotAvailable();
mitk::DataStorage::SetOfObjects::Pointer ActiveSet(std::string);
void SetBoolProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,bool);
void SetIntProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,int);
void SetFloatProp(mitk::DataStorage::SetOfObjects::Pointer,std::string,float);
void SetLevelWindowProp(mitk::DataStorage::SetOfObjects::Pointer,std::string,mitk::LevelWindow);
void SetEnumProp (mitk::DataStorage::SetOfObjects::Pointer,std::string,mitk::EnumerationProperty::Pointer);
virtual int GetSizeFlags(bool width);
virtual int ComputePreferredSize(bool width, int availableParallel, int availablePerpendicular, int preferredResult);
protected slots:
void DisplayIndexChanged(int);
void TextIntON();
void Reinit();
void VisibleOdfsON(int view);
void VisibleOdfsON_S();
void VisibleOdfsON_T();
void VisibleOdfsON_C();
void ShowMaxNumberChanged();
void NormalizationDropdownChanged(int);
void ScalingFactorChanged(double);
void AdditionalScaling(int);
void IndexParam1Changed(double);
void IndexParam2Changed(double);
void OpacityChanged(double,double);
void ScalingCheckbox();
void OnThickSlicesModeSelected( QAction* action );
void OnTSNumChanged(int num);
void OnMenuAboutToShow ();
void BundleRepresentationWire();
void BundleRepresentationTube();
void BundleRepresentationColor();
void PlanarFigureFocus();
+ void SetInteractor();
+
protected:
Ui::QmitkControlVisualizationPropertiesViewControls* m_Controls;
QmitkStdMultiWidget* m_MultiWidget;
berry::ISelectionListener::Pointer m_SelListener;
berry::IStructuredSelection::ConstPointer m_CurrentSelection;
bool m_FoundSingleOdfImage;
bool m_IsInitialized;
QIcon* m_IconTexOFF;
QIcon* m_IconTexON;
QIcon* m_IconGlyOFF_T;
QIcon* m_IconGlyON_T;
QIcon* m_IconGlyOFF_C;
QIcon* m_IconGlyON_C;
QIcon* m_IconGlyOFF_S;
QIcon* m_IconGlyON_S;
bool m_TexIsOn;
bool m_GlyIsOn_T;
bool m_GlyIsOn_C;
bool m_GlyIsOn_S;
int currentThickSlicesMode;
QLabel* m_TSLabel;
QMenu* m_MyMenu;
// for planarfigure and bundle handling:
mitk::DataNode* m_SelectedNode;
};
#endif // _QMITKControlVisualizationPropertiesView_H_INCLUDED
diff --git a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
index 12e18b1482..aa79aaa933 100644
--- a/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
+++ b/Modules/Bundles/org.mitk.gui.qt.diffusionimaging/src/internal/QmitkControlVisualizationPropertiesViewControls.ui
@@ -1,605 +1,612 @@
QmitkControlVisualizationPropertiesViewControls
0
0
414
238
0
100
0
0
QmitkTemplate
0
0
-
QFrame::NoFrame
QFrame::Raised
0
-
0
0
QFrame::NoFrame
QFrame::Raised
0
-
Reinit view
Reinit view
Reinit view
-
Texture interpolation ON
Texture interpolation ON
Texture interpolation ON
-
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
-
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
-
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
Toggle visibility of ODF glyphs
-
Multislice Projection
Multislice Projection
Multislice Projection
MIP
QToolButton::MenuButtonPopup
Qt::NoArrow
-
Channel
-
300
Qt::Horizontal
-
QFrame::NoFrame
QFrame::Plain
0
-
Qt::Horizontal
20
20
-
#Glyphs
-
9999
-
QFrame::NoFrame
QFrame::Plain
0
-
Opacity
-
100
Qt::Horizontal
-
80
0
0.0 : 0.0
-
QFrame::NoFrame
QFrame::Raised
0
0
-
QFrame::NoFrame
QFrame::Raised
0
0
-
QFrame::NoFrame
QFrame::Plain
0
-
false
-
None
-
By GFA
-
By ASR
-
*
-
-
Scaling
-
QFrame::NoFrame
QFrame::Plain
0
0
-
false
-
Min-Max
-
Max
-
None
-
Global-Max
-
QFrame::NoFrame
QFrame::Raised
0
-
Param1
-
9999.989999999999782
-
Param2
-
9999.989999999999782
-
QFrame::NoFrame
QFrame::Raised
3
0
-
43
16777215
Width
-
43
16777215
1
-
Color
-
47
16777215
Radius
-
59
16777215
10.000000000000000
0.050000000000000
0.150000000000000
-
Tube
-
Wire
+ -
+
+
+ Set Interactor
+
+
+
-
QFrame::NoFrame
QFrame::Raised
0
-
Focus Planar Figure
-
Qt::Vertical
QSizePolicy::Expanding
0
0
QmitkFloatingPointSpanSlider
QSlider
QmitkFloatingPointSpanSlider.h
QmitkDataStorageComboBox.h
diff --git a/Modules/DiffusionImaging/CMakeLists.txt b/Modules/DiffusionImaging/CMakeLists.txt
index 4118291223..a047e24637 100644
--- a/Modules/DiffusionImaging/CMakeLists.txt
+++ b/Modules/DiffusionImaging/CMakeLists.txt
@@ -1,20 +1,20 @@
FIND_PACKAGE(ITK)
IF(ITK_GDCM_DIR)
INCLUDE(${ITK_GDCM_DIR}/GDCMConfig.cmake)
IF(GDCM_MAJOR_VERSION EQUAL 2)
ADD_DEFINITIONS(-DGDCM2)
SET(ITK_USES_GDCM2 1)
ENDIF(GDCM_MAJOR_VERSION EQUAL 2)
ENDIF(ITK_GDCM_DIR)
MITK_CREATE_MODULE( MitkDiffusionImaging
SUBPROJECTS MITK-DTI
- INCLUDE_DIRS Algorithms DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures/FiberBundle IODataStructures/PlanarFigureComposite IODataStructures Reconstruction Tractography Rendering ${CMAKE_CURRENT_BINARY_DIR}
+ INCLUDE_DIRS Algorithms DicomImport Interactions IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures/FiberBundle IODataStructures/PlanarFigureComposite IODataStructures Reconstruction Tractography Rendering ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS MitkExt SceneSerializationBase
PACKAGE_DEPENDS Boost
)
ADD_SUBDIRECTORY(Testing)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mitkDiffusionImagingConfigure.h.in ${CMAKE_CURRENT_BINARY_DIR}/mitkDiffusionImagingConfigure.h)
diff --git a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h
index 865da20633..b0478f9eed 100644
--- a/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h
+++ b/Modules/DiffusionImaging/IODataStructures/FiberBundle/mitkFiberBundle.h
@@ -1,172 +1,174 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Module: $RCSfile$
Language: C++
Date: $Date$
Version: $Revision: 11989 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef _MITK_FiberBundle_H
#define _MITK_FiberBundle_H
#include "mitkBaseData.h"
#include "MitkDiffusionImagingExports.h"
#include "mitkPlanarFigure.h"
/* This Class represents a bunch of FiberTracts as a Bundle.
A Bundle is represented by a GroupSpatialObject */
#include "itkDTITubeSpatialObject.h"
#include "itkDTITubeSpatialObjectPoint.h"
#include "itkGroupSpatialObject.h"
#include "itkPolyLineParametricPath.h"
#include "itkSlowPolyLineParametricPath.h"
#include "itkVectorContainer.h"
#include "itkPointSet.h"
#include "itkVector.h"
#include
#include
#include
#include
#include
#include
#include
#include
namespace mitk {
/**
* \brief Base Class for Fiber Bundles; */
class MitkDiffusionImaging_EXPORT FiberBundle : public BaseData
{
/* friend classes wanna access typedefs
ContainerPointType, ContainerTractType, ContainerType */
friend class FiberBundleWriter;
friend class FiberBundleReader;
// friend class itkTractsToDWIImageFilter;
/** Types for the standardized TractContainer **/
typedef itk::Point ContainerPointType; //no need to init, is no smartpointer
typedef itk::VectorContainer ContainerTractType;
typedef itk::VectorContainer< unsigned int, ContainerTractType::Pointer > ContainerType; //init via smartpointer
/** Types for the ITK Stochastic TractContainer **/
typedef itk::SlowPolyLineParametricPath< 3 > itkStochTractType;
typedef itk::VectorContainer< unsigned int, itkStochTractType::Pointer > itkStochTractContainerType;
// virtual methods that need to be implemented
virtual void UpdateOutputInformation();
virtual void SetRequestedRegionToLargestPossibleRegion();
virtual bool RequestedRegionIsOutsideOfTheBufferedRegion();
virtual bool VerifyRequestedRegion();
virtual void SetRequestedRegion( itk::DataObject *data );
public:
static const int TRACTPOINT_BACKFACE;
static const int TRACTPOINT_ON_PLANE;
static const int TRACTPOINT_FRNTFACE;
/* DTITubeSpatialObject Definitions */
typedef itk::GroupSpatialObject<3> FiberGroupType;
typedef FiberGroupType::ChildrenListType ChildrenListType;
typedef itk::DTITubeSpatialObject<3> DTITubeType;
typedef itk::DTITubeSpatialObjectPoint<3> DTITubePointType;
mitkClassMacro( FiberBundle, BaseData );
itkNewMacro( Self );
/* Handle Output Type of ITK Stochastic Tractography Fiber Tracking */
void addTractContainer( ContainerType::Pointer );
void additkStochTractContainer(itkStochTractContainerType::Pointer);
void initFiberGroup();
void addSingleDTITract(mitk::FiberBundle::DTITubeType::Pointer);
DTITubeType::Pointer copySingleDTITract(DTITubeType::Pointer);
/* Methods for PlanarFigure ROIs */
//mitk::FiberBundle::Pointer extractFibersPF(mitk::PlanarFigure::Pointer);
std::vector extractFibersByPF(mitk::PlanarFigure::Pointer, std::vector* set=0);
mitk::FiberBundle::Pointer extractFibersById(std::vector );
std::vector getAllIDsInFiberBundle();
mitk::Point3D calculateCrossingPoint(mitk::Point3D , mitk::Point3D , mitk::PlanarFigure::Pointer ); //depricated
bool checkForGap(int, int); //depricated
/*********************************/
void debug_members();
void SetBounds(float* b);
void SetBounds(double* b);
float* GetBounds();
//**** REALTIME MONITOR CONTAINER METHOD ****//
//flag overwrite existing bundle
void addContainer4speedDisplay( ContainerType::Pointer );
itkGetMacro(GroupFiberBundle, FiberGroupType::Pointer);
itkGetMacro(TractContainer, ContainerType::Pointer);
//** explicit handling of FiberBundleDataStructure contents *//
void PushPoint(int fiberIndex, ContainerPointType point);
void PushTract(ContainerTractType::Pointer tract);
ContainerPointType GetPoint(int tractIndex, int pointIndex);
ContainerTractType::Pointer GetTract(int tractIndex);
int GetNumTracts();
int GetNumPoints(int tractIndex);
FiberGroupType::Pointer getGroupFiberBundle();
mitk::FiberBundle::Pointer JoinBundle(mitk::FiberBundle::Pointer bundle);
int FindTractByEndpoints(mitk::FiberBundle::DTITubeType::Pointer searchTract);
mitk::FiberBundle::Pointer SubstractBundle(mitk::FiberBundle::Pointer bundle);
void InsertBundle(mitk::FiberBundle::Pointer bundle);
vtkPolyData* GeneratePolydata();
+// int SearchFiber(worldPoint, tolerance, resultDistance);
+
protected:
FiberBundle();
virtual ~FiberBundle();
private:
FiberGroupType::Pointer m_GroupFiberBundle;
ContainerType::Pointer m_TractContainer;
itkStochTractContainerType::Pointer m_debugITKContainer;
void fiberPostprocessing_FA( DTITubePointType* );
void fiberPostprocessing_setPoint(DTITubePointType* , ContainerPointType );
void fiberPostprocessing_setTensorMatrix(DTITubePointType*);
int debug_PrototypeCounter;
float m_boundsFB[3];
/* Methods for PlanarFigure ROIs */
bool isPointInSelection(mitk::Point3D, mitk::PlanarFigure::Pointer);
vtkPolyData* m_PolyData;
};
} // namespace mitk
#endif /* _MITK_FiberBundle_H */
diff --git a/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp
new file mode 100644
index 0000000000..fc2c5c53d0
--- /dev/null
+++ b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.cpp
@@ -0,0 +1,272 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2007-12-11 14:46:19 +0100 (Di, 11 Dez 2007) $
+Version: $Revision: 13129 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#include "mitkFiberBundleInteractor.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "mitkBaseRenderer.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+mitk::FiberBundleInteractor::FiberBundleInteractor(const char * type, DataNode* dataNode)
+ : Interactor(type, dataNode), m_LastPosition(0)
+{
+ m_LastPoint.Fill(0);
+}
+
+mitk::FiberBundleInteractor::~FiberBundleInteractor()
+{}
+
+void mitk::FiberBundleInteractor::SelectFiber(int position)
+{
+ MITK_INFO << "mitk::FiberBundleInteractor::SelectFiber " << position;
+
+ mitk::PointSet* pointSet = dynamic_cast(m_DataNode->GetData());
+ if (pointSet == NULL)
+ return;
+ if (pointSet->GetSize()<=0)//if List is empty, then no select of a point can be done!
+ return;
+
+ mitk::Point3D noPoint;//dummyPoint... not needed anyway
+ noPoint.Fill(0);
+ mitk::PointOperation* doOp = new mitk::PointOperation(OpSELECTPOINT, noPoint, position);
+ if (m_UndoEnabled)
+ {
+ mitk::PointOperation* undoOp = new mitk::PointOperation(OpDESELECTPOINT, noPoint, position);
+ OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
+ m_UndoController->SetOperationEvent(operationEvent);
+ }
+ pointSet->ExecuteOperation(doOp);
+}
+
+void mitk::FiberBundleInteractor::DeselectAllFibers()
+{
+ MITK_INFO << "mitk::FiberBundleInteractor::DeselectAllFibers ";
+
+ mitk::PointSet* pointSet = dynamic_cast(m_DataNode->GetData());
+ if (pointSet == NULL)
+ return;
+
+ mitk::PointSet::DataType *itkPointSet = pointSet->GetPointSet();
+ mitk::PointSet::PointsContainer::Iterator it, end;
+ end = itkPointSet->GetPoints()->End();
+
+ for (it = itkPointSet->GetPoints()->Begin(); it != end; it++)
+ {
+ int position = it->Index();
+ PointSet::PointDataType pointData = {0, false, PTUNDEFINED};
+ itkPointSet->GetPointData(position, &pointData);
+ if ( pointData.selected )//then declare an operation which unselects this point; UndoOperation as well!
+ {
+ mitk::Point3D noPoint;
+ noPoint.Fill(0);
+
+ mitk::PointOperation* doOp = new mitk::PointOperation(OpDESELECTPOINT, noPoint, position);
+ if (m_UndoEnabled)
+ {
+ mitk::PointOperation* undoOp = new mitk::PointOperation(OpSELECTPOINT, noPoint, position);
+ OperationEvent *operationEvent = new OperationEvent(pointSet, doOp, undoOp);
+ m_UndoController->SetOperationEvent(operationEvent);
+ }
+ pointSet->ExecuteOperation(doOp);
+ }
+ }
+}
+
+float mitk::FiberBundleInteractor::CanHandleEvent(StateEvent const* stateEvent) const
+ //go through all points and check, if the given Point lies near a line
+{
+ float returnValue = 0;
+
+ mitk::PositionEvent const *posEvent = dynamic_cast (stateEvent->GetEvent());
+ //checking if a keyevent can be handled:
+ if (posEvent == NULL)
+ {
+ //check, if the current state has a transition waiting for that key event.
+ if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
+ {
+ return 0.5;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ //Mouse event handling:
+ //on MouseMove do nothing! reimplement if needed differently
+ if (stateEvent->GetEvent()->GetType() == mitk::Type_MouseMove)
+ {
+ return 0;
+ }
+
+ //if the event can be understood and if there is a transition waiting for that event
+ if (this->GetCurrentState()->GetTransition(stateEvent->GetId())!=NULL)
+ {
+ returnValue = 0.5;//it can be understood
+ }
+
+ //check on the right data-type
+ mitk::FiberBundle* bundle = dynamic_cast(m_DataNode->GetData());
+ if (bundle == NULL)
+ return 0;
+
+ return 0.5;
+
+}
+
+
+bool mitk::FiberBundleInteractor::ExecuteAction( Action* action, mitk::StateEvent const* stateEvent )
+{
+ bool ok = false;//for return type bool
+
+ //checking corresponding Data; has to be a PointSet or a subclass
+ mitk::FiberBundle* bundle = dynamic_cast(m_DataNode->GetData());
+ if (bundle == NULL)
+ return false;
+
+ // Get Event and extract renderer
+ const Event *event = stateEvent->GetEvent();
+ BaseRenderer *renderer = NULL;
+ vtkRenderWindow *renderWindow = NULL;
+ vtkRenderWindowInteractor *renderWindowInteractor = NULL;
+ vtkRenderer *currentVtkRenderer = NULL;
+ vtkCamera *camera = NULL;
+
+ if ( event != NULL )
+ {
+ renderer = event->GetSender();
+ if ( renderer != NULL )
+ {
+ renderWindow = renderer->GetRenderWindow();
+ if ( renderWindow != NULL )
+ {
+ renderWindowInteractor = renderWindow->GetInteractor();
+ if ( renderWindowInteractor != NULL )
+ {
+ currentVtkRenderer = renderWindowInteractor
+ ->GetInteractorStyle()->GetCurrentRenderer();
+ if ( currentVtkRenderer != NULL )
+ {
+ camera = currentVtkRenderer->GetActiveCamera();
+ }
+ }
+ }
+ }
+ }
+
+ MITK_INFO << "FiberBundleInteractor Got Action " << action->GetActionId();
+ /*Each case must watch the type of the event!*/
+ switch (action->GetActionId())
+ {
+ case AcCHECKHOVERING:
+ {
+ MITK_INFO << "FiberBundleInteractor AcCHECKOBJECT";
+
+ // Re-enable VTK interactor (may have been disabled previously)
+ if ( renderWindowInteractor != NULL )
+ {
+ renderWindowInteractor->Enable();
+ }
+
+ const DisplayPositionEvent *dpe =
+ dynamic_cast< const DisplayPositionEvent * >( stateEvent->GetEvent() );
+
+ // Check if we have a DisplayPositionEvent
+ if ( dpe != NULL )
+ {
+
+ // Check if an object is present at the current mouse position
+ DataNode *pickedNode = dpe->GetPickedObjectNode();
+ if ( pickedNode != m_DataNode )
+ {
+ MITK_INFO << "NO Hovering";
+ this->HandleEvent( new StateEvent( EIDNOFIGUREHOVER ) );
+
+ ok = true;
+ break;
+ }
+
+ m_CurrentPickedPoint = dpe->GetWorldPosition();
+ m_CurrentPickedDisplayPoint = dpe->GetDisplayPosition();
+
+ MITK_INFO << "YES Hovering";
+ this->HandleEvent( new StateEvent( EIDFIGUREHOVER ) );
+
+ }
+
+ ok = true;
+ break;
+ }
+ break;
+ // case AcSELECTPICKEDOBJECT:
+ // MITK_INFO << "FiberBundleInteractor AcSELECTPICKEDOBJECT";
+
+ // break;
+ // case AcDESELECTALL:
+ // MITK_INFO << "FiberBundleInteractor AcDESELECTALL";
+ // break;
+ case AcREMOVE:
+ {
+ MITK_INFO << "FiberBundleInteractor AcREMOVE";
+
+ MITK_INFO << "removing fiber at " << m_CurrentPickedPoint;
+
+// QmitkStdMultiWidgetEditor::Pointer multiWidgetEditor;
+// multiWidgetEditor->GetStdMultiWidget()->GetRenderWindow1()->GetRenderer()->GetSliceNavigationController()->SelectSliceByPoint(
+// m_CurrentPickedPoint);
+
+ BaseRenderer* renderer = mitk::BaseRenderer::GetByName("stdmulti.widget1");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+
+ renderer = mitk::BaseRenderer::GetByName("stdmulti.widget2");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+
+ renderer = mitk::BaseRenderer::GetByName("stdmulti.widget3");
+ renderer->GetSliceNavigationController()->SelectSliceByPoint(
+ m_CurrentPickedPoint);
+// mitk::RenderingManager::GetInstance()->RequestUpdateAll();
+ }
+ break;
+ default:
+ MITK_INFO << "FiberBundleInteractor NO ACTION";
+ return Superclass::ExecuteAction( action, stateEvent );
+ }
+
+ return ok;
+
+}
+
+
diff --git a/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h
new file mode 100644
index 0000000000..7950065831
--- /dev/null
+++ b/Modules/DiffusionImaging/Interactions/mitkFiberBundleInteractor.h
@@ -0,0 +1,99 @@
+/*=========================================================================
+
+Program: Medical Imaging & Interaction Toolkit
+Language: C++
+Date: $Date: 2008-02-08 13:23:19 +0100 (Fr, 08 Feb 2008) $
+Version: $Revision: 13561 $
+
+Copyright (c) German Cancer Research Center, Division of Medical and
+Biological Informatics. All rights reserved.
+See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
+
+This software is distributed WITHOUT ANY WARRANTY; without even
+the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+PURPOSE. See the above copyright notices for more information.
+
+=========================================================================*/
+
+
+#ifndef MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
+#define MITKFiberBundleINTERACTOR_H_HEADER_INCLUDED
+
+#include "mitkCommon.h"
+#include "MitkExtExports.h"
+#include
+#include
+
+#include
+
+namespace mitk
+{
+ class DataNode;
+
+ //##Documentation
+ //## @brief Just select a point, that's the only way to interact with the point
+ //##
+ //## Interact with a point: Select the point without moving to get parameters that does not change
+ //## All Set-operations would be done through the method "ExecuteAction", if there would be anyone.
+ //## the identificationnumber of this point is set by this points and evalued from an empty place in the DataStructure
+ //## @ingroup Interaction
+ class MitkExt_EXPORT FiberBundleInteractor : public Interactor
+ {
+ public:
+ mitkClassMacro(FiberBundleInteractor, Interactor);
+ mitkNewMacro2Param(Self, const char*, DataNode*);
+
+ //##Documentation
+ //## @brief Sets the amount of precision
+ void SetPrecision(unsigned int precision);
+
+ //##Documentation
+ //## @brief derived from mitk::Interactor; calculates Jurisdiction according to points
+ //##
+ //## standard method can not be used, since it doesn't calculate in points, only in BoundingBox of Points
+ virtual float CanHandleEvent(StateEvent const* stateEvent) const;
+
+
+ protected:
+ //##Documentation
+ //##@brief Constructor
+ FiberBundleInteractor(const char * type, DataNode* dataNode);
+
+ //##Documentation
+ //##@brief Destructor
+ virtual ~FiberBundleInteractor();
+
+ //##Documentation
+ //## @brief select the point on the given position
+ virtual void SelectFiber(int position);
+
+ //##Documentation
+ //## @brief unselect all points that exist in mesh
+ virtual void DeselectAllFibers();
+
+ //##Documentation
+ //## @brief Executes Actions
+ virtual bool ExecuteAction(Action* action, mitk::StateEvent const* stateEvent);
+
+
+ private:
+
+ //##Documentation
+ //## @brief to calculate a direction vector from last point and actual point
+ Point3D m_LastPoint;
+
+ //##Documentation
+ //## @brief to store a position
+ unsigned int m_LastPosition;
+
+// Point3D m_InitialPickedPoint;
+// Point2D m_InitialPickedDisplayPoint;
+// vtkFloatingPointType m_InitialPickedPointWorld[4];
+
+ Point3D m_CurrentPickedPoint;
+ Point2D m_CurrentPickedDisplayPoint;
+ vtkFloatingPointType m_CurrentPickedPointWorld[4];
+
+ };
+}
+#endif /* MITKFiberBundleInteractor_H_HEADER_INCLUDED */
diff --git a/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp
index 126e80b35c..f82e6eb2dd 100644
--- a/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp
+++ b/Modules/DiffusionImaging/Rendering/mitkFiberBundleMapper3D.cpp
@@ -1,1136 +1,1146 @@
/*=========================================================================
Program: Medical Imaging & Interaction Toolkit
Language: C++
Date: $Date: 2009-05-12 19:56:03 +0200 (Di, 12 Mai 2009) $
Version: $Revision: 17179 $
Copyright (c) German Cancer Research Center, Division of Medical and
Biological Informatics. All rights reserved.
See MITKCopyright.txt or http://www.mitk.org/copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "mitkProperties.h"
#include "mitkFiberBundleMapper3D.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "vtkVertex.h"
#include
#include
#include
#include
#include
+#include "mitkFiberBundleInteractor.h"
+#include "mitkGlobalInteraction.h"
+
//template
mitk::FiberBundleMapper3D::FiberBundleMapper3D()
: m_vtkFiberList(NULL),
m_VtkFiberDataMapperGL(NULL),
m_vtkTubeMapper(NULL)
{
//MITK_INFO << "FiberBundleMapper3D()";
m_FiberAssembly = vtkPropAssembly::New();
m_FiberActor = vtkOpenGLActor::New();
m_TubeActor = vtkOpenGLActor::New();
/*
vtkUnsignedCharArray *colorsT = vtkUnsignedCharArray::New();
colorsT->SetName("Colors");
colorsT->SetNumberOfComponents(4);
unsigned char red1[4] = {255, 0, 0 , 10};
colorsT->InsertNextTupleValue(red1);
unsigned char red2[4] = {255,0, 0 , 255};
colorsT->InsertNextTupleValue(red2);
colorsT->SetValue(3, (unsigned char)(255));
colorsT->SetValue(7, (unsigned char)(255));
//Create points for polyline1.
double origin[3] = {100.0, 400.0, 0.0};
double p0[3] = {300.0, 400.0, 0.0};
double p1[3] = {300.0, 200.0, 0.0};
double p2[3] = {100.0, 300.0, 0.0};
double p3[3] = {130.0, 250.0, 0.0};
//create points for polyline2
//double p01[3] = {50.0, 50.0, 13.0};
//double p11[3] = {200.0, 100.0, 13.0};
//insert points to vtkPointarray
vtkPoints *pnts = vtkPoints::New();
pnts->InsertPoint(0,origin);
pnts->InsertPoint(1,p0);
pnts->InsertPoint(2,p1);
pnts->InsertPoint(3,p2);
//pnts->InsertPoint(4,p01);
//pnts->InsertPoint(5,p11);
pnts->InsertPoint(4,p3);
//generate and define polyline1
vtkPolyLine *polyLine = vtkPolyLine::New();
polyLine->GetPointIds()->SetNumberOfIds(4);
polyLine->GetPointIds()->SetId(0,0);
polyLine->GetPointIds()->SetId(1,1);
polyLine->GetPointIds()->SetId(2,2);
polyLine->GetPointIds()->SetId(3,3);
/*generate and define polyline2
vtkPolyLine *polyLine2 = vtkPolyLine::New();
polyLine2->GetPointIds()->SetNumberOfIds(2);
polyLine2->GetPointIds()->SetId(0,4);
polyLine2->GetPointIds()->SetId(1,5);
*/
/*
vtkVertex *vtx = vtkVertex::New();
vtx->GetPointIds()->SetNumberOfIds(1);
vtx->GetPointIds()->SetId(0,4);
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell(polyLine);
//lines->InsertNextCell(vtx);
//lines->InsertNextCell(polyLine2);
vtkCellArray *vertx = vtkCellArray::New();
vertx->InsertNextCell(vtx);
vtkPolyData *polyDataT = vtkPolyData::New();
polyDataT->SetPoints(pnts);
polyDataT->SetLines(lines);
polyDataT->SetVerts(vertx);
//color and opacity handling
vtkUnsignedCharArray *colorT = vtkUnsignedCharArray::New();
colorT->SetName("Colors");
colorT->SetNumberOfComponents(4); //4 components cuz of RGBA
unsigned char rgba[4] = {255,0,0,255};
unsigned char rgba2[4] = {0,255,0,255};
//if just 1 point in there
colorT->InsertNextTupleValue(rgba);
colorT->InsertNextTupleValue(rgba2);
colorT->InsertNextTupleValue(rgba);
colorT->InsertNextTupleValue(rgba2);
colorT->InsertNextTupleValue(rgba);
/*for(int i=0; i<6; i++)
{
double vtkPntTmp[3];
pnts->GetPoint(i, vtkPntTmp);
double vtkPntTmpNxt[3];
pnts->GetPoint(i+1, vtkPntTmpNxt);
vnl_vector_fixed< double, 3 > tmpPntvtk( vtkPntTmp[0], vtkPntTmp[1],vtkPntTmp[2]);
vnl_vector_fixed< double, 3 > nxttmpPntvtk(vtkPntTmpNxt[0], vtkPntTmpNxt[1], vtkPntTmpNxt[2]);
vnl_vector_fixed< double, 3 > diff;
diff = tmpPntvtk - nxttmpPntvtk;
diff.normalize();
rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
rgba[3] = (unsigned char) (255.0);
if(i==3)
{
colorT->InsertNextTupleValue(rgba);
colorT->InsertNextTupleValue(rgba);
}else if(i==4)
{
//do nothing
}else{
colorT->InsertNextTupleValue(rgba);
}
}
/*
unsigned char red[4] = {255, 0, 0 , 20};
unsigned char green[4] = {0, 255, 0 , 190};
unsigned char blue[4] = {0, 0, 255, 255};
unsigned char white[4] = {255, 255, 255, 255};
colorT->InsertNextTupleValue(red); //color for point0
colorT->InsertNextTupleValue(green); //color for point1
colorT->InsertNextTupleValue(blue);
colorT->InsertNextTupleValue(white);
colorT->InsertNextTupleValue(white);
colorT->InsertNextTupleValue(white); //color for point5
polyDataT->GetPointData()->AddArray(colorT);
vtkTubeFilter *tube = vtkTubeFilter::New();
tube->SetInput(polyDataT);
tube->SetNumberOfSides(8);
tube->SetRadius(5);
vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInput(polyDataT);
//mapper->SetInputConnection(tube->GetOutputPort());
mapper->ScalarVisibilityOn();
mapper->SetScalarModeToUsePointFieldData();
//mapper->SetColorModeToMapScalars();
mapper->SelectColorArray("Colors");
vtkSmartPointer actor =
vtkSmartPointer::New();
actor->SetMapper(mapper);
actor->GetProperty()->SetOpacity(1.0);
//actor->GetProperty()->SetLineWidth(20);
actor->GetProperty()->SetPointSize(5.0);
vtkSmartPointer renderer =
vtkSmartPointer::New();
renderer->AddActor(actor);
//renderer->SetBackground(.2, .3, .4);
// Make an oblique view
renderer->GetActiveCamera()->Azimuth(30);
renderer->GetActiveCamera()->Elevation(30);
renderer->ResetCamera();
vtkSmartPointer renWin =
vtkSmartPointer::New();
vtkSmartPointer
iren = vtkSmartPointer::New();
iren->SetRenderWindow(renWin);
renWin->AddRenderer(renderer);
//renWin->LineSmoothingOff();
renWin->SetSize(500, 500);
renWin->Render();
vtkSmartPointer style =
vtkSmartPointer::New();
iren->SetInteractorStyle(style);
iren->Start();
MITK_INFO << "swerwas";
/*
// Spiral tube
double vX, vY, vZ;
unsigned int nV = 256; // No. of vertices
unsigned int nCyc = 5; // No. of spiral cycles
double rT1 = 0.1, rT2 = 0.5;// Start/end tube radii
double rS = 2; // Spiral radius
double h = 10; // Height
unsigned int nTv = 8; // No. of surface elements for each tube vertex
unsigned int i;
// Create points and cells for the spiral
vtkSmartPointer points = vtkSmartPointer::New();
for(i = 0; i < nV; i++)
{
// Spiral coordinates
vX = rS * cos(2 * 3 * nCyc * i / (nV - 1));
vY = rS * sin(2 * 3 * nCyc * i / (nV - 1));
vZ = h * i / nV;
points->InsertPoint(i, vX, vY, vZ);
}
vtkSmartPointer lines =
vtkSmartPointer::New();
lines->InsertNextCell(nV);
for (i = 0; i < nV; i++)
{
lines->InsertCellPoint(i);
}
vtkSmartPointer polyData =
vtkSmartPointer::New();
polyData->SetPoints(points);
polyData->SetLines(lines);
// RBG array (could add Alpha channel too I guess...)
// Varying from blue to red
vtkSmartPointer colors =
vtkSmartPointer::New();
colors->SetName("Colors");
colors->SetNumberOfComponents(3);
colors->SetNumberOfTuples(nV);
for (i = 0; i < nV ;i++)
{
unsigned char red[3] = {char(255 * i/ (nV - 1)),0,char(255 * (nV - 1 - i)/(nV - 1))};
colors->InsertNextTupleValue( red);
}
polyData->GetPointData()->AddArray(colors);
vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInput(polyData);
mapper->ScalarVisibilityOn();
mapper->SetScalarModeToUsePointFieldData();
mapper->SelectColorArray("Colors");
vtkSmartPointer actor =
vtkSmartPointer::New();
actor->SetMapper(mapper);
vtkSmartPointer renderer =
vtkSmartPointer::New();
renderer->AddActor(actor);
renderer->SetBackground(.2, .3, .4);
// Make an oblique view
renderer->GetActiveCamera()->Azimuth(30);
renderer->GetActiveCamera()->Elevation(30);
renderer->ResetCamera();
vtkSmartPointer renWin =
vtkSmartPointer::New();
vtkSmartPointer
iren = vtkSmartPointer::New();
iren->SetRenderWindow(renWin);
renWin->AddRenderer(renderer);
renWin->SetSize(500, 500);
renWin->Render();
vtkSmartPointer style =
vtkSmartPointer::New();
iren->SetInteractorStyle(style);
iren->Start();
/*
double origin[3] = {0.0, 0.0, 0.0};
double p0[3] = {10.0, 0.0, 0.0};
double p1[3] = {10.0, 10.0, 0.0};
double p2[3] = {0.0, 10.0, 0.0};
double p3[3] = {10.0, 10.0, 0.0};
double p4[3] = {10.0, 20.0, 0.0};
double p5[3] = {0.0, 20.0, 0.0};
//create a vtkPoints object and store the points in it
vtkSmartPointer points =
vtkSmartPointer::New();
points->InsertNextPoint(origin);
points->InsertNextPoint(p0);
points->InsertNextPoint(p1);
points->InsertNextPoint(p2);
points->InsertNextPoint(p3);
points->InsertNextPoint(p4);
points->InsertNextPoint(p5);
vtkSmartPointer polyLine =
vtkSmartPointer::New();
polyLine->GetPointIds()->SetNumberOfIds(7);
for(unsigned int i = 0; i < 7; i++)
{
polyLine->GetPointIds()->SetId(i,i);
}
double origin2[3] = {30.0, 0.0, 0.0};
double p02[3] = {40.0, 0.0, 0.0};
double p12[3] = {40.0, 20.0, 0.0};
double p22[3] = {30.0, 20.0, 0.0};
double p23[3] = {30.0, 0.0, 0.0};
points->InsertNextPoint(origin2);
points->InsertNextPoint(p02);
points->InsertNextPoint(p12);
points->InsertNextPoint(p22);
points->InsertNextPoint(p23);
vtkSmartPointer polyLine2 =
vtkSmartPointer::New();
polyLine2->GetPointIds()->SetNumberOfIds(5);
for(unsigned int i = 0; i < 5; i++)
{
polyLine2->GetPointIds()->SetId(i,i+7);
}
//Create a cell array to store the lines in and add the lines to it
vtkSmartPointer cells =
vtkSmartPointer::New();
cells->InsertNextCell(polyLine);
cells->InsertNextCell(polyLine2);
//Create a polydata to store everything in
vtkSmartPointer polyData =
vtkSmartPointer::New();
//add the points to the dataset
polyData->SetPoints(points);
//add the lines to the dataset
polyData->SetLines(cells);
//setup actor and mapper
vtkSmartPointer mapper =
vtkSmartPointer::New();
mapper->SetInput(polyData);
vtkSmartPointer actor =
vtkSmartPointer::New();
actor->SetMapper(mapper);
m_FiberAssembly->AddPart(actor);
*/
}
//template
mitk::FiberBundleMapper3D::~FiberBundleMapper3D()
{
//MITK_INFO << "FiberBundleMapper3D(destructor)";
m_FiberActor->Delete();
m_FiberAssembly->Delete();
//m_vtkFiberList->Delete();
//m_VtkFiberDataMapperGL->Delete();
//m_VtkFiberDataMapper->Delete();
}
const mitk::FiberBundle* mitk::FiberBundleMapper3D::GetInput()
{
//MITK_INFO << "FiberBundleMapper3D GetInput()" ;
return static_cast ( GetData() );
}
/*
This method is called once the mapper gets new input,
for UI rotation or changes in colorcoding this method is NOT called
*/
void mitk::FiberBundleMapper3D::GenerateData()
{
/* ######## FIBER PREPARATION START ######### */
//get fiberbundle
mitk::FiberBundle::Pointer PFiberBundle = dynamic_cast< mitk::FiberBundle* > (this->GetData());
//get groupFiberBundle, which is a datastructure containing single fibers
mitk::FiberBundle::FiberGroupType::Pointer groupFiberBundle = PFiberBundle->GetGroupFiberBundle();
//extractn single fibers
//in the groupFiberBundle all smartPointers to single fibers are stored in in a ChildrenList
mitk::FiberBundle::ChildrenListType * FiberList;
FiberList = groupFiberBundle->GetChildren();
/* ######## FIBER PREPARATION END ######### */
/* ######## VTK FIBER REPRESENTATION ######## */
//create a vtkPoints object and store the all the brainFiber points in it
vtkPoints* vtkSmoothPoints = vtkPoints::New(); //in smoothpoints the interpolated points representing a fiber are stored.
//in vtkcells all polylines are stored, actually all id's of them are stored
vtkCellArray *vtkSmoothCells = vtkCellArray::New(); //cellcontainer for smoothed lines
//in some cases a fiber includes just 1 point, so put it in here
vtkCellArray *vtkVrtxs = vtkCellArray::New();
//colors and alpha value for each single point, RGBA = 4 components
vtkUnsignedCharArray *colorsT = vtkUnsignedCharArray::New();
colorsT->SetNumberOfComponents(4);
colorsT->SetName("ColorValues");
vtkDoubleArray *faColors = vtkDoubleArray::New();
faColors->SetName("FaColors");
vtkDoubleArray *tubeRadius = vtkDoubleArray::New();
tubeRadius->SetName("TubeRadius");
// iterate through FiberList
for(mitk::FiberBundle::ChildrenListType::iterator itLst = FiberList->begin();
itLst != FiberList->end();
++itLst)
{
//all points are stored in one vtkpoints list, soooooooo that the lines find their point id to start and end we need some kind of helper index who monitors the current ids for a polyline
//unsigned long pntIdxHelper = vtkpointsDTI->GetNumberOfPoints();
// lists output is SpatialObject, we know we have DTITubeSpacialObjects
// dynamic cast only likes pointers, no smartpointers, so each dsmartpointer has membermethod .GetPointer()
itk::SpatialObject<3>::Pointer tmp_fbr;
tmp_fbr = *itLst;
mitk::FiberBundle::DTITubeType::Pointer dtiTract = dynamic_cast< mitk::FiberBundle::DTITubeType * > (tmp_fbr.GetPointer());
if (dtiTract.IsNull()) {
return; }
//get list of points
int fibrNrPnts = dtiTract->GetNumberOfPoints();
mitk::FiberBundle::DTITubeType::PointListType dtiPntList = dtiTract->GetPoints();
//MITK_INFO << "REAL AMOUNT OF FIBERS: " << fibrNrPnts;
vtkPoints *vtkpointsDTI = vtkPoints::New();
if (fibrNrPnts <= 0) { //this should never occour! but who knows
MITK_INFO << "HyperERROR in fiberBundleMapper3D.cpp ...no point in fiberBundle!!! .. check ur trackingAlgorithm";
continue;
}
///////PROCESS ON FIBERS////////
for (int i=0; i1
PFiberBundle->GetGeometry()->IndexToWorld(indexPnt, worldPnt);
double worldFbrPnt[3] = {worldPnt[0], worldPnt[1], worldPnt[2]};
vtkpointsDTI->InsertNextPoint(worldFbrPnt);
}
//MITK_INFO << "REDUCED AMOUNT OF FIBERS: " << vtkpointsDTI->GetNumberOfPoints();
////POINTS OF DTI ARE READY FOR FUTHER VTK PROCESSING////
}
/////PROCESS POLYLINE SMOOTHING/////
vtkKochanekSpline* xSpline = vtkKochanekSpline::New();
vtkKochanekSpline* ySpline = vtkKochanekSpline::New();
vtkKochanekSpline* zSpline = vtkKochanekSpline::New();
vtkParametricSpline* spline = vtkParametricSpline::New();
spline->SetXSpline(xSpline);
spline->SetYSpline(ySpline);
spline->SetZSpline(zSpline);
spline->SetPoints(vtkpointsDTI);
vtkParametricFunctionSource* functionSource = vtkParametricFunctionSource::New();
functionSource->SetParametricFunction(spline);
functionSource->SetUResolution(200);
functionSource->SetVResolution(200);
functionSource->SetWResolution(200);
functionSource->Update();
vtkPolyData* outputFunction = functionSource->GetOutput();
vtkPoints* tmpSmoothPnts = outputFunction->GetPoints(); //smoothPoints of current fiber
vtkPolyLine* smoothLine = vtkPolyLine::New();
smoothLine->GetPointIds()->SetNumberOfIds(tmpSmoothPnts->GetNumberOfPoints());
// MITK_INFO << "SMOOTHED AMOUNT OF POINTS:" << tmpSmoothPnts->GetNumberOfPoints();
/////CREATE SMOOTH POLYLINE OBJECT////
/////MANAGE LINE AND CORRELATED POINTS/////
int pointHelperCnt = vtkSmoothPoints->GetNumberOfPoints(); //also put current points into global smooth pointcontainer
int nrSmPnts = tmpSmoothPnts->GetNumberOfPoints();
tubeRadius->SetNumberOfTuples(nrSmPnts);
double tbradius = 1;//default value for radius
for(int ism=0; ismGetPointIds()->SetId(ism, ism+pointHelperCnt);
vtkSmoothPoints->InsertNextPoint(tmpSmoothPnts->GetPoint(ism));
// MITK_INFO << "LinePntID: " << ism << " linked to: " << ism+pointHelperCnt << " val: " << tmpSmoothPnts->GetPoint(ism)[0] << " " << tmpSmoothPnts->GetPoint(ism)[1] << " " << tmpSmoothPnts->GetPoint(ism)[2];
tubeRadius->SetTuple1(ism,tbradius); //tuple with 1 argument
//colorcoding orientation based
unsigned char rgba[4] = {0,0,0,0};
if (ism < nrSmPnts-1 && ism>0)
{
// MITK_INFO << "inbetween fiber, at position:" << ism;
// //nimm nur diff1
vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
vnl_vector_fixed< double, 3 > nxttmpPntvtk(tmpSmoothPnts->GetPoint(ism+1)[0], tmpSmoothPnts->GetPoint(ism+1)[1], tmpSmoothPnts->GetPoint(ism+1)[2]);
vnl_vector_fixed< double, 3 > prevtmpPntvtk(tmpSmoothPnts->GetPoint(ism-1)[0], tmpSmoothPnts->GetPoint(ism-1)[1], tmpSmoothPnts->GetPoint(ism-1)[2]);
vnl_vector_fixed< double, 3 > diff1;
diff1 = tmpPntvtk - nxttmpPntvtk;
diff1.normalize();
vnl_vector_fixed< double, 3 > diff2;
diff2 = tmpPntvtk - prevtmpPntvtk;
diff2.normalize();
vnl_vector_fixed< double, 3 > diff;
diff = (diff1 - diff2)/2.0;
rgba[0] = (unsigned char) (255.0 * std::abs(diff[0]));
rgba[1] = (unsigned char) (255.0 * std::abs(diff[1]));
rgba[2] = (unsigned char) (255.0 * std::abs(diff[2]));
rgba[3] = (unsigned char) (255.0);
} else if(ism==0) {
//explicit handling of startpoint of line
//nimm nur diff1
vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
vnl_vector_fixed< double, 3 > nxttmpPntvtk(tmpSmoothPnts->GetPoint(ism+1)[0], tmpSmoothPnts->GetPoint(ism+1)[1], tmpSmoothPnts->GetPoint(ism+1)[2]);
vnl_vector_fixed< double, 3 > diff1;
diff1 = tmpPntvtk - nxttmpPntvtk;
diff1.normalize();
rgba[0] = (unsigned char) (255.0 * std::abs(diff1[0]));
rgba[1] = (unsigned char) (255.0 * std::abs(diff1[1]));
rgba[2] = (unsigned char) (255.0 * std::abs(diff1[2]));
rgba[3] = (unsigned char) (255.0);
// MITK_INFO << "first point color: " << rgba[0] << " " << rgba[1] << " " << rgba[2];
} else if(ism==nrSmPnts-1) {
// last point in fiber
// nimm nur diff2
vnl_vector_fixed< double, 3 > tmpPntvtk(tmpSmoothPnts->GetPoint(ism)[0], tmpSmoothPnts->GetPoint(ism)[1],tmpSmoothPnts->GetPoint(ism)[2]);
vnl_vector_fixed< double, 3 > prevtmpPntvtk(tmpSmoothPnts->GetPoint(ism-1)[0], tmpSmoothPnts->GetPoint(ism-1)[1], tmpSmoothPnts->GetPoint(ism-1)[2]);
vnl_vector_fixed< double, 3 > diff2;
diff2 = tmpPntvtk - prevtmpPntvtk;
diff2.normalize();
rgba[0] = (unsigned char) (255.0 * std::abs(diff2[0]));
rgba[1] = (unsigned char) (255.0 * std::abs(diff2[1]));
rgba[2] = (unsigned char) (255.0 * std::abs(diff2[2]));
rgba[3] = (unsigned char) (255.0);
//
// MITK_INFO << "last point color: " << rgba[0] << " " << rgba[1] << " " << rgba[2];
} //end colorcoding
//
colorsT->InsertNextTupleValue(rgba);
}//end of smoothline
///////smooth Fiber ready////////
vtkSmoothCells->InsertNextCell(smoothLine);
}
//vtkpointsDTI->Delete();//points are not needed anymore TODO uncomment!
/*
//get FA value ... for that FA has to be interpolated as well as DTItracktLine
float faVal = tmpFiberPntLst.GetField(mitk::FiberBundle::DTITubePointType::FA);
//use insertNextValue cuz FA Values are reperesented as a single number (1 Tuple containing 1 parameter)
faColors->InsertNextValue((double) faVal);
*/
//vtkcells->InitTraversal();
// Put points and lines together in one polyData structure
vtkPolyData *polyData = vtkPolyData::New();
polyData->SetPoints(vtkSmoothPoints);
polyData->SetLines(vtkSmoothCells);
if (vtkVrtxs->GetSize() > 0) {
polyData->SetVerts(vtkVrtxs);
}
polyData->GetPointData()->AddArray(colorsT);
//polyData->GetPointData()->AddArray(faColors);
//polyData->GetPointData()->AddArray(tubeRadius);
vtkLookupTable *lut = vtkLookupTable::New();
lut->Build();
m_VtkFiberDataMapperGL = vtkOpenGLPolyDataMapper::New();
m_VtkFiberDataMapperGL->SetInput(polyData);
m_VtkFiberDataMapperGL->ScalarVisibilityOn();
m_VtkFiberDataMapperGL->SetScalarModeToUsePointFieldData();
//m_VtkFiberDataMapperGL->SelectColorArray("FaColors");
m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
m_VtkFiberDataMapperGL->SetLookupTable(lut);
m_vtkTubeMapper = vtkOpenGLPolyDataMapper::New();
//m_FiberActor = vtkOpenGLActor::New();
m_FiberActor->SetMapper(m_VtkFiberDataMapperGL);
m_FiberActor->GetProperty()->SetOpacity(1.0);
m_FiberActor->GetProperty()->SetPointSize(4.0f);
// m_FiberActor->GetProperty()->SetColor(255.0, 0.0, 0.0);
m_FiberAssembly->AddPart(m_FiberActor);
//setting color and opacity in the fiberActor itself is not recommended
//here cuz color and opacity of dataNode will be considered in GetData(baserenderer*) anyway
this->GetDataNode()->SetColor(255.0,0,0);
this->GetDataNode()->SetOpacity(1.0);
}
//template
void mitk::FiberBundleMapper3D::GenerateData( mitk::BaseRenderer *renderer )
{
//MITK_INFO << "FiberBundleMapper3D GenerateData(BaseRenderer)" ;
// nodeCC = 1 ... ROI colorcoding
// 2 ... orientation colorcoding
// 3 ... FA colorcoding
int nodeCC;
bool isCCd = this->GetDataNode()->GetPropertyValue("ColorCoding", nodeCC);
if ( isCCd && nodeCC == 1 ) {
//get color and opacity from DataNode
int tmpline;
bool isLineProp = this->GetDataNode()->GetPropertyValue("LineWidth",tmpline);
bool isPointRep;
bool successPointProp = this->GetDataNode()->GetPropertyValue("RepPoints", isPointRep);
float pointSize;
bool successPointSize = this->GetDataNode()->GetPropertyValue("pointSize", pointSize);
if (isLineProp) {
m_FiberActor->GetProperty()->SetLineWidth(tmpline);
}
if(isPointRep) {
m_FiberActor->GetProperty()->SetRepresentationToPoints();
m_FiberActor->GetProperty()->SetPointSize(pointSize);
}
} else if (isCCd && nodeCC == 2) {
float tmpopa;
this->GetDataNode()->GetOpacity(tmpopa, NULL);
m_FiberActor->GetProperty()->SetOpacity((double) tmpopa);
} else if (isCCd && nodeCC == 3) {
float temprgb[3];
this->GetDataNode()->GetColor( temprgb, NULL );
double trgb[3] = { (double) temprgb[0], (double) temprgb[1], (double) temprgb[2] };
m_FiberActor->GetProperty()->SetColor(trgb);
if(m_VtkFiberDataMapperGL->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
{
m_VtkFiberDataMapperGL->ScalarVisibilityOff();
}
} else if (isCCd && nodeCC == 4) {
if(!m_VtkFiberDataMapperGL->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
{
m_VtkFiberDataMapperGL->ScalarVisibilityOn();
}
m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
} else if (isCCd && nodeCC == 5){
if(!m_VtkFiberDataMapperGL->GetScalarVisibility()) //if visibility is off, switch it on
{
m_VtkFiberDataMapperGL->ScalarVisibilityOn();
}
m_VtkFiberDataMapperGL->SelectColorArray("FaColors");
} else if (isCCd && nodeCC == 6){
//orientationbased colorcoding + FA as opacity
//get FA out of polydata, which is saved in faColor vtkDoubleArray
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
vtkPointData *tmpPointData = tmpPolyData->GetPointData();
int hasAr = tmpPointData->HasArray("FaColors");
if(!hasAr)
return;
vtkDoubleArray *tmpFAarray = (vtkDoubleArray*)(tmpPointData->GetArray("FaColors")) ;
/*for(int i=0; iGetNumberOfTuples(); i++)
{
double *tmpTuple;
tmpFAarray->GetTuple(i, tmpTuple);
for(int j=0; jGetNumberOfComponents(); j++)
{
MITK_INFO << "FA Value: at index " << i << ": " << tmpTuple[j];
}
}
*/
//since we have our FA values, lets replace the alpha values in colorT
//we know each 4th entry is a A value of RGBA
int hasArCV = tmpPointData->HasArray("ColorValues");
if(!hasArCV)
return;
vtkUnsignedCharArray *colorsTtmp = dynamic_cast (tmpPointData->GetArray("ColorValues"));
for(int i=0; iGetNumberOfTuples(); i++)
{
//double *tmpTupleCV = colorsTtmp->GetTuple4(i);
double tmpTupleFA = tmpFAarray->GetTuple1(i);
tmpTupleFA = tmpTupleFA * 255.0;
colorsTtmp->SetComponent(i,3, tmpTupleFA );
// MITK_INFO << "----" << i;
//MITK_INFO << tmpTupleCV[0];
//MITK_INFO << tmpTupleCV[1];
//MITK_INFO << tmpTupleCV[2];
//MITK_INFO << tmpTupleCV[3];
//double *test = m_VtkFiberDataMapperGL->GetInput()->GetPointData()->GetArray("ColorValues")->GetTuple4(i);
//MITK_INFO << test[0];
//MITK_INFO << test[1];
//MITK_INFO << test[2];
//MITK_INFO << test[3];
}
m_VtkFiberDataMapperGL->SelectColorArray("");
m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
} else if (isCCd && nodeCC == 7){
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
vtkPointData *tmpPointData = tmpPolyData->GetPointData();
int hasArCV = tmpPointData->HasArray("ColorValues");
if(!hasArCV)
return;
vtkUnsignedCharArray *colorsTtmp = dynamic_cast (tmpPointData->GetArray("ColorValues"));
for(int i=0; iGetNumberOfTuples(); i++)
{
double tmpTupleFA = 255.0;
colorsTtmp->SetComponent(i,3, tmpTupleFA );
}
m_VtkFiberDataMapperGL->SelectColorArray("");
m_VtkFiberDataMapperGL->SelectColorArray("ColorValues");
} else if (isCCd && nodeCC == 8) {
/* something is still missing to activate smoothing or make it work.... */
if (!renderer->GetRenderWindow()->GetLineSmoothing()) {
renderer->GetRenderWindow()->SetLineSmoothing(1);
renderer->GetRenderWindow()->Modified();
}
if (!renderer->GetRenderWindow()->GetPointSmoothing()) {
renderer->GetRenderWindow()->SetPointSmoothing(1);
renderer->GetRenderWindow()->Modified();
}
if (!renderer->GetRenderWindow()->GetPolygonSmoothing()) {
renderer->GetRenderWindow()->SetPolygonSmoothing(1);
renderer->GetRenderWindow()->Modified();
}
} else if (isCCd && nodeCC == 9) {
if (renderer->GetRenderWindow()->GetLineSmoothing()) {
renderer->GetRenderWindow()->SetLineSmoothing(0);
renderer->GetRenderWindow()->Modified();
}
if (renderer->GetRenderWindow()->GetPointSmoothing()) {
renderer->GetRenderWindow()->SetPointSmoothing(0);
renderer->GetRenderWindow()->Modified();
}
if (renderer->GetRenderWindow()->GetPolygonSmoothing()) {
renderer->GetRenderWindow()->SetPolygonSmoothing(0);
renderer->GetRenderWindow()->Modified();
}
} else if (isCCd && nodeCC == 10) {
// manipulate X Coordinates of selected FiberBundle
int tmpXmove;
bool isXmove = this->GetDataNode()->GetPropertyValue("Xmove",tmpXmove);
if (!isXmove)
return;
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
double PtmpPntVal[3];
for (int i=0; iGetNumberOfPoints(); ++i )
{
tmpVtkPnts->GetPoint(i,PtmpPntVal);
PtmpPntVal[0] = PtmpPntVal[0] + (double) tmpXmove;
tmpVtkPnts->SetPoint(i, PtmpPntVal);
tmpPolyData->Modified();
}
} else if (isCCd && nodeCC == 11) {
// manipulate Y Coordinates of selected FiberBundle
int tmpYmove;
bool isYmove = this->GetDataNode()->GetPropertyValue("Ymove",tmpYmove);
if (!isYmove)
return;
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
double PtmpPntVal[3];
for (int i=0; iGetNumberOfPoints(); ++i )
{
tmpVtkPnts->GetPoint(i,PtmpPntVal);
PtmpPntVal[1] = PtmpPntVal[1] + (double) tmpYmove;
tmpVtkPnts->SetPoint(i, PtmpPntVal);
tmpPolyData->Modified();
}
} else if (isCCd && nodeCC == 12) {
// manipulate Z Coordinates of selected FiberBundle
int tmpZmove;
bool isZmove = this->GetDataNode()->GetPropertyValue("Zmove",tmpZmove);
if (!isZmove)
return;
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
vtkPoints* tmpVtkPnts = tmpPolyData->GetPoints();
double PtmpPntVal[3];
for (int i=0; iGetNumberOfPoints(); ++i )
{
tmpVtkPnts->GetPoint(i,PtmpPntVal);
PtmpPntVal[2] = PtmpPntVal[2] + (double) tmpZmove;
//PtmpPntVal[2] = PtmpPntVal[2] + 1;
tmpVtkPnts->SetPoint(i, PtmpPntVal);
tmpPolyData->Modified();
}
} else if (isCCd && nodeCC == 13) {
int tmpTubeSides;
bool isTubeSides = this->GetDataNode()->GetPropertyValue("TubeSides",tmpTubeSides);
float tmpRadius;
bool isRadius = this->GetDataNode()->GetPropertyValue("TubeRadius",tmpRadius);
if (!isTubeSides)
return;
vtkPolyData *tmpPolyData = m_VtkFiberDataMapperGL->GetInput();
m_tubes = vtkTubeFilter::New();
m_tubes->SetInput(tmpPolyData);
m_tubes->SidesShareVerticesOn();
m_tubes->SetRadius((double)(tmpRadius));
m_tubes->SetNumberOfSides(tmpTubeSides);
m_tubes->Modified();
// m_tubes->Update();
m_vtkTubeMapper->SetInputConnection(m_tubes->GetOutputPort());
m_vtkTubeMapper->ScalarVisibilityOn();
m_vtkTubeMapper->SetScalarModeToUsePointFieldData();
m_vtkTubeMapper->SelectColorArray("");
m_vtkTubeMapper->SelectColorArray("ColorValues");
m_TubeActor->SetMapper(m_vtkTubeMapper);
m_TubeActor->GetProperty()->SetOpacity(1);
m_TubeActor->GetProperty()->BackfaceCullingOn();
m_FiberAssembly->AddPart(m_TubeActor);
m_FiberAssembly->Modified();
} else if (isCCd && nodeCC == 14) {
float temprgb[3];
this->GetDataNode()->GetColor( temprgb, NULL );
double trgb[3] = { (double) temprgb[0], (double) temprgb[1], (double) temprgb[2] };
m_TubeActor->GetProperty()->SetColor(trgb);
if(m_vtkTubeMapper->GetScalarVisibility()) //can be 0 or 1, for scalarVis On or Off
{
m_vtkTubeMapper->ScalarVisibilityOff();
}
} else if (isCCd && nodeCC == 15) {
m_TubeActor->GetProperty()->SetOpacity(0);
m_FiberAssembly->RemovePart(m_TubeActor);
m_FiberAssembly->Modified();
}else if (isCCd && nodeCC == 16) {
float tmpTubeOpacity;
bool isTubeOpacity = this->GetDataNode()->GetPropertyValue("TubeOpacity",tmpTubeOpacity);
m_TubeActor->GetProperty()->SetOpacity((double) tmpTubeOpacity);
m_TubeActor->Modified();
} else if (isCCd && nodeCC == 17) {
m_FiberActor->GetProperty()->SetOpacity(0);
m_FiberAssembly->RemovePart(m_FiberActor);
m_FiberAssembly->Modified();
}else if (isCCd && nodeCC == 18) {
m_FiberActor->GetProperty()->SetOpacity(0);
m_FiberAssembly->AddPart(m_FiberActor);
m_FiberAssembly->Modified();
}
//MITK_INFO << m_VtkFiberDataMapperGL->GetArrayName();
/* int displayIndex(0);
this->GetDataNode()->GetIntProperty( "DisplayChannel", displayIndex, renderer );
InputImageType *input = const_cast< InputImageType* >(
this->GetInput()
);
mitk::DiffusionImage *input2 = dynamic_cast< mitk::DiffusionImage* >(
input
);
input2->SetDisplayIndexForRendering(displayIndex);
Superclass::GenerateData(renderer);
*/
}
//template
void mitk::FiberBundleMapper3D::SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer, bool overwrite)
{
//MITK_INFO << "FiberBundleMapper3D SetDefault Properties(...)";
node->AddProperty( "DisplayChannel", mitk::IntProperty::New( true ), renderer, overwrite );
node->AddProperty( "LineWidth", mitk::IntProperty::New( true ), renderer, overwrite );
node->AddProperty( "ColorCoding", mitk::IntProperty::New( 0 ), renderer, overwrite);
node->AddProperty( "VertexOpacity_1", mitk::BoolProperty::New( false ), renderer, overwrite);
node->AddProperty( "Set_FA_VertexAlpha", mitk::BoolProperty::New( false ), renderer, overwrite);
node->AddProperty( "pointSize", mitk::FloatProperty::New(0.5), renderer, overwrite);
node->AddProperty( "setShading", mitk::IntProperty::New(1), renderer, overwrite);
node->AddProperty( "Xmove", mitk::IntProperty::New( 0 ), renderer, overwrite);
node->AddProperty( "Ymove", mitk::IntProperty::New( 0 ), renderer, overwrite);
node->AddProperty( "Zmove", mitk::IntProperty::New( 0 ), renderer, overwrite);
node->AddProperty( "RepPoints", mitk::BoolProperty::New( false ), renderer, overwrite);
node->AddProperty( "TubeSides", mitk::IntProperty::New( 8 ), renderer, overwrite);
node->AddProperty( "TubeRadius", mitk::FloatProperty::New( 0.15 ), renderer, overwrite);
node->AddProperty( "TubeOpacity", mitk::FloatProperty::New( 1.0 ), renderer, overwrite);
-
+
+ node->AddProperty( "pickable", mitk::BoolProperty::New( true ), renderer, overwrite);
+
+ mitk::FiberBundleInteractor::Pointer bundleInteractor = dynamic_cast(node->GetInteractor());
+ if(bundleInteractor.IsNull())
+ bundleInteractor = mitk::FiberBundleInteractor::New("FiberBundleInteractor", node);
+ mitk::GlobalInteraction::GetInstance()->AddInteractor(bundleInteractor);
+
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
vtkProp* mitk::FiberBundleMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
//MITK_INFO << "FiberBundleMapper3D GetVtkProp(renderer)";
return m_FiberAssembly;
}
void mitk::FiberBundleMapper3D::ApplyProperties(mitk::BaseRenderer* renderer)
{
// MITK_INFO << "FiberBundleMapper3D ApplyProperties(renderer)";
}
void mitk::FiberBundleMapper3D::UpdateVtkObjects()
{
// MITK_INFO << "FiberBundleMapper3D UpdateVtkObjects()";
}
void mitk::FiberBundleMapper3D::SetVtkMapperImmediateModeRendering(vtkMapper *)
{
}
diff --git a/Modules/DiffusionImaging/files.cmake b/Modules/DiffusionImaging/files.cmake
index f9771d1825..cbd8416aae 100644
--- a/Modules/DiffusionImaging/files.cmake
+++ b/Modules/DiffusionImaging/files.cmake
@@ -1,92 +1,94 @@
SET(CPP_FILES
# Algorithms
Algorithms/itkDiffusionQballGeneralizedFaImageFilter.h
Algorithms/itkDiffusionQballPrepareVisualizationImageFilter.h
Algorithms/itkTensorDerivedMeasurementsFilter.h
Algorithms/itkBrainMaskExtractionImageFilter.h
Algorithms/itkB0ImageExtractionImageFilter.h
Algorithms/itkTensorImageToDiffusionImageFilter.h
Algorithms/itkTensorToL2NormImageFilter.h
# DicomImport
DicomImport/mitkDicomDiffusionImageReader.cpp
DicomImport/mitkGroupDiffusionHeadersFilter.cpp
DicomImport/mitkDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkGEDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkPhilipsDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkSiemensDicomDiffusionImageHeaderReader.cpp
DicomImport/mitkSiemensMosaicDicomDiffusionImageHeaderReader.cpp
# DataStructures
IODataStructures/mitkDiffusionImagingObjectFactory.cpp
# DataStructures -> DWI
IODataStructures/DiffusionWeightedImages/mitkDiffusionImageHeaderInformation.cpp
IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSource.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageReader.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriter.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageIOFactory.cpp
IODataStructures/DiffusionWeightedImages/mitkNrrdDiffusionImageWriterFactory.cpp
IODataStructures/DiffusionWeightedImages/mitkDiffusionImageSerializer.cpp
# DataStructures -> QBall
IODataStructures/QBallImages/mitkQBallImageSource.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageReader.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageWriter.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageIOFactory.cpp
IODataStructures/QBallImages/mitkNrrdQBallImageWriterFactory.cpp
IODataStructures/QBallImages/mitkQBallImage.cpp
IODataStructures/QBallImages/mitkQBallImageSerializer.cpp
# DataStructures -> Tensor
IODataStructures/TensorImages/mitkTensorImageSource.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageReader.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageWriter.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageIOFactory.cpp
IODataStructures/TensorImages/mitkNrrdTensorImageWriterFactory.cpp
IODataStructures/TensorImages/mitkTensorImage.cpp
IODataStructures/TensorImages/mitkTensorImageSerializer.cpp
# DataStructures -> FiberBundle
IODataStructures/FiberBundle/mitkFiberBundle.cpp
IODataStructures/FiberBundle/mitkFiberBundleWriter.cpp
IODataStructures/FiberBundle/mitkFiberBundleReader.cpp
IODataStructures/FiberBundle/mitkFiberBundleIOFactory.cpp
IODataStructures/FiberBundle/mitkFiberBundleWriterFactory.cpp
IODataStructures/FiberBundle/mitkFiberBundleSerializer.cpp
# DataStructures -> PlanarFigureComposite
IODataStructures/PlanarFigureComposite/mitkPlanarFigureComposite.cpp
# Rendering
Rendering/vtkMaskedProgrammableGlyphFilter.cpp
Rendering/mitkCompositeMapper.cpp
Rendering/mitkVectorImageVtkGlyphMapper3D.cpp
Rendering/vtkOdfSource.cxx
Rendering/vtkThickPlane.cxx
Rendering/mitkOdfNormalizationMethodProperty.cpp
Rendering/mitkOdfScaleByProperty.cpp
Rendering/mitkFiberBundleMapper3D.cpp
+ # Interactions
+ Interactions/mitkFiberBundleInteractor.cpp
)
SET(H_FILES
Rendering/mitkDiffusionImageMapper.h
Reconstruction/itkDiffusionQballReconstructionImageFilter.h
Reconstruction/mitkTeemDiffusionTensor3DReconstructionImageFilter.h
Reconstruction/itkAnalyticalDiffusionQballReconstructionImageFilter.h
Reconstruction/itkPointShell.h
Reconstruction/itkOrientationDistributionFunction.h
IODataStructures/DiffusionWeightedImages/mitkDiffusionImage.h
IODataStructures/FiberBundle/itkSlowPolyLineParametricPath.h
Rendering/mitkOdfVtkMapper2D.h
)
SET( TOOL_FILES
)
IF(WIN32)
ENDIF(WIN32)
#MITK_MULTIPLEX_PICTYPE( Algorithms/mitkImageRegistrationMethod-TYPE.cpp )
diff --git a/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml b/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
index 153e87943f..69c850a546 100644
--- a/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
+++ b/Modules/MitkExt/Interactions/mitkEventAndActionConstants.xml
@@ -1,365 +1,369 @@
+
+
+
+