00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 1.12 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "QmitkCalculateGrayValueStatisticsToolGUI.h" 00019 00020 #include "QmitkCopyToClipBoardDialog.h" 00021 00022 MITK_TOOL_GUI_MACRO(QmitkExt_EXPORT, QmitkCalculateGrayValueStatisticsToolGUI, "") 00023 00024 QmitkCalculateGrayValueStatisticsToolGUI::QmitkCalculateGrayValueStatisticsToolGUI() 00025 :QmitkToolGUI() 00026 { 00027 connect( this, SIGNAL(NewToolAssociated(mitk::Tool*)), this, SLOT(OnNewToolAssociated(mitk::Tool*)) ); 00028 } 00029 00030 QmitkCalculateGrayValueStatisticsToolGUI::~QmitkCalculateGrayValueStatisticsToolGUI() 00031 { 00032 if (m_CalculateGrayValueStatisticsTool.IsNotNull()) 00033 { 00034 m_CalculateGrayValueStatisticsTool->StatisticsCompleted -= mitk::MessageDelegate<QmitkCalculateGrayValueStatisticsToolGUI>( this, &QmitkCalculateGrayValueStatisticsToolGUI::OnCalculationsDone ); 00035 } 00036 } 00037 00038 void QmitkCalculateGrayValueStatisticsToolGUI::OnNewToolAssociated(mitk::Tool* tool) 00039 { 00040 if (m_CalculateGrayValueStatisticsTool.IsNotNull()) 00041 { 00042 m_CalculateGrayValueStatisticsTool->StatisticsCompleted -= mitk::MessageDelegate<QmitkCalculateGrayValueStatisticsToolGUI>( this, &QmitkCalculateGrayValueStatisticsToolGUI::OnCalculationsDone ); 00043 } 00044 00045 m_CalculateGrayValueStatisticsTool = dynamic_cast<mitk::CalculateGrayValueStatisticsTool*>( tool ); 00046 00047 if (m_CalculateGrayValueStatisticsTool.IsNotNull()) 00048 { 00049 m_CalculateGrayValueStatisticsTool->StatisticsCompleted += mitk::MessageDelegate<QmitkCalculateGrayValueStatisticsToolGUI>( this, &QmitkCalculateGrayValueStatisticsToolGUI::OnCalculationsDone ); 00050 } 00051 } 00052 00053 void QmitkCalculateGrayValueStatisticsToolGUI::OnCalculationsDone() 00054 { 00055 if (m_CalculateGrayValueStatisticsTool.IsNotNull()) 00056 { 00057 std::string report = m_CalculateGrayValueStatisticsTool->GetReport(); 00058 00059 // one for linux users 00060 std::cout << report << std::endl; 00061 00062 // one for window users 00063 QmitkCopyToClipBoardDialog* dialog = new QmitkCopyToClipBoardDialog( report.c_str(), NULL); 00064 dialog->show(); 00065 } 00066 } 00067