| 105 | } |
| 106 | |
| 107 | void QmitkPixelValueView::Update() |
| 108 | { |
| 109 | const auto position = m_SliceNavigationListener.GetCurrentSelectedPosition(); |
| 110 | const auto timePoint = m_SliceNavigationListener.GetCurrentSelectedTimePoint(); |
| 111 | |
| 112 | auto isImage = mitk::TNodePredicateDataType<mitk::Image>::New(); |
| 113 | auto isSegmentation = mitk::NodePredicateDataType::New("MultiLabelSegmentation"); |
| 114 | |
| 115 | auto predicate = mitk::NodePredicateAnd::New(); |
| 116 | predicate->AddPredicate(mitk::NodePredicateNot::New(isSegmentation)); |
| 117 | predicate->AddPredicate(isImage); |
| 118 | |
| 119 | auto nodes = GetDataStorage()->GetSubset(predicate); |
| 120 | |
| 121 | if (nodes.IsNull()) |
| 122 | { |
| 123 | this->Clear(); |
| 124 | return; |
| 125 | } |
| 126 | |
| 127 | mitk::Image::Pointer image; |
| 128 | mitk::DataNode::Pointer topParentNode; |
| 129 | |
| 130 | int component = 0; |
| 131 | |
| 132 | auto node = mitk::FindTopmostVisibleNode(nodes, position, timePoint, nullptr); |
| 133 | |
| 134 | if (node.IsNull()) |
| 135 | { |
| 136 | this->Clear(); |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | bool isBinary = false; |
| 141 | node->GetBoolProperty("binary", isBinary); |
| 142 | |
| 143 | if (isBinary) |
| 144 | { |
| 145 | auto parentNodes = GetDataStorage()->GetSources(node, nullptr, true); |
| 146 | |
| 147 | if (!parentNodes->empty()) |
| 148 | topParentNode = FindTopmostVisibleNode(nodes, position, timePoint, nullptr); |
| 149 | |
| 150 | if (topParentNode.IsNotNull()) |
| 151 | { |
| 152 | image = dynamic_cast<mitk::Image*>(topParentNode->GetData()); |
| 153 | topParentNode->GetIntProperty("Image.Displayed Component", component); |
| 154 | } |
| 155 | else |
| 156 | { |
| 157 | image = dynamic_cast<mitk::Image*>(node->GetData()); |
| 158 | node->GetIntProperty("Image.Displayed Component", component); |
| 159 | } |
| 160 | } |
| 161 | else |
| 162 | { |
| 163 | image = dynamic_cast<mitk::Image*>(node->GetData()); |
| 164 | node->GetIntProperty("Image.Displayed Component", component); |
no test coverage detected