Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
FLmitkComfortWidget.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include <Fl/Fl.h>
18 #include "FLmitkComfortWidget.h"
19 //#include "mitkLevelWindow.h"
20 //
21 FLmitkComfortWidget::FLmitkComfortWidget(int x,int y,int w,int h,const char* label) : FLmitkRenderWindow(x,y,w,h,label) {
22 
23 }
25  switch(event) {
26  case FL_MOUSEWHEEL:
27  if (Fl::event_dy() > 0) {
28  sliceCtrl->GetSlice()->Next();
29  } else {
30  sliceCtrl->GetSlice()->Previous();
31  }
32  GetRenderer()->Render();
33  draw();
34  return 1;
35  break;
36  case FL_PUSH:
37  m_LastX = Fl::event_x();
38  m_LastY = Fl::event_y();
39  return 1;
40  break;
41  case FL_DRAG:
42  int dx = Fl::event_x() - m_LastX;
43  int dy = Fl::event_y() - m_LastY;
44  m_LastX = Fl::event_x();
45  m_LastY = Fl::event_y();
46  mitk::LevelWindow lvlWin;
47  if (m_Node.IsNotNull() && m_Node->GetLevelWindow(lvlWin,GetRenderer())) {
48  lvlWin.SetLevelWindow(lvlWin.GetLevel() + dy, lvlWin.GetWindow() + dx);
49  m_Node->SetLevelWindow(lvlWin,GetRenderer());
50  m_Node->SetLevelWindow(lvlWin,NULL);
51  GetRenderer()->Render();
52  draw();
53  }
54  return 1;
55  }
56  return FLmitkRenderWindow::handle(event);
57 }
58 
mitk::DataNode::Pointer m_Node
FLmitkComfortWidget(int x, int y, int w, int h, const char *label=NULL)
mitk::SliceNavigationController::Pointer sliceCtrl
The LevelWindow class Class to store level/window values.
void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary=true)
ScalarType GetWindow() const
returns the current window size, i.e the range size of the current grey value interval ...
ScalarType GetLevel() const
method that returns the level value, i.e. the center of the current grey value interval ...