Medical Imaging Interaction Toolkit  2018.4.99-a3d2e8fb
Medical Imaging Interaction Toolkit
mitkLevelWindowManager.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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "mitkLevelWindowManager.h"
14 #include "mitkDataStorage.h"
15 #include "mitkImage.h"
16 #include "mitkMessage.h"
17 #include "mitkNodePredicateAnd.h"
18 #include "mitkNodePredicateBase.h"
20 #include "mitkNodePredicateNot.h"
21 #include "mitkNodePredicateOr.h"
23 #include "mitkProperties.h"
25 #include <itkCommand.h>
26 
28  : m_DataStorage(nullptr)
29  , m_LevelWindowProperty(nullptr)
30  , m_AutoTopMost(true)
31  , m_SelectedImagesMode(false)
32  , m_IsObserverTagSet(false)
33  , m_CurrentImage(nullptr)
34  , m_IsPropertyModifiedTagSet(false)
35  , m_LevelWindowMutex(false)
36 {
37 }
38 
40 {
41  if (m_DataStorage.IsNotNull())
42  {
43  m_DataStorage->AddNodeEvent.RemoveListener(
45  m_DataStorage->RemoveNodeEvent.RemoveListener(
47  m_DataStorage = nullptr;
48  }
49 
51  {
54  }
55 
56  // clear both observer maps
57  this->ClearPropObserverLists();
58 }
59 
61 {
62  if (ds == nullptr)
63  return;
64 
65  /* remove listeners of old DataStorage */
66  if (m_DataStorage.IsNotNull())
67  {
68  m_DataStorage->AddNodeEvent.RemoveListener(
70  m_DataStorage->RemoveNodeEvent.RemoveListener(
72  }
73 
74  /* register listener for new DataStorage */
75  m_DataStorage = ds; // register
76  m_DataStorage->AddNodeEvent.AddListener(
78  m_DataStorage->RemoveNodeEvent.AddListener(
80 
81  this->DataStorageAddedNode(); // update us with new DataStorage
82 }
83 
85 {
86  return m_DataStorage.GetPointer();
87 }
88 
89 void mitk::LevelWindowManager::SetAutoTopMostImage(bool autoTopMost, const DataNode *removedNode/* = nullptr*/)
90 {
91  m_AutoTopMost = autoTopMost;
92  if (false == m_AutoTopMost)
93  {
94  return;
95  }
96 
97  // deactivate other mode
98  m_SelectedImagesMode = false;
99 
101  {
104  }
105 
106  // find topmost image in the data storage
107  if (m_DataStorage.IsNull())
108  {
109  mitkThrow() << "DataStorage not set";
110  }
111 
112  DataNode::Pointer topLevelNode;
113  int maxVisibleLayer = itk::NumericTraits<int>::min();
114  m_LevelWindowProperty = nullptr;
115  m_CurrentImage = nullptr;
116 
117  DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes();
118  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
119  {
120  DataNode::Pointer node = it->Value();
121  if (node.IsNull() || node == removedNode)
122  {
123  continue;
124  }
125 
126  m_LevelWindowMutex = true;
127  node->SetBoolProperty("imageForLevelWindow", false);
128  m_LevelWindowMutex = false;
129 
130  if (false == node->IsVisible(nullptr))
131  {
132  continue;
133  }
134 
135  int layer = -1;
136  node->GetIntProperty("layer", layer);
137  if (layer < maxVisibleLayer)
138  {
139  continue;
140  }
141 
142  bool ignore = this->IgnoreNode(node);
143  if (ignore)
144  {
145  continue;
146  }
147 
148  m_LevelWindowProperty = dynamic_cast<LevelWindowProperty*>(node->GetProperty("levelwindow"));
149  topLevelNode = node;
150  maxVisibleLayer = layer;
151  }
152 
153  // this will set the "imageForLevelWindow" property and the 'm_CurrentImage' and call 'Modified()'
155 
156  if (m_LevelWindowProperty.IsNull())
157  {
158  this->Modified();
159  }
160 }
161 
162 void mitk::LevelWindowManager::SetSelectedImages(bool selectedImagesMode, const DataNode *removedNode/* = nullptr*/)
163 {
164  m_SelectedImagesMode = selectedImagesMode;
165  if (false == m_SelectedImagesMode)
166  {
167  return;
168  }
169 
170  // deactivate other mode
171  m_AutoTopMost = false;
172 
174  {
177  }
178 
179  // find selected images in the data storage
180  if (m_DataStorage.IsNull())
181  {
182  mitkThrow() << "DataStorage not set";
183  }
184 
185  DataNode::Pointer lastSelectedNode;
186  m_LevelWindowProperty = nullptr;
187  m_CurrentImage = nullptr;
188 
189  DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes();
190  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
191  {
192  DataNode::Pointer node = it->Value();
193  if (node.IsNull() || node == removedNode)
194  {
195  continue;
196  }
197 
198  m_LevelWindowMutex = true;
199  node->SetBoolProperty("imageForLevelWindow", false);
200  m_LevelWindowMutex = false;
201 
202  if (false == node->IsSelected())
203  {
204  continue;
205  }
206 
207  bool ignore = this->IgnoreNode(node);
208  if (ignore)
209  {
210  continue;
211  }
212 
213  m_LevelWindowProperty = dynamic_cast<LevelWindowProperty*>(node->GetProperty("levelwindow"));
214  m_RelevantDataNodes.push_back(node);
215  lastSelectedNode = node;
216  }
217 
218  // this will set the "imageForLevelWindow" property and the 'm_CurrentImage' and call 'Modified()'
220 
221  if (m_LevelWindowProperty.IsNull())
222  {
223  this->Modified();
224  }
225 }
226 
228 {
229  DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes();
230  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
231  {
232  DataNode::Pointer node = it->Value();
233  if (node.IsNull())
234  continue;
235 
236  bool isSelected = false;
237  node->GetBoolProperty("selected", isSelected);
238  if (isSelected)
239  {
240  LevelWindow selectedLevelWindow;
241  node->GetLevelWindow(selectedLevelWindow); // node is an image node because of predicates
242 
243  auto *image = dynamic_cast<Image *>(node->GetData());
244  int displayedComponent = 0;
245  if (image && (node->GetIntProperty("Image.Displayed Component", displayedComponent)))
246  { // we found a selected image with a displayed component
247  // let's recalculate the levelwindow for this.
248  selectedLevelWindow.SetAuto(image, true, true, static_cast<unsigned>(displayedComponent));
249  node->SetLevelWindow(selectedLevelWindow);
250  }
251  }
252 
253  LevelWindow levelWindow;
254  node->GetLevelWindow(levelWindow);
255  }
256 
257  this->Update(event);
258 }
259 
260 void mitk::LevelWindowManager::Update(const itk::EventObject &)
261 {
262  if (m_LevelWindowMutex) // no mutex, should still help
263  {
264  return;
265  }
266 
267  m_RelevantDataNodes.clear();
268  if (m_AutoTopMost)
269  {
270  this->SetAutoTopMostImage(true);
271  return;
272  }
273 
275  {
276  this->SetSelectedImages(true);
277  return;
278  }
279 
280  int maxVisibleLayer = itk::NumericTraits<int>::min();
281  DataNode::Pointer topLevelNode = nullptr;
282  std::vector<DataNode::Pointer> nodesForLevelWindow;
283 
284  DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes();
285  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
286  {
287  DataNode::Pointer node = it->Value();
288 
289  if (node.IsNull())
290  {
291  continue;
292  }
293 
294  if (node->IsVisible(nullptr) == false)
295  {
296  continue;
297  }
298 
299  bool prop = false;
300  node->GetBoolProperty("imageForLevelWindow", prop);
301  if (prop)
302  {
303  nodesForLevelWindow.push_back(node);
304  continue;
305  }
306 
307  int layer = -1;
308  node->GetIntProperty("layer", layer);
309  if (layer > maxVisibleLayer)
310  {
311  // top level node is backup node, if no node with
312  // "imageForLevelWindow" property with value "true" is found
313  topLevelNode = node;
314  maxVisibleLayer = layer;
315  }
316  }
317 
318  int nodesForLevelWindowSize = nodesForLevelWindow.size();
319  if (nodesForLevelWindowSize > 2)
320  {
321  MITK_ERROR << "Error: not more than two visible nodes are expected to have the imageForLevelWindow property set at "
322  "any point.";
323  }
324 
325  if (nodesForLevelWindowSize > 0)
326  {
327  // 1 or 2 nodes for level window found
328  for (const auto& node : nodesForLevelWindow)
329  {
330  LevelWindowProperty::Pointer newProp = dynamic_cast<LevelWindowProperty *>(node->GetProperty("levelwindow"));
331  if (newProp != m_LevelWindowProperty)
332  {
333  this->SetLevelWindowProperty(newProp);
334  return;
335  }
336  }
337  }
338  else if (topLevelNode)
339  {
340  // no nodes for level window found
341  LevelWindowProperty::Pointer lvlProp = dynamic_cast<LevelWindowProperty *>(topLevelNode->GetProperty("levelwindow"));
342  this->SetLevelWindowProperty(lvlProp);
343  }
344  else
345  {
346  // no nodes for level window found and no visible top level node found
347  this->Modified();
348  }
349 }
350 
351 void mitk::LevelWindowManager::UpdateSelected(const itk::EventObject &)
352 {
353  if (m_LevelWindowMutex) // no mutex, should still help
354  {
355  return;
356  }
357 
358  m_RelevantDataNodes.clear();
360  {
361  this->SetSelectedImages(true);
362  }
363 }
364 
366 {
367  if (levelWindowProperty.IsNull())
368  {
369  return;
370  }
371 
372  // find data node that belongs to the property
373  DataStorage::SetOfObjects::ConstPointer all = m_DataStorage->GetAll();
374  mitk::DataNode::Pointer propNode = nullptr;
375  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
376  {
377  DataNode::Pointer node = it.Value();
378  LevelWindowProperty::Pointer property = dynamic_cast<LevelWindowProperty *>(node->GetProperty("levelwindow"));
379  if (property == levelWindowProperty)
380  {
381  propNode = node;
382  }
383  else
384  {
385  m_LevelWindowMutex = true;
386  node->SetBoolProperty("imageForLevelWindow", false);
387  m_LevelWindowMutex = false;
388  }
389  }
390 
391  if (propNode.IsNull())
392  {
393  mitkThrow() << "No Image in the data storage that belongs to level-window property " << m_LevelWindowProperty;
394  }
395 
396  if (m_IsPropertyModifiedTagSet) // remove listener for old property
397  {
400  }
401 
402  m_LevelWindowProperty = levelWindowProperty;
403 
404  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command =
405  itk::ReceptorMemberCommand<LevelWindowManager>::New(); // register listener for new property
406  command->SetCallbackFunction(this, &LevelWindowManager::OnPropertyModified);
407  m_PropertyModifiedTag = m_LevelWindowProperty->AddObserver(itk::ModifiedEvent(), command);
409 
410  m_CurrentImage = dynamic_cast<Image *>(propNode->GetData());
411 
412  m_LevelWindowMutex = true;
413  propNode->SetBoolProperty("imageForLevelWindow", true);
414  m_LevelWindowMutex = false;
415 
416  this->Modified();
417 }
418 
420 {
421  if (m_LevelWindowProperty.IsNotNull())
422  {
423  m_LevelWindowProperty->SetLevelWindow(levelWindow);
424  for (const auto &dataNode : m_RelevantDataNodes)
425  {
426  auto levelWindowProperty = dynamic_cast<LevelWindowProperty *>(dataNode->GetProperty("levelwindow"));
427  if (nullptr == levelWindowProperty)
428  {
429  continue;
430  }
431 
432  levelWindowProperty->SetLevelWindow(levelWindow);
433  }
434  }
435  this->Modified();
436 }
437 
439 {
440  return m_LevelWindowProperty;
441 }
442 
444 {
445  if (m_LevelWindowProperty.IsNotNull())
446  {
447  return m_LevelWindowProperty->GetLevelWindow();
448  }
449  else
450  {
451  mitkThrow() << "No LevelWindow available!";
452  }
453 }
454 
456 {
457  return m_AutoTopMost;
458 }
459 
461 {
462  return m_SelectedImagesMode;
463 }
464 
466 {
467  // update observers with new data storage
468  this->UpdateObservers();
469 
470  // Initialize LevelWindowsManager to new image
471  this->SetAutoTopMostImage(true);
472 
473  // check if everything is still ok
475  (m_ObserverToLayerProperty.size() != this->GetRelevantNodes()->size()))
476  {
477  mitkThrow() << "Wrong number of observers in Level Window Manager!";
478  }
479 }
480 
482 {
483  // First: check if deleted node is part of relevant nodes.
484  // If not, abort method because there is no need change anything.
485  bool removedNodeIsRelevant = false;
486  DataStorage::SetOfObjects::ConstPointer relevantNodes = GetRelevantNodes();
487  for (DataStorage::SetOfObjects::ConstIterator it = relevantNodes->Begin(); it != relevantNodes->End(); ++it)
488  {
489  if (it->Value() == removedNode)
490  {
491  removedNodeIsRelevant = true;
492  }
493  }
494 
495  if (false == removedNodeIsRelevant)
496  {
497  return;
498  }
499 
500  // remember node which will be removed
501  m_NodeMarkedToDelete = removedNode;
502 
503  // update observers
504  this->UpdateObservers();
505 
506  // search image that belongs to the property
507  if (m_LevelWindowProperty.IsNull())
508  {
509  this->SetAutoTopMostImage(true, removedNode);
510  }
511  else
512  {
514  DataNode *n = m_DataStorage->GetNode(property);
515  if (n == nullptr || m_AutoTopMost) // if node was deleted, change our behavior to AutoTopMost, if AutoTopMost is
516  // true change level window to topmost node
517  {
518  this->SetAutoTopMostImage(true, removedNode);
519  }
520  }
521 
522  // reset variable
523  m_NodeMarkedToDelete = nullptr;
524 
525  // check if everything is still ok
527  (m_ObserverToLayerProperty.size() != (relevantNodes->size() - 1)))
528  {
529  mitkThrow() << "Wrong number of observers in Level Window Manager!";
530  }
531 }
532 
533 void mitk::LevelWindowManager::OnPropertyModified(const itk::EventObject &)
534 {
535  this->Modified();
536 }
537 
539 {
540  return m_CurrentImage;
541 }
542 
544 {
545  return m_ObserverToVisibleProperty.size();
546 }
547 
548 mitk::DataStorage::SetOfObjects::ConstPointer mitk::LevelWindowManager::GetRelevantNodes()
549 {
550  if (m_DataStorage.IsNull())
551  {
552  return DataStorage::SetOfObjects::ConstPointer(DataStorage::SetOfObjects::New());
553  }
554 
556  NodePredicateProperty::Pointer hasLevelWindow = NodePredicateProperty::New("levelwindow", nullptr);
557 
559  NodePredicateDataType::Pointer isDImage = NodePredicateDataType::New("DiffusionImage");
564  predicateTypes->AddPredicate(isImage);
565  predicateTypes->AddPredicate(isDImage);
566  predicateTypes->AddPredicate(isTImage);
567  predicateTypes->AddPredicate(isOdfImage);
568  predicateTypes->AddPredicate(isShImage);
569 
571  predicate->AddPredicate(notBinary);
572  predicate->AddPredicate(hasLevelWindow);
573  predicate->AddPredicate(predicateTypes);
574 
575  DataStorage::SetOfObjects::ConstPointer relevantNodes = m_DataStorage->GetSubset(predicate);
576 
577  return relevantNodes;
578 }
579 
581 {
582  this->ClearPropObserverLists(); // remove old observers
583  this->CreatePropObserverLists(); // create new observer lists
584 }
585 
587 {
588  for (auto iter = m_ObserverToVisibleProperty.begin(); iter != m_ObserverToVisibleProperty.end(); ++iter)
589  {
590  (*iter).second->RemoveObserver((*iter).first.first);
591  (*iter).second = nullptr;
592  }
594 
595  for (auto iter = m_ObserverToLayerProperty.begin(); iter != m_ObserverToLayerProperty.end(); ++iter)
596  {
597  (*iter).second->RemoveObserver((*iter).first.first);
598  (*iter).second = nullptr;
599  }
601 
602  for (auto iter = m_ObserverToRenderingModeProperty.begin(); iter != m_ObserverToRenderingModeProperty.end(); ++iter)
603  {
604  (*iter).second->RemoveObserver((*iter).first.first);
605  (*iter).second = nullptr;
606  }
608 
609  for (auto iter = m_ObserverToDisplayedComponentProperty.begin(); iter != m_ObserverToDisplayedComponentProperty.end(); ++iter)
610  {
611  (*iter).second->RemoveObserver((*iter).first.first);
612  (*iter).second = nullptr;
613  }
615 
616  for (auto iter = m_ObserverToLevelWindowImageProperty.begin(); iter != m_ObserverToLevelWindowImageProperty.end(); ++iter)
617  {
618  (*iter).second->RemoveObserver((*iter).first.first);
619  (*iter).second = nullptr;
620  }
622 
623  for (auto iter = m_ObserverToSelectedProperty.begin(); iter != m_ObserverToSelectedProperty.end(); ++iter)
624  {
625  (*iter).second->RemoveObserver((*iter).first.first);
626  (*iter).second = nullptr;
627  }
629 }
630 
632 {
633  if (m_DataStorage.IsNull()) // check if data storage is set
634  {
635  mitkThrow() << "DataStorage not set";
636  }
637 
638  /* add observers for all relevant nodes */
639  DataStorage::SetOfObjects::ConstPointer all = this->GetRelevantNodes();
640  for (DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
641  {
642  if ((it->Value().IsNull()) || (it->Value() == m_NodeMarkedToDelete))
643  {
644  continue;
645  }
646 
647  /* register listener for changes in visible property */
648  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command =
649  itk::ReceptorMemberCommand<LevelWindowManager>::New();
650  command->SetCallbackFunction(this, &LevelWindowManager::Update);
651  unsigned long visIdx = it->Value()->GetProperty("visible")->AddObserver(itk::ModifiedEvent(), command);
652  m_ObserverToVisibleProperty[PropDataPair(visIdx, it->Value())] = it->Value()->GetProperty("visible");
653 
654  /* register listener for changes in layer property */
655  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command2 =
656  itk::ReceptorMemberCommand<LevelWindowManager>::New();
657  command2->SetCallbackFunction(this, &LevelWindowManager::Update);
658  unsigned long layerIdx = it->Value()->GetProperty("layer")->AddObserver(itk::ModifiedEvent(), command2);
659  m_ObserverToLayerProperty[PropDataPair(layerIdx, it->Value())] = it->Value()->GetProperty("layer");
660 
661  /* register listener for changes in layer property */
662  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command3 =
663  itk::ReceptorMemberCommand<LevelWindowManager>::New();
664  command3->SetCallbackFunction(this, &LevelWindowManager::Update);
665  BaseProperty::Pointer imageRenderingMode = it->Value()->GetProperty("Image Rendering.Mode");
666  if (imageRenderingMode.IsNotNull())
667  {
668  unsigned long rendIdx = imageRenderingMode->AddObserver(itk::ModifiedEvent(), command3);
669  m_ObserverToRenderingModeProperty[PropDataPair(rendIdx, it->Value())] = imageRenderingMode.GetPointer();
670  }
671 
672  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command4 =
673  itk::ReceptorMemberCommand<LevelWindowManager>::New();
674  command4->SetCallbackFunction(this, &LevelWindowManager::RecalculateLevelWindowForSelectedComponent);
675  BaseProperty::Pointer displayedImageComponent = it->Value()->GetProperty("Image.Displayed Component");
676  if (displayedImageComponent.IsNotNull())
677  {
678  unsigned long dispIdx = displayedImageComponent->AddObserver(itk::ModifiedEvent(), command4);
679  m_ObserverToDisplayedComponentProperty[PropDataPair(dispIdx, it->Value())] = displayedImageComponent.GetPointer();
680  }
681 
682  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command5 =
683  itk::ReceptorMemberCommand<LevelWindowManager>::New();
684  command5->SetCallbackFunction(this, &LevelWindowManager::Update);
685  BaseProperty::Pointer imgForLvlWin = it->Value()->GetProperty("imageForLevelWindow");
686  if (imgForLvlWin.IsNull())
687  {
688  it->Value()->SetBoolProperty("imageForLevelWindow", false);
689  imgForLvlWin = it->Value()->GetProperty("imageForLevelWindow");
690  }
691  unsigned long lvlWinIdx = imgForLvlWin->AddObserver(itk::ModifiedEvent(), command5);
692  m_ObserverToLevelWindowImageProperty[PropDataPair(lvlWinIdx, it->Value())] = it->Value()->GetProperty("imageForLevelWindow");
693 
694  itk::ReceptorMemberCommand<LevelWindowManager>::Pointer command6 =
695  itk::ReceptorMemberCommand<LevelWindowManager>::New();
696  command6->SetCallbackFunction(this, &LevelWindowManager::UpdateSelected);
697  BaseProperty::Pointer selectedDataNode = it->Value()->GetProperty("selected");
698  if (selectedDataNode.IsNull())
699  {
700  it->Value()->SetBoolProperty("selected", false);
701  selectedDataNode = it->Value()->GetProperty("selected");
702  }
703  unsigned long selectedIdx = selectedDataNode->AddObserver(itk::ModifiedEvent(), command5);
704  m_ObserverToSelectedProperty[PropDataPair(selectedIdx, it->Value())] = it->Value()->GetProperty("selected");
705  }
706 }
707 
709 {
710  LevelWindowProperty::Pointer levelWindowProperty =
711  dynamic_cast<LevelWindowProperty*>(dataNode->GetProperty("levelwindow"));
712  if (levelWindowProperty.IsNull())
713  {
714  return true;
715  }
716 
717  int nonLvlWinMode1 = RenderingModeProperty::LOOKUPTABLE_COLOR;
719 
721  dynamic_cast<RenderingModeProperty*>(dataNode->GetProperty("Image Rendering.Mode"));
722 
723  if (mode.IsNotNull())
724  {
725  int currMode = mode->GetRenderingMode();
726  if (currMode == nonLvlWinMode1 || currMode == nonLvlWinMode2)
727  {
728  return true;
729  }
730  }
731  else
732  {
733  return true;
734  }
735 
736  return false;
737 }
void RecalculateLevelWindowForSelectedComponent(const itk::EventObject &)
void UpdateSelected(const itk::EventObject &)
Update the level window. This function is only called if the &#39;selected&#39; property of a data node is ch...
mitk::BaseProperty * GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer=nullptr, bool fallBackOnDataProperties=true) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList of the rendere...
Data management class that handles &#39;was created by&#39; relations.
static Pointer New()
void DataStorageRemovedNode(const DataNode *removedNode=nullptr)
This method is called when a node is removed to the data storage. A listener on the data storage is u...
The LevelWindowProperty class Property for the mitk::LevelWindow.
void SetLevelWindow(const LevelWindow &levelWindow)
Set new Level/Window values and inform all listeners about changes.
bool IgnoreNode(const DataNode *dataNode)
ObserverToPropertyValueMap m_ObserverToLevelWindowImageProperty
Map to hold observer IDs to every "imageForLevelWindow" property of DataNode&#39;s BaseProperty.
#define MITK_ERROR
Definition: mitkLogMacros.h:20
DataStorage::Pointer m_DataStorage
void ClearPropObserverLists()
Internal help method to clear both lists/maps.
static Pointer New()
ObserverToPropertyValueMap m_ObserverToRenderingModeProperty
Map to hold observer IDs to every "Image Rendering.Mode" property of DataNode&#39;s BaseProperty.
const LevelWindow & GetLevelWindow()
Return Level/Window values for the current image.
DataStorage::SetOfObjects::ConstPointer GetRelevantNodes()
Returns all nodes in the DataStorage that have the following properties:
std::pair< unsigned long, DataNode::Pointer > PropDataPair
ObserverToPropertyValueMap m_ObserverToLayerProperty
Map to hold observer IDs to every "layer" property of DataNode&#39;s BaseProperty.
The LevelWindow class Class to store level/window values.
void SetSelectedImages(bool selectedImagesMode, const DataNode *removedNode=nullptr)
(Re-)Initialize the LevelWindowManager by setting the selected images. Use the removedNode parameter ...
static Pointer New()
void SetLevelWindow(const LevelWindow &levWin)
bool IsAutoTopMost()
Return true, if the changes on slider or line-edits will affect the topmost layer image...
mitk::DataStorage::Pointer m_DataStorage
void OnPropertyModified(const itk::EventObject &e)
Change notifications from mitkLevelWindowProperty.
LevelWindowProperty::Pointer GetLevelWindowProperty()
Return the current LevelWindowProperty object from the image that is affected by changes.
ObserverToPropertyValueMap m_ObserverToDisplayedComponentProperty
Map to hold observer IDs to every "Image.Displayed Component" property of DataNode&#39;s BaseProperty...
void DataStorageAddedNode(const DataNode *n=nullptr)
This method is called when a node is added to the data storage. A listener on the data storage is use...
void CreatePropObserverLists()
Internal help method to create both lists/maps.
#define mitkThrow()
Image class for storing images.
Definition: mitkImage.h:72
void SetAuto(const Image *image, bool tryPicTags=true, bool guessByCentralSlice=true, unsigned selectedComponent=0)
sets level/window to optimize the contrast of the given Image
void SetLevelWindowProperty(LevelWindowProperty::Pointer levelWindowProperty)
Set a specific LevelWindowProperty; all changes will affect the image belonging to this property...
void Update(const itk::EventObject &)
Update the level window. This function is called if a property of a data node is changed. Relevant properties are defined in the protected &#39;ObserverToPropertyValueMap&#39;-members.
mitk::Image::Pointer image
ObserverToPropertyValueMap m_ObserverToVisibleProperty
Map to hold observer IDs to every "visible" property of DataNode&#39;s BaseProperty.
static Pointer New(const char *_arg)
static Pointer New(const char *_arg)
static T min(T x, T y)
Definition: svm.cpp:53
LevelWindowProperty::Pointer m_LevelWindowProperty
Pointer to the LevelWindowProperty of the current image.
bool IsSelectedImages()
Return true, if changes on slider or line-edits will affect the currently selected images...
void SetAutoTopMostImage(bool autoTopMost, const DataNode *removedNode=nullptr)
(Re-)Initialize the LevelWindowManager by setting the topmost image. Use the removedNode parameter if...
void SetDataStorage(DataStorage *ds)
std::vector< DataNode::Pointer > m_RelevantDataNodes
Image * GetCurrentImage()
Return the currently active image.
ObserverToPropertyValueMap m_ObserverToSelectedProperty
Map to hold observer IDs to every "selected" property of DataNode&#39;s BaseProperty. ...
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57