** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: dialogs.cpp,v 1.1 2000/07/18 03:14:35 kevin Exp $
+** $Id: dialogs.cpp,v 1.2 2000/07/18 14:51:06 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
#include "wx/sizer.h"
#include "dialogs.h"
#include <sstream>
+#include "ctsupport.h"
+#include "scanner.h"
DialogGetImageMinMax::DialogGetImageMinMax (wxFrame* pParent, const ImageFile& rImagefile, double dDefaultMin = 0., double dDefaultMax = 0.)
- : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxCAPTION), m_pTopSizer(NULL), m_pTextCtrlMin(NULL), m_pTextCtrlMax(NULL), m_pButtonSizer(NULL), m_pButtonOk(NULL), m_pButtonCancel(NULL), m_dDefaultMin(dDefaultMin), m_dDefaultMax(dDefaultMax)
+ : wxDialog (pParent, -1, "Set Image Display Minimum & Maximum", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
{
- wxBoxSizer* m_pTopSizer = new wxBoxSizer (wxVERTICAL);
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
- m_pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+ pTopSizer->Add (new wxStaticText (this, -1, "Set Image Display Minimum and Maximum"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
ostringstream os;
os << dDefaultMin;
m_pTextCtrlMin = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
pGridSizer->Add (m_pTextCtrlMin, 0, wxALIGN_CENTER_VERTICAL);
pGridSizer->Add (new wxStaticText (this, -1, "Maximum"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
pGridSizer->Add (m_pTextCtrlMax, 0, wxALIGN_CENTER_VERTICAL);
- m_pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+ pTopSizer->Add (pGridSizer, 1, wxALL, 10);
- m_pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
- m_pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
- m_pButtonOk = new wxButton (this, wxID_OK, "Okay");
- m_pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
- m_pButtonSizer->Add (m_pButtonOk, 0, wxEXPAND | wxALL, 10);
- m_pButtonSizer->Add (m_pButtonCancel, 0, wxEXPAND | wxALL, 10);
+ wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+ wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
- m_pTopSizer->Add (m_pButtonSizer, 0, wxALIGN_CENTER);
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
SetAutoLayout (true);
- SetSizer (m_pTopSizer);
- m_pTopSizer->Fit (this);
- m_pTopSizer->SetSizeHints (this);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
}
DialogGetImageMinMax::~DialogGetImageMinMax (void)
{
#if 0
- delete m_pTopSizer;
delete m_pTextCtrlMin;
delete m_pTextCtrlMax;
- delete m_pButtonSizer;
- delete m_pButtonOk;
- delete m_pButtonCancel;
#endif
}
return (m_dDefaultMax);
}
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetRasterParameters
+/////////////////////////////////////////////////////////////////////
+
+DialogGetRasterParameters::DialogGetRasterParameters (wxFrame* pParent, int iDefaultXSize = 0, int iDefaultYSize = 0, int iDefaultNSamples = 1)
+ : wxDialog (pParent, -1, "Set Rasterization Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ pTopSizer->Add (new wxStaticText (this, -1, "Set Rasterization Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ ostringstream os;
+ os << iDefaultXSize;
+ m_pTextCtrlXSize = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osYSize;
+ osYSize << iDefaultYSize;
+ m_pTextCtrlYSize = new wxTextCtrl (this, -1, osYSize.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osNSamples;
+ osNSamples << iDefaultNSamples;
+ m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+
+ wxGridSizer *pGridSizer = new wxGridSizer (2, 3, 5);
+ pGridSizer->Add (new wxStaticText (this, -1, "X Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlXSize, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Y Size"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlYSize, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Samples per Pixel"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
+ pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+ wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+}
+
+DialogGetRasterParameters::~DialogGetRasterParameters (void)
+{
+}
+
+
+unsigned int
+DialogGetRasterParameters::getXSize (void)
+{
+ wxString strCtrl = m_pTextCtrlXSize->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultXSize);
+}
+
+unsigned int
+DialogGetRasterParameters::getYSize (void)
+{
+ wxString strCtrl = m_pTextCtrlYSize->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultYSize);
+}
+
+
+unsigned int
+DialogGetRasterParameters::getNSamples (void)
+{
+ wxString strCtrl = m_pTextCtrlNSamples->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNSamples);
+}
+
+
+
+/////////////////////////////////////////////////////////////////////
+// CLASS IDENTIFICATION
+//
+// DialogGetProjectionsParameters
+/////////////////////////////////////////////////////////////////////
+
+DialogGetProjectionParameters::DialogGetProjectionParameters (wxFrame* pParent, int iDefaultNDet = 0, int iDefaultNView = 0, int iDefaultNSamples = 1, double dDefaultRotAngle = 1., const char* szDefaultGeometry = NULL)
+ : wxDialog (pParent, -1, "Set Projection Parameters", wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxCAPTION)
+{
+ wxBoxSizer* pTopSizer = new wxBoxSizer (wxVERTICAL);
+
+ pTopSizer->Add (new wxStaticText (this, -1, "Set Projection Parameters"), 0, wxALIGN_CENTER | wxTOP | wxLEFT | wxRIGHT, 5);
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ ostringstream os;
+ os << iDefaultNDet;
+ m_pTextCtrlNDet = new wxTextCtrl (this, -1, os.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osNView;
+ osNView << iDefaultNView;
+ m_pTextCtrlNView = new wxTextCtrl (this, -1, osNView.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osNSamples;
+ osNSamples << iDefaultNSamples;
+ m_pTextCtrlNSamples = new wxTextCtrl (this, -1, osNSamples.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+ ostringstream osRotAngle;
+ osRotAngle << dDefaultRotAngle;
+ m_pTextCtrlRotAngle = new wxTextCtrl (this, -1, osRotAngle.str().c_str(), wxDefaultPosition, wxSize(100, 25), 0);
+
+ wxGridSizer *pGridSizer = new wxGridSizer (2, 4, 5);
+ pGridSizer->Add (new wxStaticText (this, -1, "Detectors"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlNDet, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Views"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlNView, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Samples per Detector"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlNSamples, 0, wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (new wxStaticText (this, -1, "Rotation Angle (PI units)"), 0, wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pGridSizer->Add (m_pTextCtrlRotAngle, 0, wxALIGN_CENTER_VERTICAL);
+ pTopSizer->Add (pGridSizer, 1, wxALL, 10);
+ m_sDefaultGeometry = szDefaultGeometry;
+
+ pTopSizer->Add (new wxStaticLine (this, -1, wxDefaultPosition, wxSize(3,3), wxHORIZONTAL), 0, wxEXPAND | wxALL, 5);
+
+ wxBoxSizer* pButtonSizer = new wxBoxSizer (wxHORIZONTAL);
+ wxButton* pButtonOk = new wxButton (this, wxID_OK, "Okay");
+ wxButton* pButtonCancel = new wxButton (this, wxID_CANCEL, "Cancel");
+ pButtonSizer->Add (pButtonOk, 0, wxEXPAND | wxALL, 10);
+ pButtonSizer->Add (pButtonCancel, 0, wxEXPAND | wxALL, 10);
+
+ pTopSizer->Add (pButtonSizer, 0, wxALIGN_CENTER);
+
+ SetAutoLayout (true);
+ SetSizer (pTopSizer);
+ pTopSizer->Fit (this);
+ pTopSizer->SetSizeHints (this);
+}
+
+DialogGetProjectionParameters::~DialogGetProjectionParameters (void)
+{
+}
+
+
+unsigned int
+DialogGetProjectionParameters::getNDet (void)
+{
+ wxString strCtrl = m_pTextCtrlNDet->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNDet);
+}
+
+unsigned int
+DialogGetProjectionParameters::getNView (void)
+{
+ wxString strCtrl = m_pTextCtrlNView->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNView);
+}
+
+
+unsigned int
+DialogGetProjectionParameters::getNSamples (void)
+{
+ wxString strCtrl = m_pTextCtrlNSamples->GetValue();
+ unsigned long lValue;
+ if (strCtrl.ToULong (&lValue))
+ return lValue;
+ else
+ return (m_iDefaultNSamples);
+}
+
+double
+DialogGetProjectionParameters::getRotAngle (void)
+{
+ wxString strCtrl = m_pTextCtrlRotAngle->GetValue();
+ double dValue;
+ if (strCtrl.ToDouble (&dValue))
+ return (dValue * PI);
+ else
+ return (m_dDefaultRotAngle);
+}
+
+const string&
+DialogGetProjectionParameters::getGeometry (void)
+{
+ return m_sDefaultGeometry;
+}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.3 2000/07/18 03:14:35 kevin Exp $
+** $Id: views.cpp,v 1.4 2000/07/18 14:51:06 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
wxPoint pt(event.GetLogicalPosition(dc));
- if (event.LeftUp()) {
+ if (event.LeftIsDown()) {
const ImageFile& rIF = m_pView->GetDocument()->getImageFile();
ImageFileArrayConst v = rIF.getArray();
int nx = rIF.nx();
ostringstream os;
os << "file: " << rFilename << "\nmin: "<<min<<"\nmax: "<<max<<"\nmean: "<<mean<<"\nmode: "<<mode<<"\nstddev: "<<stddev << "\n";
*theApp->getLog() << os.str().c_str();
+
+ int xSize, ySize;
+ ostringstream osSize;
+ m_frame->GetSize (&xSize, &ySize);
+ osSize << "Frame size: (" << xSize << "," << ySize << ")\n";
+ m_frame->GetClientSize (&xSize, &ySize);
+ osSize << "Frame Client size: (" << xSize << "," << ySize << ")\n";
+ m_canvas->GetSize (&xSize, &ySize);
+ osSize << "Canvas size: (" << xSize << "," << ySize << ")\n";
+ *theApp->getLog() << osSize.str().c_str();
}
}
wxFrame*
ImageFileView::CreateChildFrame(wxDocument *doc, wxView *view)
{
- wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
+ wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "ImageFile Frame", wxPoint(-1, -1), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
wxMenu *file_menu = new wxMenu;
+ file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "&Create Phantom...");
file_menu->Append(wxID_OPEN, "&Open...");
file_menu->Append(wxID_CLOSE, "&Close");
file_menu->Append(wxID_SAVE, "&Save");
file_menu->Append(wxID_PREVIEW, "Print Pre&view");
wxMenu *view_menu = new wxMenu;
- view_menu->Append(IFMENU_VIEW_WINDOW_AUTO, "&Window auto");
view_menu->Append(IFMENU_VIEW_WINDOW_MINMAX, "&Set Window Min/Max");
+ view_menu->Append(IFMENU_VIEW_WINDOW_AUTO, "&Auto Window...");
wxMenu *help_menu = new wxMenu;
help_menu->Append(MAINMENU_HELP_ABOUT, "&About");
}
double scaleWidth = m_dMaxPixel - m_dMinPixel;
- unsigned char imageData [nx * ny * 3];
+ unsigned char* imageData = new unsigned char [nx * ny * 3];
for (int ix = 0; ix < nx; ix++) {
for (int iy = 0; iy < ny; iy++) {
double scaleValue = ((v[ix][iy] - m_dMinPixel) / scaleWidth) * 255;
}
wxImage image (ny, nx, imageData, true);
m_bitmap = image.ConvertToBitmap();
+ delete imageData;
+ int xSize = nx;
+ int ySize = ny;
+ xSize = clamp (xSize, 0, 800);
+ ySize = clamp (ySize, 0, 800);
+ m_frame->SetClientSize (xSize, ySize);
+ m_canvas->SetScrollbars(20, 20, nx/20, ny/20);
+ m_canvas->SetBackgroundColour(*wxWHITE);
}
if (m_canvas)
// PhantomCanvas
PhantomCanvas::PhantomCanvas (PhantomView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
- : wxScrolledWindow(frame, -1, pos, size, style)
+ : wxPanel(frame, -1, pos, size, style)
{
m_pView = v;
}
void
PhantomView::OnProjections (wxCommandEvent& event)
{
- const Phantom& rPhantom = GetDocument()->getPhantom();
- ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
- Projections& rProj = pProjectionDoc->getProjections();
- Scanner theScanner (rPhantom, "parallel", 367, 320, 2, PI);
- rProj.initFromScanner (theScanner);
- theScanner.collectProjections (rProj, rPhantom, 0, TRACE_NONE);
- pProjectionDoc->Modify(true);
- pProjectionDoc->UpdateAllViews(this);
+ DialogGetProjectionParameters dialogProjection (m_frame, 367, 320, 1, 1., Scanner::GEOMETRY_PARALLEL_STR);
+ int retVal = dialogProjection.ShowModal();
+ if (retVal == wxID_OK) {
+ int nDet = dialogProjection.getNDet();
+ int nView = dialogProjection.getNView();
+ int nSamples = dialogProjection.getNSamples();
+ double dRotAngle = dialogProjection.getRotAngle();
+ string sGeometry = dialogProjection.getGeometry();
+ if (nDet > 0 && nView > 0 && sGeometry != "") {
+ const Phantom& rPhantom = GetDocument()->getPhantom();
+ ProjectionFileDocument* pProjectionDoc = dynamic_cast<ProjectionFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.pj", wxDOC_SILENT));
+ Projections& rProj = pProjectionDoc->getProjections();
+ Scanner theScanner (rPhantom, sGeometry.c_str(), nDet, nView, nSamples, dRotAngle);
+ rProj.initFromScanner (theScanner);
+ theScanner.collectProjections (rProj, rPhantom, 0, TRACE_NONE);
+ pProjectionDoc->Modify(true);
+ pProjectionDoc->UpdateAllViews(this);
+ }
+ }
}
void
PhantomView::OnRasterize (wxCommandEvent& event)
{
- const Phantom& rPhantom = GetDocument()->getPhantom();
- ImageFileDocument* pRasterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));
- ImageFile& imageFile = pRasterDoc->getImageFile();
- imageFile.setArraySize (256, 256);
- rPhantom.convertToImagefile (imageFile, 1, TRACE_NONE);
- pRasterDoc->Modify(true);
- pRasterDoc->UpdateAllViews(this);
+ DialogGetRasterParameters dialogRaster (m_frame, 256, 256, 1);
+ int retVal = dialogRaster.ShowModal();
+ if (retVal == wxID_OK) {
+ int xSize = dialogRaster.getXSize();
+ int ySize = dialogRaster.getYSize();
+ int nSamples = dialogRaster.getNSamples();
+ if (nSamples < 1)
+ nSamples = 1;
+ if (xSize > 0 && ySize > 0) {
+ const Phantom& rPhantom = GetDocument()->getPhantom();
+ ImageFileDocument* pRasterDoc = dynamic_cast<ImageFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.if", wxDOC_SILENT));
+ ImageFile& imageFile = pRasterDoc->getImageFile();
+
+ imageFile.setArraySize (xSize, ySize);
+ rPhantom.convertToImagefile (imageFile, nSamples, TRACE_NONE);
+ pRasterDoc->Modify(true);
+ pRasterDoc->UpdateAllViews(this);
+
+ ostringstream os;
+ os << "Rasterize Phantom " << rPhantom.name() << ": XSize=" << xSize << ", YSize=" << ySize << ", nSamples=" << nSamples << "\n";
+ *theApp->getLog() << os.str().c_str();
+ }
+ }
}
pCanvas = new PhantomCanvas (dynamic_cast<PhantomView*>(view), parent, wxPoint(0, 0), wxSize(width, height), 0);
- pCanvas->SetScrollbars(20, 20, 50, 50);
pCanvas->SetBackgroundColour(*wxWHITE);
pCanvas->Clear();
wxFrame*
PhantomView::CreateChildFrame(wxDocument *doc, wxView *view)
{
- wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
+ wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Phantom Frame", wxPoint(10, 10), wxSize(256, 256), wxDEFAULT_FRAME_STYLE);
wxMenu *file_menu = new wxMenu;
+ file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "&Create Phantom...");
file_menu->Append(wxID_OPEN, "&Open...");
file_menu->Append(wxID_CLOSE, "&Close");
wxFrame*
ProjectionFileView::CreateChildFrame(wxDocument *doc, wxView *view)
{
- wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(300, 300), wxDEFAULT_FRAME_STYLE);
+ wxDocChildFrame *subframe = new wxDocChildFrame(doc, view, theApp->getMainFrame(), -1, "Projection Frame", wxPoint(10, 10), wxSize(0, 0), wxDEFAULT_FRAME_STYLE);
wxMenu *file_menu = new wxMenu;
+ file_menu->Append(MAINMENU_FILE_CREATE_PHANTOM, "&Create Phantom...");
file_menu->Append(wxID_OPEN, "&Open...");
file_menu->Append(wxID_CLOSE, "&Close");
}
}
- unsigned char imageData [nDet * nView * 3];
+ unsigned char* imageData = new unsigned char [nDet * nView * 3];
double scale = (max - min) / 255;
for (int iy = 0; iy < nView; iy++) {
const DetectorArray& detarray = rProj.getDetectorArray(iy);
}
wxImage image (nDet, nView, imageData, true);
m_bitmap = image.ConvertToBitmap();
+ delete imageData;
+ int xSize = nDet;
+ int ySize = nView;
+ xSize = clamp (xSize, 0, 800);
+ ySize = clamp (ySize, 0, 800);
+ m_frame->SetClientSize (xSize, ySize);
+ m_canvas->SetScrollbars (20, 20, nDet/20, nView/20);
}
if (m_canvas)