bool mmCommands::mmStructureInfo::Run(std::wstring const & p_sName, std::vector<mmParam> const & p_sParams) { std::wstring const v_sName = p_sParams.empty() ? mmString(L"") : p_sParams[0].sValue; if(m_psImageStructure->GetImageCount() == 0) ::_cputws(L"No images available\r\n"); else for(mmImages::mmImageI* v_psImage = m_psImageStructure->FindImage(NULL, v_sName); NULL != v_psImage; v_psImage = m_psImageStructure->FindImage(v_psImage, v_sName)) { DisplayImageInfo(v_psImage); ::_cputws(L"\r\n"); } return true; }
void QmitkImageNavigatorView::UpdateStatusBar() { if (m_IRenderWindowPart != nullptr) { mitk::Point3D position = m_IRenderWindowPart->GetSelectedPosition(); mitk::BaseRenderer::Pointer renderer = mitk::BaseRenderer::GetInstance(m_IRenderWindowPart->GetActiveQmitkRenderWindow()->GetVtkRenderWindow()); mitk::TNodePredicateDataType<mitk::Image>::Pointer isImageData = mitk::TNodePredicateDataType<mitk::Image>::New(); mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->GetDataStorage()->GetSubset(isImageData).GetPointer(); if (nodes.IsNotNull()) { mitk::Image::Pointer image3D; mitk::DataNode::Pointer node; mitk::DataNode::Pointer topSourceNode; int component = 0; node = GetTopLayerNode(nodes, position, renderer); if (node.IsNotNull()) { bool isBinary(false); node->GetBoolProperty("binary", isBinary); if (isBinary) { mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = this->GetDataStorage()->GetSources(node, nullptr, true); if (!sourcenodes->empty()) { topSourceNode = GetTopLayerNode(sourcenodes, position, renderer); } if (topSourceNode.IsNotNull()) { image3D = dynamic_cast<mitk::Image*>(topSourceNode->GetData()); topSourceNode->GetIntProperty("Image.Displayed Component", component); } else { image3D = dynamic_cast<mitk::Image*>(node->GetData()); node->GetIntProperty("Image.Displayed Component", component); } } else { image3D = dynamic_cast<mitk::Image*>(node->GetData()); node->GetIntProperty("Image.Displayed Component", component); } } // get the position and pixel value from the image and build up status bar text auto statusBar = mitk::StatusBar::GetInstance(); if (image3D.IsNotNull() && statusBar != nullptr) { itk::Index<3> p; image3D->GetGeometry()->WorldToIndex(position, p); auto pixelType = image3D->GetChannelDescriptor().GetPixelType().GetPixelType(); if (pixelType == itk::ImageIOBase::RGB || pixelType == itk::ImageIOBase::RGBA) { std::string pixelValue = "Pixel RGB(A) value: "; pixelValue.append(ConvertCompositePixelValueToString(image3D, p)); statusBar->DisplayImageInfo(position, p, renderer->GetTime(), pixelValue.c_str()); } else if ( pixelType == itk::ImageIOBase::DIFFUSIONTENSOR3D || pixelType == itk::ImageIOBase::SYMMETRICSECONDRANKTENSOR ) { std::string pixelValue = "See ODF Details view. "; statusBar->DisplayImageInfo(position, p, renderer->GetTime(), pixelValue.c_str()); } else { itk::Index<3> p; image3D->GetGeometry()->WorldToIndex(position, p); mitk::ScalarType pixelValue; mitkPixelTypeMultiplex5( mitk::FastSinglePixelAccess, image3D->GetChannelDescriptor().GetPixelType(), image3D, image3D->GetVolumeData(renderer->GetTimeStep()), p, pixelValue, component); statusBar->DisplayImageInfo(position, p, renderer->GetTime(), pixelValue); } } else { statusBar->DisplayImageInfoInvalid(); } } } }
static VOID DisplayStatus(VOID) { LONG Ret; HKEY HandleKey; DWORD Index, MaxLen, Handled; TCHAR * SubKey; BOOL Header; if (!OpenImageFileExecOptions(KEY_READ, NULL, &HandleKey)) { return; } Ret = RegQueryInfoKeyW(HandleKey, NULL, NULL, NULL, NULL, &MaxLen, NULL, NULL, NULL, NULL, NULL, NULL); if (Ret != ERROR_SUCCESS) { wprintf(L"DS: RegQueryInfoKey failed (%d)\n", Ret); RegCloseKey(HandleKey); return; } ++MaxLen; // NULL-char SubKey = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MaxLen * sizeof(WCHAR)); if (SubKey == NULL) { wprintf(L"DS: HeapAlloc failed\n"); RegCloseKey(HandleKey); return; } Index = 0; Handled = 0; Header = FALSE; do { Ret = RegEnumKeyW(HandleKey, Index, SubKey, MaxLen); if (Ret != ERROR_NO_MORE_ITEMS) { if (Image == NULL || wcscmp(SubKey, Image) == 0) { if (DisplayImageInfo(HandleKey, SubKey, &Header)) { ++Handled; } } ++Index; } } while (Ret != ERROR_NO_MORE_ITEMS); if (Handled == 0) { if (Image == NULL) { wprintf(L"No application has page heap enabled.\n"); } else { wprintf(L"Page heap is not enabled for %s\n", Image); } } HeapFree(GetProcessHeap(), 0, SubKey); RegCloseKey(HandleKey); }