r311: image comparison functions
[ctsim.git] / src / dialogs.cpp
index 66191bb761ddd90d8a67d18ce577e18838574fe2..7d8c0ecab7e7dbf3fd526e644476806382a40e6f 100644 (file)
@@ -9,7 +9,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: dialogs.cpp,v 1.19 2000/12/21 03:40:58 kevin Exp $
+**  $Id: dialogs.cpp,v 1.20 2000/12/22 04:18:00 kevin Exp $
 **
 **  This program is free software; you can redistribute it and/or modify
 **  it under the terms of the GNU General Public License (version 2) as
@@ -53,6 +53,9 @@
 #include "phantom.h"
 #include "filter.h"
 #include "backprojectors.h"
+#include "docs.h"\r
+#include "views.h"\r
+#include "imagefile.h"\r
 
 #if defined(MSVC) || HAVE_SSTREAM\r
 #include <sstream>\r
@@ -127,6 +130,73 @@ DialogGetPhantom::getPhantom(void)
 }
 
 \r
+///////////////////////////////////////////////////////////////////////\r
+// CLASS IMPLEMENTATION\r
+//    DialogGetComparisonImage\r
+///////////////////////////////////////////////////////////////////////\r
+\r
+DialogGetComparisonImage::DialogGetComparisonImage (wxFrame* pParent, const char* const pszTitle, const std::vector<ImageFileDocument*>& rVecIF, bool bShowMakeDifference)\r
+: wxDialog (pParent, -1, pszTitle, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION), m_rVecIF(rVecIF)\r
+{\r
+  wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);\r
+  \r
+  pTopSizer->Add (new wxStaticText (this, -1, pszTitle), 0, wxALIGN_CENTER | wxALL, 5);\r
+  \r
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxALL, 5);\r
+  \r
+  int iNImages = m_rVecIF.size();\r
+  wxString* pstrImages = new wxString [iNImages];\r
+  for (int i = 0; i < iNImages; i++) {\r
+    ImageFileView* pView = dynamic_cast<ImageFileView*>(m_rVecIF[i]->GetFirstView());\r
+    if (pView)\r
+      pstrImages[i] = pView->getFrame()->GetTitle();\r
+  }\r
+\r
+  m_pListBoxImageChoices = new wxListBox (this, -1, wxDefaultPosition, wxDefaultSize, iNImages, pstrImages, wxLB_SINGLE);\r
+  delete [] pstrImages;\r
+\r
+  m_pListBoxImageChoices->SetSelection (0);\r
+  pTopSizer->Add (m_pListBoxImageChoices, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
+  \r
+  if (bShowMakeDifference) {\r
+    m_pMakeDifferenceImage = new wxCheckBox (this, -1, "Make Difference Image");\r
+    m_pMakeDifferenceImage->SetValue (FALSE);\r
+    pTopSizer->Add (m_pMakeDifferenceImage, 0, wxALL | wxALIGN_CENTER | wxEXPAND);\r
+  } else\r
+    m_pMakeDifferenceImage = NULL;\r
+\r
+  pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);\r
+  \r
+  wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);\r
+  wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");\r
+  wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");\r
+  pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);\r
+  pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);\r
+  \r
+  pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);\r
+  \r
+  SetAutoLayout (true);\r
+  SetSizer (pTopSizer);\r
+  pTopSizer->Fit (this);\r
+  pTopSizer->SetSizeHints (this);\r
+}\r
+\r
+ImageFileDocument*\r
+DialogGetComparisonImage::getImageFileDocument(void)\r
+{\r
+  return m_rVecIF[ m_pListBoxImageChoices->GetSelection() ];\r
+}\r
+\r
+bool\r
+DialogGetComparisonImage::getMakeDifferenceImage()\r
+{\r
+  if (m_pMakeDifferenceImage)\r
+    return m_pMakeDifferenceImage->GetValue();\r
+  else\r
+    return false;\r
+}\r
+\r
+\r
 /////////////////////////////////////////////////////////////////////\r
 // CLASS DiaglogGetMinMax Implementation\r
 /////////////////////////////////////////////////////////////////////\r