///////////////////////////////////////////////////////////////////////////// // Name: test.cpp // Purpose: // Author: // Modified by: // Created: Tue 04 Aug 2009 14:33:06 BST // RCS-ID: // Copyright: // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), Tue 04 Aug 2009 14:33:06 BST // For compilers that support precompilation, includes "wx/wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include "wx/wx.h" #endif ////@begin includes ////@end includes #include "test.h" #include <StandAlone/Apps/Seg3D/Painter.h> #include "seg3devents.h" #include <StandAlone/Apps/Seg3D/Seg3DwxGuiUtils.h> ////@begin XPM images ////@end XPM images /*! * Test type definition */ IMPLEMENT_DYNAMIC_CLASS( Test, wxPanel ) /*! * Test event table definition */ BEGIN_EVENT_TABLE( Test, wxPanel ) ////@begin Test event table entries EVT_BUTTON( XRCID("START_BUTTON"), Test::OnStartButtonClick ) EVT_BUTTON( XRCID("CLOSE_BUTTON"), Test::OnCloseButtonClick ) ////@end Test event table entries END_EVENT_TABLE() /*! * Test constructors */ Test::Test() { Init(); } Test::Test( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { Init(); Create(parent, id, pos, size, style); } /*! * Test creator */ bool Test::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) { ////@begin Test creation std::cout << "Constructor: before setparent" << std::endl; // DEBUG SetParent(parent); std::cout << "Constructor: before createcontrols" << std::endl; // DEBUG CreateControls(); std::cout << "Constructor: before getsize" << std::endl; // DEBUG if (GetSizer()) { std::cout << "Constructor: before getsizer" << std::endl; // DEBUG GetSizer()->SetSizeHints(this); } std::cout << "Constructor: before centre" << std::endl; // DEBUG Centre(); std::cout << "Constructor: end" << std::endl; // DEBUG ////@end Test creation return true; } /*! * Test destructor */ Test::~Test() { ////@begin Test destruction ////@end Test destruction } /*! * Member initialisation */ void Test::Init() { ////@begin Test member initialisation mSpinner = NULL; mStart = NULL; mStop = NULL; ////@end Test member initialisation } /*! * Control creation for Test */ void Test::CreateControls() { ////@begin Test content construction // Generated by DialogBlocks, Tue 04 Aug 2009 15:16:13 BST (unregistered) std::cout << "Before creating controls" << std::endl; // DEBUG if (!wxXmlResource::Get()->LoadPanel(this, GetParent(), _T("ID_TEST"))) wxLogError(wxT("Missing wxXmlResource::Get()->Load() in OnInit()?")); std::cout << "Before creating control mSpinner" << std::endl; // DEBUG mSpinner = XRCCTRL(*this, "ID_SPINCTRL", wxSpinCtrl); std::cout << "Before creating control mStart" << std::endl; // DEBUG mStart = XRCCTRL(*this, "START_BUTTON", wxButton); std::cout << "Before creating control mStopr" << std::endl; // DEBUG mStop = XRCCTRL(*this, "CLOSE_BUTTON", wxButton); std::cout << "After creating controls" << std::endl; // DEBUG ////@end Test content construction // Create custom windows not generated automatically here. ////@begin Test content initialisation ////@end Test content initialisation } /*! * Should we show tooltips? */ bool Test::ShowToolTips() { return true; } /*! * Get bitmap resources */ wxBitmap Test::GetBitmapResource( const wxString& name ) { // Bitmap retrieval ////@begin Test bitmap retrieval wxUnusedVar(name); return wxNullBitmap; ////@end Test bitmap retrieval } /*! * Get icon resources */ wxIcon Test::GetIconResource( const wxString& name ) { // Icon retrieval ////@begin Test icon retrieval wxUnusedVar(name); return wxNullIcon; ////@end Test icon retrieval } void Test::OnStartButtonClick( wxCommandEvent& event ) { SCIRun::ThrowSkinnerSignalEvent *tsse = new SCIRun::ThrowSkinnerSignalEvent("Painter::FinishTool"); tsse->add_var("Test::mSpinner",SCIRun::to_string(mSpinner->GetValue())); } void Test::OnCloseButtonClick( wxCommandEvent& event ) { SCIRun::Painter::global_seg3dframe_pointer_->HideTool(); }
///////////////////////////////////////////////////////////////////////////// // Name: test.h // Purpose: // Author: // Modified by: // Created: Tue 04 Aug 2009 14:33:06 BST // RCS-ID: // Copyright: // Licence: ///////////////////////////////////////////////////////////////////////////// // Generated by DialogBlocks (unregistered), Tue 04 Aug 2009 14:33:06 BST #ifndef _TEST_H_ #define _TEST_H_ /*! * Includes */ ////@begin includes #include "wx/xrc/xmlres.h" #include "wx/spinctrl.h" ////@end includes /*! * Forward declarations */ ////@begin forward declarations class wxSpinCtrl; ////@end forward declarations /*! * Control identifiers */ ////@begin control identifiers #define ID_TEST 10015 #define SYMBOL_TEST_STYLE wxTAB_TRAVERSAL #define SYMBOL_TEST_TITLE _("Test") #define SYMBOL_TEST_IDNAME ID_TEST #define SYMBOL_TEST_SIZE wxSize(400, 300) #define SYMBOL_TEST_POSITION wxDefaultPosition ////@end control identifiers /*! * Test class declaration */ class Test: public wxPanel { DECLARE_DYNAMIC_CLASS( Test ) DECLARE_EVENT_TABLE() public: /// Constructors Test(); Test( wxWindow* parent, wxWindowID id = SYMBOL_TEST_IDNAME, const wxPoint& pos = SYMBOL_TEST_POSITION, const wxSize& size = SYMBOL_TEST_SIZE, long style = SYMBOL_TEST_STYLE ); /// Creation bool Create( wxWindow* parent, wxWindowID id = SYMBOL_TEST_IDNAME, const wxPoint& pos = SYMBOL_TEST_POSITION, const wxSize& size = SYMBOL_TEST_SIZE, long style = SYMBOL_TEST_STYLE ); /// Destructor ~Test(); /// Initialises member variables void Init(); /// Creates the controls and sizers void CreateControls(); void OnStartButtonClick( wxCommandEvent& event ); void OnCloseButtonClick( wxCommandEvent& event ); ////@begin Test event handler declarations ////@end Test event handler declarations ////@begin Test member function declarations /// Retrieves bitmap resources wxBitmap GetBitmapResource( const wxString& name ); /// Retrieves icon resources wxIcon GetIconResource( const wxString& name ); ////@end Test member function declarations /// Should we show tooltips? static bool ShowToolTips(); ////@begin Test member variables wxSpinCtrl* mSpinner; wxButton* mStart; wxButton* mStop; ////@end Test member variables }; #endif // _TEST_H_
// // For more information, please see: http://software.sci.utah.edu // // The MIT License // // Copyright (c) 2009 Scientific Computing and Imaging Institute, // University of Utah. // // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // // File : TestTool.cc // Author : Raf and Ramon // Date : Sun Oct 1 23:22:04 2006 #include <StandAlone/Apps/Seg3D/Painter.h> #include <StandAlone/Apps/Seg3D/TestTool.h> #include <Core/Events/EventManager.h> #include <Core/Events/LoadVolumeEvent.h> #include <sci_gl.h> #include <StandAlone/Apps/Seg3D/GuiCode/cropvolume.h> #include <StandAlone/Apps/Seg3D/GuiCode/seg3devents.h> #ifdef _WIN32 # undef SCISHARE # define SCISHARE __declspec(dllimport) #else # define SCISHARE #endif namespace SCIRun { TestTool::TestTool(Painter *painter) : BaseTool("Test"), PointerTool("Test"), painter_(painter), pick_(0) { // if (painter_->current_volume_.get_rep()) { // minmax_[1] = painter_->current_volume_->max_index(); // } else { // minmax_[1] = vector<int>(4, 0); // } // // minmax_[0] = vector<int>(minmax_[1].size(), 0); // // pick_minmax_[0] = minmax_[0]; // pick_minmax_[1] = minmax_[1]; // gui_minmax_[0].resize(minmax_[1].size()); // gui_minmax_[1].resize(minmax_[1].size()); // // Skinner::Variables *vars = painter_->get_vars(); // // gui_minmax_[0][1] = Skinner::Var<double>(vars, "Painter::crop::min::x", minmax_[0][1]); // gui_minmax_[0][2] = Skinner::Var<double>(vars, "Painter::crop::min::y", minmax_[0][2]); // gui_minmax_[0][3] = Skinner::Var<double>(vars, "Painter::crop::min::z", minmax_[0][3]); // gui_minmax_[1][1] = Skinner::Var<double>(vars, "Painter::crop::max::x", minmax_[1][1]); // gui_minmax_[1][2] = Skinner::Var<double>(vars, "Painter::crop::max::y", minmax_[1][2]); // gui_minmax_[1][3] = Skinner::Var<double>(vars, "Painter::crop::max::z", minmax_[1][3]); // // update_to_gui(); // // // Set the range to match this layer size. // // // // TODO: If the user selects a differently sized data layer after // // starting a crop the range will be incorrect as it will match the // // first one. Need to reupdate the range on layer selection. // wxPanel *panel = Painter::global_seg3dframe_pointer_->CurrentToolPanel(); // if (panel) // { // CropSetRangeStruct *csrs = new CropSetRangeStruct; // // // Set the max range of each spinner crtl. // if (painter_->current_volume_.get_rep()) // { // csrs->min_x = Max(minmax_[1][1]-1, 0); // csrs->min_y = Max(minmax_[1][2]-1, 0); // csrs->min_z = Max(minmax_[1][3]-1, 0); // csrs->max_x = minmax_[1][1]; // csrs->max_y = minmax_[1][2]; // csrs->max_z = minmax_[1][3]; // } // else // { // // No layer selected, no range to set. Use big rather than 0. // csrs->min_x = 0x7fffffff; // csrs->min_y = 0x7fffffff; // csrs->min_z = 0x7fffffff; // csrs->max_x = 0x7fffffff; // csrs->max_y = 0x7fffffff; // csrs->max_z = 0x7fffffff; // } // wxCommandEvent event(wxEVT_CROP_SET_RANGE, wxID_ANY); // event.SetClientData((void *)csrs); // wxPostEvent(panel, event); // } // // painter_->redraw_all(); } TestTool::~TestTool() { // painter_->redraw_all(); } BaseTool::propagation_state_e TestTool::pointer_motion(int b, int x, int y, unsigned int m, int t) { // if (!painter_->current_volume_.get_rep() || !pick_) // { // return CONTINUE_E; // } // // SliceWindow *window = painter_->cur_window_; // ASSERT(window); // // vector<int> max_index = painter_->current_volume_->max_index(); // // vector<double> idx = // painter_->current_volume_->point_to_index(painter_->pointer_pos_); // // if (pick_ == 1) // Clicked inside crop box // { // for (unsigned int i=0; i<2; ++i) // { // for (unsigned int a=1; a<4; ++a) // { // // Skip the axis that the pointer is on. NOTE: the volume // // indices have four dimensions. // if (a-1 == window->axis_) continue; // // // Set delta such the box size does not change when it is // // moved to the boundary. // double delta = Clamp(idx[a]-Floor(pick_index_[a]), // -double(pick_minmax_[0][a]), // double(max_index[a]-pick_minmax_[1][a])); // // minmax_[i][a] = (int) Floor(pick_minmax_[i][a]+delta); // } // } // } // else // Clicked on crop box boundary // { // for (unsigned int i=0; i<2; ++i) // { // for (unsigned int a=1; a<4; ++a) // { // // Skip the axis that the pointer is on. NOTE: the volume // // indices have four dimensions. // if (a-1 == window->axis_) continue; // // int newval = Clamp(Round(idx[a]), 0, max_index[a]); // // // Make sure the point was picked and is not the same value as // // the opposite corner. // if (Abs(pick_dist_[i][a-1]) < 5.0 && newval != minmax_[(i+1)%2][a]) // { // minmax_[i][a] = newval; // } // } // } // } // update_to_gui(); // painter_->redraw_all(); return STOP_E; } BaseTool::propagation_state_e TestTool::pointer_down(int b, int x, int y, unsigned int m, int t) { // if (!painter_->current_volume_.get_rep()) // { // painter_->set_status("No active volume to crop."); // return CONTINUE_E; // } // // if (b == 1 && !m) // { // SliceWindow *window = painter_->cur_window_; // ASSERT(window); // // double units = 100.0 / window->zoom_; // world space units per pixel // pick_ = 1; // Assume the pointer is inside the crop box. // // for (int i = 0; i < 2; ++i) // { // // Save the initial crop boundary. // pick_minmax_[i] = minmax_[i]; // // Point p = painter_->current_volume_->index_to_world(minmax_[i]); // // for (int a = 0; a < 3; ++a) // { // if( a == window->axis_) // { // // Skip when the plane and axis align as the distance can be // // zero but points with in the plane should be changed. // pick_dist_[i][a] = 999; // } // else // { // Vector n(a==0?1:0, a==1?1:0, a==2?1:0); // // if (i) // n *= -1; // // Plane plane(p, n); // // pick_dist_[i][a] = plane.eval_point(painter_->pointer_pos_)/units; // // // Pointer is near a boundary, may be on either side of it. // if (Abs(pick_dist_[i][a]) < 5.0) // pick_ |= 2; // Set the second bit. // // // Pointer is outside the crop boundary, may still be near the // // boundary though. // if (pick_dist_[i][a] < 0.0) // pick_ &= ~1; // Clear the first bit ~1 = 011111... // } // } // } // // pick_index_ = // painter_->current_volume_->point_to_index(painter_->pointer_pos_); // // return STOP_E; // } return CONTINUE_E; } BaseTool::propagation_state_e TestTool::pointer_up(int b, int x, int y, unsigned int m, int t) { // if (pick_) { // for (unsigned int a = 0; a < minmax_[0].size(); ++a) // if (minmax_[0][a] > minmax_[1][a]) // SWAP(minmax_[0][a],minmax_[1][a]); // // pick_ = 0; // update_to_gui(); // return STOP_E; // } return CONTINUE_E; } BaseTool::propagation_state_e TestTool::process_event(event_handle_t event) { // RedrawSliceWindowEvent *redraw = // dynamic_cast<RedrawSliceWindowEvent *>(event.get_rep()); // if (redraw) { // draw_gl(redraw->get_window()); // } // // if (dynamic_cast<FinishEvent *>(event.get_rep())) { // finish(); // } return CONTINUE_E; } void TestTool::update_to_gui() { // for (int i = 0; i < 2; ++i) // for (int j = 1; j < 4; ++j) // { // gui_minmax_[i][j] = minmax_[i][j]; // } // // CropSetRangeStruct *csrs = new CropSetRangeStruct; // csrs->min_x = minmax_[0][1]; // csrs->min_y = minmax_[0][2]; // csrs->min_z = minmax_[0][3]; // csrs->max_x = minmax_[1][1]; // csrs->max_y = minmax_[1][2]; // csrs->max_z = minmax_[1][3]; // // wxCommandEvent event(wxEVT_CROP_SET_MINMAX, wxID_ANY); // event.SetClientData((void *)csrs); // wxPanel *panel = Painter::global_seg3dframe_pointer_->CurrentToolPanel(); // if (panel) { wxPostEvent(panel, event); } } void TestTool::update_from_gui() { // // Need to delete the for loops for the wx version. // for (int i = 0; i < 2; ++i) // for (int j = 1; j < 4; ++j) // { // minmax_[i][j] = Round(gui_minmax_[i][j]()); // } } int TestTool::draw_gl(SliceWindow &window) { // if (!painter_->current_volume_.get_rep()) return 0; // update_from_gui(); // glEnable(GL_BLEND); // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // // Point ll = painter_->current_volume_->index_to_world(minmax_[0]); // Point ur = painter_->current_volume_->index_to_world(minmax_[1]); // // Vector dia = ur - ll; // // Vector right = window.x_dir(); // right.normalize(); // right = right*dia; // // // When flipped right is left and left is right. // if( window.flip_leftright_ ) { // right *= -1.0; // } // // Vector up = window.y_dir(); // up.normalize(); // up = up*dia; // // // When flipped up is down and down is up. // if( window.flip_updown_ ) { // up *= -1.0; // } // // Point lr = ll+right; // Point ul = ll+up; // ur = ll+right+up; // // // GLdouble blue[4] = { 0.1, 0.4, 1.0, 0.8 }; // // GLdouble green[4] = { 0.5, 1.0, 0.1, 0.7 }; // // GLdouble lt_green[4] = { 0.5, 1.0, 0.1, 0.4 }; // // GLdouble red[4] = { 0.8, 0.2, 0.4, 0.9 }; // GLdouble grey[4] = { 0.6, 0.6, 0.6, 0.6 }; // GLdouble white[4] = { 1.0, 1.0, 1.0, 1.0 }; // GLdouble black[4] = { 0.0, 0.0, 0.0, 1.0 }; // GLdouble yellow[4] = { 1.0, 0.76, 0.1, 1.0 }; // GLdouble lt_yellow[4] = { 0.8, 0.5, 0.1, 1.0 }; // // GLdouble *colors[5] = { lt_yellow, yellow, black, grey, white }; // GLdouble widths[5] = { 11, 9.0, 7.0, 5.0, 1.0 }; // // glEnable(GL_LINE_SMOOTH); // for (int pass = 2; pass < 5; ++pass) { // glColor4dv(colors[pass]); // glLineWidth(widths[pass]); // // glBegin(GL_LINE_LOOP); // { // glVertex3dv(&ll(0)); // glVertex3dv(&lr(0)); // glVertex3dv(&ur(0)); // glVertex3dv(&ul(0)); // } // glEnd(); // } // glLineWidth(1.0); // glDisable(GL_LINE_SMOOTH); // // widths[0] = 10.0; // widths[1] = 6.0; // widths[2] = 2.0; // // glEnable(GL_POINT_SMOOTH); // for (int pass = 0; pass < 5; ++pass) { // glColor4dv(colors[pass]); // glPointSize(widths[pass]); // glBegin(GL_POINTS); // { // glVertex3dv(&ll(0)); // glVertex3dv(&lr(0)); // glVertex3dv(&ur(0)); // glVertex3dv(&ul(0)); // } // glEnd(); // } // // glDisable(GL_POINT_SMOOTH); // // CHECK_OPENGL_ERROR(); return 0; } BaseTool::propagation_state_e TestTool::finish() { // if (!painter_->current_volume_.get_rep()) // { // painter_->set_status("Crop tool requires an active volume."); // return STOP_E; // } // // // Check for invalid crop volume, creatable with entry boxes. // // Punt out if volume is not fixable, otherwise just fix it. // for (unsigned int a = 0; a < minmax_[0].size(); ++a) // { // if (minmax_[0][a] > minmax_[1][a]) // { // SWAP(minmax_[0][a], minmax_[1][a]); // } // if (minmax_[0][a] == minmax_[1][a]) // { // painter_->set_status("Invalid crop, no volume would be left."); // return STOP_E; // } // } // // size_t *minmax[2] = { new size_t[minmax_[0].size()], // new size_t[minmax_[1].size()] }; // // for (int i = 0; i < 2; ++i) { // for (unsigned int a = 0; a < minmax_[0].size(); ++a) { // minmax[i][a] = minmax_[i][a]-(i==1?1:0); // } // } // // if (minmax[0][2] > minmax[1][2]) // { // minmax[1][2] = minmax[0][2]+ 10; // } // // NrrdDataHandle nout_handle = new NrrdData(); // if (nrrdCrop(nout_handle->nrrd_, // painter_->current_volume_->nrrd_handle_->nrrd_, // minmax[0], minmax[1])) { // char *err = biffGetDone(NRRD); // string str = string("nrrdcrop: ") + err; // free(err); // throw str; // } // // delete[] minmax[0]; // delete[] minmax[1]; // // // Make a new cropped volume similar to the old volume. // NrrdVolumeHandle croppedvol = // new NrrdVolume(painter_, painter_->current_volume_->name_, // nout_handle, painter_->current_volume_->label_); // if (croppedvol->label_) // { // croppedvol->set_label_color(painter_->current_volume_->get_label_color()); // } // // // Replace the old volume with the new volume. // NrrdVolumeHandle oldvol = painter_->current_volume_; // size_t loc = painter_->remove_volume(painter_->current_volume_, false); // loc = loc + 1; // We're off by one for some reason. // painter_->insert_volume(croppedvol, loc); // painter_->current_volume_ = croppedvol; // // // Reset the volume rendering. // if (painter_->current_volume_ == painter_->current_vrender_target_ && // !painter_->current_vrender_target_deferred_) // { // LoadVolumeEvent *lve = // new LoadVolumeEvent(painter_->current_vrender_target_->nrrd_handle_, // "", false); // EventManager::add_event(lve); // } // // // Push this undo item. // UndoHandle undo = new UndoReplaceLayer(painter_, "Undo Crop", // oldvol, croppedvol, loc); // painter_->push_undo(undo); // // // Center the probe on the new cropped volume. // const Point center = painter_->current_volume_->center(); // for (unsigned int i = 0; i < painter_->windows_.size(); ++ i) { // painter_->windows_[i]->center_ = center; // } // // // Reset the slices to match the new volume. // painter_->rebuild_layer_buttons(); // painter_->extract_all_window_slices(); // painter_->redraw_all(); // // // Autoview to the cropped volume. // event_handle_t empty; // painter_->Autoview(empty); // // painter_->hide_tool_panel(); return CONTINUE_E; } void TestTool::set_window_cursor(SliceWindow &window, int cursor) { return; // if (painter_->event_.window_ != &window || // window.cursor_pixmap_ == cursor) return; // window.cursor_pixmap_ = cursor; string cursor_name; switch (cursor) { case 1: cursor_name = "bottom_left_corner"; break; case 2: cursor_name = "bottom_right_corner"; break; case 3: cursor_name = "top_right_corner"; break; case 4: cursor_name = "top_left_corner"; break; case 5: cursor_name = "sb_h_double_arrow"; break; case 6: cursor_name = "sb_v_double_arrow"; break; case 7: cursor_name = "sb_h_double_arrow"; break; case 8: cursor_name = "sb_v_double_arrow"; break; case 9: cursor_name = "fleur"; break; case 0: cursor_name = "crosshair"; break; } } }
// // For more information, please see: http://software.sci.utah.edu // // The MIT License // // Copyright (c) 2009 Scientific Computing and Imaging Institute, // University of Utah. // // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // // File : TestTool.h // Author : Raf and Ramon // Date : Sat Oct 14 12:06:30 2006 #ifndef SEG3D_TestTool_h #define SEG3D_TestTool_h #include <Core/Events/BaseTool.h> #include <Core/Geometry/BBox.h> #include <vector> namespace SCIRun { using std::vector; class Painter; class TestTool : public virtual BaseTool, public PointerTool { public: TestTool(Painter *painter); ~TestTool(); propagation_state_e process_event(event_handle_t); propagation_state_e pointer_motion(int b, int x, int y, unsigned m, int t); propagation_state_e pointer_down(int b, int x, int y, unsigned m, int t); propagation_state_e pointer_up(int b, int x, int y, unsigned m, int t); private: int draw_gl(SliceWindow &window); typedef vector<BBox> BBoxes; propagation_state_e finish(); void set_window_cursor(SliceWindow &window, int cursor); void update_to_gui(); void update_from_gui(); Painter * painter_; int pick_; vector<int> minmax_[2]; vector<Skinner::Var<double> > gui_minmax_[2]; vector<int> pick_minmax_[2]; vector<double> pick_index_; double pick_dist_[2][3]; }; } #endif
Index: src/CMake/FindOpenGL.cmake =================================================================== --- src/CMake/FindOpenGL.cmake (revision 44410) +++ src/CMake/FindOpenGL.cmake (working copy) @@ -106,14 +106,26 @@ /usr/X11R6/include ) +# ramc: patch suggested by Kristen Zygmunt to fix error at build time +# FIND_LIBRARY(OPENGL_gl_LIBRARY +# NAMES GL MesaGL +# PATHS /usr/lib +# /usr/local/lib +# /opt/graphics/OpenGL/lib +# /usr/openwin/lib +# /usr/X11R6/lib +# /usr/shlib +# ) FIND_LIBRARY(OPENGL_gl_LIBRARY - NAMES GL MesaGL - PATHS /usr/lib - /usr/local/lib - /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/X11R6/lib - /usr/shlib + NAMES GLU MesaGLU + PATHS ${OPENGL_gl_LIBRARY} + /usr/lib + /usr/local/lib + /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/X11R6/lib + /usr/shlib + /usr/lib32 ) # On Unix OpenGL most certainly always requires X11. Index: src/StandAlone/Apps/Seg3D/TestTool.cc =================================================================== --- src/StandAlone/Apps/Seg3D/TestTool.cc (revision 0) +++ src/StandAlone/Apps/Seg3D/TestTool.cc (revision 0) @@ -0,0 +1,542 @@ +// +// For more information, please see: http://software.sci.utah.edu +// +// The MIT License +// +// Copyright (c) 2009 Scientific Computing and Imaging Institute, +// University of Utah. +// +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File : TestTool.cc +// Author : Raf and Ramon +// Date : Sun Oct 1 23:22:04 2006 + + + +#include <StandAlone/Apps/Seg3D/Painter.h> +#include <StandAlone/Apps/Seg3D/TestTool.h> +#include <Core/Events/EventManager.h> +#include <Core/Events/LoadVolumeEvent.h> +#include <sci_gl.h> + +#include <StandAlone/Apps/Seg3D/GuiCode/cropvolume.h> +#include <StandAlone/Apps/Seg3D/GuiCode/seg3devents.h> + +#ifdef _WIN32 +# undef SCISHARE +# define SCISHARE __declspec(dllimport) +#else +# define SCISHARE +#endif + +namespace SCIRun { + + +TestTool::TestTool(Painter *painter) : + BaseTool("Test"), + PointerTool("Test"), + painter_(painter), + pick_(0) +{ +// if (painter_->current_volume_.get_rep()) { +// minmax_[1] = painter_->current_volume_->max_index(); +// } else { +// minmax_[1] = vector<int>(4, 0); +// } +// +// minmax_[0] = vector<int>(minmax_[1].size(), 0); +// +// pick_minmax_[0] = minmax_[0]; +// pick_minmax_[1] = minmax_[1]; +// gui_minmax_[0].resize(minmax_[1].size()); +// gui_minmax_[1].resize(minmax_[1].size()); +// +// Skinner::Variables *vars = painter_->get_vars(); +// +// gui_minmax_[0][1] = Skinner::Var<double>(vars, "Painter::crop::min::x", minmax_[0][1]); +// gui_minmax_[0][2] = Skinner::Var<double>(vars, "Painter::crop::min::y", minmax_[0][2]); +// gui_minmax_[0][3] = Skinner::Var<double>(vars, "Painter::crop::min::z", minmax_[0][3]); +// gui_minmax_[1][1] = Skinner::Var<double>(vars, "Painter::crop::max::x", minmax_[1][1]); +// gui_minmax_[1][2] = Skinner::Var<double>(vars, "Painter::crop::max::y", minmax_[1][2]); +// gui_minmax_[1][3] = Skinner::Var<double>(vars, "Painter::crop::max::z", minmax_[1][3]); +// +// update_to_gui(); +// +// // Set the range to match this layer size. +// // +// // TODO: If the user selects a differently sized data layer after +// // starting a crop the range will be incorrect as it will match the +// // first one. Need to reupdate the range on layer selection. +// wxPanel *panel = Painter::global_seg3dframe_pointer_->CurrentToolPanel(); +// if (panel) +// { +// CropSetRangeStruct *csrs = new CropSetRangeStruct; +// +// // Set the max range of each spinner crtl. +// if (painter_->current_volume_.get_rep()) +// { +// csrs->min_x = Max(minmax_[1][1]-1, 0); +// csrs->min_y = Max(minmax_[1][2]-1, 0); +// csrs->min_z = Max(minmax_[1][3]-1, 0); +// csrs->max_x = minmax_[1][1]; +// csrs->max_y = minmax_[1][2]; +// csrs->max_z = minmax_[1][3]; +// } +// else +// { +// // No layer selected, no range to set. Use big rather than 0. +// csrs->min_x = 0x7fffffff; +// csrs->min_y = 0x7fffffff; +// csrs->min_z = 0x7fffffff; +// csrs->max_x = 0x7fffffff; +// csrs->max_y = 0x7fffffff; +// csrs->max_z = 0x7fffffff; +// } +// wxCommandEvent event(wxEVT_CROP_SET_RANGE, wxID_ANY); +// event.SetClientData((void *)csrs); +// wxPostEvent(panel, event); +// } +// +// painter_->redraw_all(); +} + + +TestTool::~TestTool() +{ +// painter_->redraw_all(); +} + + +BaseTool::propagation_state_e +TestTool::pointer_motion(int b, int x, int y, unsigned int m, int t) +{ +// if (!painter_->current_volume_.get_rep() || !pick_) +// { +// return CONTINUE_E; +// } +// +// SliceWindow *window = painter_->cur_window_; +// ASSERT(window); +// +// vector<int> max_index = painter_->current_volume_->max_index(); +// +// vector<double> idx = +// painter_->current_volume_->point_to_index(painter_->pointer_pos_); +// +// if (pick_ == 1) // Clicked inside crop box +// { +// for (unsigned int i=0; i<2; ++i) +// { +// for (unsigned int a=1; a<4; ++a) +// { +// // Skip the axis that the pointer is on. NOTE: the volume +// // indices have four dimensions. +// if (a-1 == window->axis_) continue; +// +// // Set delta such the box size does not change when it is +// // moved to the boundary. +// double delta = Clamp(idx[a]-Floor(pick_index_[a]), +// -double(pick_minmax_[0][a]), +// double(max_index[a]-pick_minmax_[1][a])); +// +// minmax_[i][a] = (int) Floor(pick_minmax_[i][a]+delta); +// } +// } +// } +// else // Clicked on crop box boundary +// { +// for (unsigned int i=0; i<2; ++i) +// { +// for (unsigned int a=1; a<4; ++a) +// { +// // Skip the axis that the pointer is on. NOTE: the volume +// // indices have four dimensions. +// if (a-1 == window->axis_) continue; +// +// int newval = Clamp(Round(idx[a]), 0, max_index[a]); +// +// // Make sure the point was picked and is not the same value as +// // the opposite corner. +// if (Abs(pick_dist_[i][a-1]) < 5.0 && newval != minmax_[(i+1)%2][a]) +// { +// minmax_[i][a] = newval; +// } +// } +// } +// } +// update_to_gui(); +// painter_->redraw_all(); + return STOP_E; +} + + +BaseTool::propagation_state_e +TestTool::pointer_down(int b, int x, int y, unsigned int m, int t) +{ +// if (!painter_->current_volume_.get_rep()) +// { +// painter_->set_status("No active volume to crop."); +// return CONTINUE_E; +// } +// +// if (b == 1 && !m) +// { +// SliceWindow *window = painter_->cur_window_; +// ASSERT(window); +// +// double units = 100.0 / window->zoom_; // world space units per pixel +// pick_ = 1; // Assume the pointer is inside the crop box. +// +// for (int i = 0; i < 2; ++i) +// { +// // Save the initial crop boundary. +// pick_minmax_[i] = minmax_[i]; +// +// Point p = painter_->current_volume_->index_to_world(minmax_[i]); +// +// for (int a = 0; a < 3; ++a) +// { +// if( a == window->axis_) +// { +// // Skip when the plane and axis align as the distance can be +// // zero but points with in the plane should be changed. +// pick_dist_[i][a] = 999; +// } +// else +// { +// Vector n(a==0?1:0, a==1?1:0, a==2?1:0); +// +// if (i) +// n *= -1; +// +// Plane plane(p, n); +// +// pick_dist_[i][a] = plane.eval_point(painter_->pointer_pos_)/units; +// +// // Pointer is near a boundary, may be on either side of it. +// if (Abs(pick_dist_[i][a]) < 5.0) +// pick_ |= 2; // Set the second bit. +// +// // Pointer is outside the crop boundary, may still be near the +// // boundary though. +// if (pick_dist_[i][a] < 0.0) +// pick_ &= ~1; // Clear the first bit ~1 = 011111... +// } +// } +// } +// +// pick_index_ = +// painter_->current_volume_->point_to_index(painter_->pointer_pos_); +// +// return STOP_E; +// } + + return CONTINUE_E; +} + + + +BaseTool::propagation_state_e +TestTool::pointer_up(int b, int x, int y, unsigned int m, int t) +{ +// if (pick_) { +// for (unsigned int a = 0; a < minmax_[0].size(); ++a) +// if (minmax_[0][a] > minmax_[1][a]) +// SWAP(minmax_[0][a],minmax_[1][a]); +// +// pick_ = 0; +// update_to_gui(); +// return STOP_E; +// } + return CONTINUE_E; +} + + +BaseTool::propagation_state_e +TestTool::process_event(event_handle_t event) +{ +// RedrawSliceWindowEvent *redraw = +// dynamic_cast<RedrawSliceWindowEvent *>(event.get_rep()); +// if (redraw) { +// draw_gl(redraw->get_window()); +// } +// +// if (dynamic_cast<FinishEvent *>(event.get_rep())) { +// finish(); +// } + + return CONTINUE_E; +} + + +void +TestTool::update_to_gui() +{ +// for (int i = 0; i < 2; ++i) +// for (int j = 1; j < 4; ++j) +// { +// gui_minmax_[i][j] = minmax_[i][j]; +// } +// +// CropSetRangeStruct *csrs = new CropSetRangeStruct; +// csrs->min_x = minmax_[0][1]; +// csrs->min_y = minmax_[0][2]; +// csrs->min_z = minmax_[0][3]; +// csrs->max_x = minmax_[1][1]; +// csrs->max_y = minmax_[1][2]; +// csrs->max_z = minmax_[1][3]; +// +// wxCommandEvent event(wxEVT_CROP_SET_MINMAX, wxID_ANY); +// event.SetClientData((void *)csrs); +// wxPanel *panel = Painter::global_seg3dframe_pointer_->CurrentToolPanel(); +// if (panel) { wxPostEvent(panel, event); } +} + + +void +TestTool::update_from_gui() +{ +// // Need to delete the for loops for the wx version. +// for (int i = 0; i < 2; ++i) +// for (int j = 1; j < 4; ++j) +// { +// minmax_[i][j] = Round(gui_minmax_[i][j]()); +// } +} + + +int +TestTool::draw_gl(SliceWindow &window) +{ +// if (!painter_->current_volume_.get_rep()) return 0; +// update_from_gui(); +// glEnable(GL_BLEND); +// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +// +// Point ll = painter_->current_volume_->index_to_world(minmax_[0]); +// Point ur = painter_->current_volume_->index_to_world(minmax_[1]); +// +// Vector dia = ur - ll; +// +// Vector right = window.x_dir(); +// right.normalize(); +// right = right*dia; +// +// // When flipped right is left and left is right. +// if( window.flip_leftright_ ) { +// right *= -1.0; +// } +// +// Vector up = window.y_dir(); +// up.normalize(); +// up = up*dia; +// +// // When flipped up is down and down is up. +// if( window.flip_updown_ ) { +// up *= -1.0; +// } +// +// Point lr = ll+right; +// Point ul = ll+up; +// ur = ll+right+up; +// +// // GLdouble blue[4] = { 0.1, 0.4, 1.0, 0.8 }; +// // GLdouble green[4] = { 0.5, 1.0, 0.1, 0.7 }; +// // GLdouble lt_green[4] = { 0.5, 1.0, 0.1, 0.4 }; +// // GLdouble red[4] = { 0.8, 0.2, 0.4, 0.9 }; +// GLdouble grey[4] = { 0.6, 0.6, 0.6, 0.6 }; +// GLdouble white[4] = { 1.0, 1.0, 1.0, 1.0 }; +// GLdouble black[4] = { 0.0, 0.0, 0.0, 1.0 }; +// GLdouble yellow[4] = { 1.0, 0.76, 0.1, 1.0 }; +// GLdouble lt_yellow[4] = { 0.8, 0.5, 0.1, 1.0 }; +// +// GLdouble *colors[5] = { lt_yellow, yellow, black, grey, white }; +// GLdouble widths[5] = { 11, 9.0, 7.0, 5.0, 1.0 }; +// +// glEnable(GL_LINE_SMOOTH); +// for (int pass = 2; pass < 5; ++pass) { +// glColor4dv(colors[pass]); +// glLineWidth(widths[pass]); +// +// glBegin(GL_LINE_LOOP); +// { +// glVertex3dv(&ll(0)); +// glVertex3dv(&lr(0)); +// glVertex3dv(&ur(0)); +// glVertex3dv(&ul(0)); +// } +// glEnd(); +// } +// glLineWidth(1.0); +// glDisable(GL_LINE_SMOOTH); +// +// widths[0] = 10.0; +// widths[1] = 6.0; +// widths[2] = 2.0; +// +// glEnable(GL_POINT_SMOOTH); +// for (int pass = 0; pass < 5; ++pass) { +// glColor4dv(colors[pass]); +// glPointSize(widths[pass]); +// glBegin(GL_POINTS); +// { +// glVertex3dv(&ll(0)); +// glVertex3dv(&lr(0)); +// glVertex3dv(&ur(0)); +// glVertex3dv(&ul(0)); +// } +// glEnd(); +// } +// +// glDisable(GL_POINT_SMOOTH); +// +// CHECK_OPENGL_ERROR(); + return 0; +} + + +BaseTool::propagation_state_e +TestTool::finish() +{ +// if (!painter_->current_volume_.get_rep()) +// { +// painter_->set_status("Crop tool requires an active volume."); +// return STOP_E; +// } +// +// // Check for invalid crop volume, creatable with entry boxes. +// // Punt out if volume is not fixable, otherwise just fix it. +// for (unsigned int a = 0; a < minmax_[0].size(); ++a) +// { +// if (minmax_[0][a] > minmax_[1][a]) +// { +// SWAP(minmax_[0][a], minmax_[1][a]); +// } +// if (minmax_[0][a] == minmax_[1][a]) +// { +// painter_->set_status("Invalid crop, no volume would be left."); +// return STOP_E; +// } +// } +// +// size_t *minmax[2] = { new size_t[minmax_[0].size()], +// new size_t[minmax_[1].size()] }; +// +// for (int i = 0; i < 2; ++i) { +// for (unsigned int a = 0; a < minmax_[0].size(); ++a) { +// minmax[i][a] = minmax_[i][a]-(i==1?1:0); +// } +// } +// +// if (minmax[0][2] > minmax[1][2]) +// { +// minmax[1][2] = minmax[0][2]+ 10; +// } +// +// NrrdDataHandle nout_handle = new NrrdData(); +// if (nrrdCrop(nout_handle->nrrd_, +// painter_->current_volume_->nrrd_handle_->nrrd_, +// minmax[0], minmax[1])) { +// char *err = biffGetDone(NRRD); +// string str = string("nrrdcrop: ") + err; +// free(err); +// throw str; +// } +// +// delete[] minmax[0]; +// delete[] minmax[1]; +// +// // Make a new cropped volume similar to the old volume. +// NrrdVolumeHandle croppedvol = +// new NrrdVolume(painter_, painter_->current_volume_->name_, +// nout_handle, painter_->current_volume_->label_); +// if (croppedvol->label_) +// { +// croppedvol->set_label_color(painter_->current_volume_->get_label_color()); +// } +// +// // Replace the old volume with the new volume. +// NrrdVolumeHandle oldvol = painter_->current_volume_; +// size_t loc = painter_->remove_volume(painter_->current_volume_, false); +// loc = loc + 1; // We're off by one for some reason. +// painter_->insert_volume(croppedvol, loc); +// painter_->current_volume_ = croppedvol; +// +// // Reset the volume rendering. +// if (painter_->current_volume_ == painter_->current_vrender_target_ && +// !painter_->current_vrender_target_deferred_) +// { +// LoadVolumeEvent *lve = +// new LoadVolumeEvent(painter_->current_vrender_target_->nrrd_handle_, +// "", false); +// EventManager::add_event(lve); +// } +// +// // Push this undo item. +// UndoHandle undo = new UndoReplaceLayer(painter_, "Undo Crop", +// oldvol, croppedvol, loc); +// painter_->push_undo(undo); +// +// // Center the probe on the new cropped volume. +// const Point center = painter_->current_volume_->center(); +// for (unsigned int i = 0; i < painter_->windows_.size(); ++ i) { +// painter_->windows_[i]->center_ = center; +// } +// +// // Reset the slices to match the new volume. +// painter_->rebuild_layer_buttons(); +// painter_->extract_all_window_slices(); +// painter_->redraw_all(); +// +// // Autoview to the cropped volume. +// event_handle_t empty; +// painter_->Autoview(empty); +// +// painter_->hide_tool_panel(); + + return CONTINUE_E; +} + + +void +TestTool::set_window_cursor(SliceWindow &window, int cursor) +{ + return; + // if (painter_->event_.window_ != &window || + // window.cursor_pixmap_ == cursor) return; + // window.cursor_pixmap_ = cursor; + string cursor_name; + switch (cursor) { + case 1: cursor_name = "bottom_left_corner"; break; + case 2: cursor_name = "bottom_right_corner"; break; + case 3: cursor_name = "top_right_corner"; break; + case 4: cursor_name = "top_left_corner"; break; + case 5: cursor_name = "sb_h_double_arrow"; break; + case 6: cursor_name = "sb_v_double_arrow"; break; + case 7: cursor_name = "sb_h_double_arrow"; break; + case 8: cursor_name = "sb_v_double_arrow"; break; + case 9: cursor_name = "fleur"; break; + case 0: cursor_name = "crosshair"; break; + } +} + + +} Index: src/StandAlone/Apps/Seg3D/Seg3DFrame.cc =================================================================== --- src/StandAlone/Apps/Seg3D/Seg3DFrame.cc (revision 44410) +++ src/StandAlone/Apps/Seg3D/Seg3DFrame.cc (working copy) @@ -70,6 +70,7 @@ #include <StandAlone/Apps/Seg3D/GuiCode/resampletool.h> #include <StandAlone/Apps/Seg3D/GuiCode/thresholdtoolpanel.h> #include <StandAlone/Apps/Seg3D/GuiCode/windowleveltoolpanel.h> +#include <StandAlone/Apps/Seg3D/GuiCode/test.h> // #define USING_HELP_FILES @@ -144,6 +145,7 @@ EVT_MENU(MENU_TOOL_WINDOWLEVEL, Seg3DFrame::ToolWindowLevel) EVT_MENU(MENU_TOOL_MOVESCALE, Seg3DFrame::ToolMoveScale) EVT_MENU(MENU_TOOL_MEASUREMENT, Seg3DFrame::ToolMeasurement) + EVT_MENU(MENU_TOOL_TEST, Seg3DFrame::ToolTest) EVT_MENU(MENU_FILTER_C_A_D_F, Seg3DFrame::Filter_CADF) EVT_MENU(MENU_FILTER_C_C_F, Seg3DFrame::Filter_CCF) @@ -298,6 +300,16 @@ tools_sizer->Show(movescaletoolpanel_, false); tools_sizer->Layout(); + std::cout << "Before Create Test" << std::endl; + testtoolpanel_ = new Test(toolsPanel_); + std::cout << "Before add" << std::endl; + tools_sizer->Add(testtoolpanel_, 0, 0, 0); + std::cout << "Before show" << std::endl; + tools_sizer->Show(testtoolpanel_, false); + std::cout << "Before layout" << std::endl; + tools_sizer->Layout(); + std::cout << "After layout" << std::endl; + intensitycorrectionfilterpanel_ = new IntensityCorrectionFilterPanel(toolsPanel_); tools_sizer->Add(intensitycorrectionfilterpanel_, 0, 0, 0); tools_sizer->Show(intensitycorrectionfilterpanel_, false); @@ -454,6 +466,7 @@ winMenu->Append(MENU_TOOL_WINDOWLEVEL, _T("&Window/Level Tool")); winMenu->Append(MENU_TOOL_MOVESCALE, _T("&Move/Scale Tool")); winMenu->Append(MENU_TOOL_MEASUREMENT, _T("Measurement Tool")); + winMenu->Append(MENU_TOOL_TEST, _T("Test Tool")); winMenu->AppendSeparator(); // Speedlines tools @@ -1290,6 +1303,13 @@ SCIRun::Painter::ThrowSkinnerSignal("Painter::StartMeasurementTool"); } +void Seg3DFrame::ToolTest( wxCommandEvent& WXUNUSED(event) ) +{ + ShowTool(testtoolpanel_, "", "Test Tool"); + + SCIRun::Painter::ThrowSkinnerSignal("Painter::StartTestTool"); +} + void Seg3DFrame::Filter_CADF( wxCommandEvent& WXUNUSED(event) ) { Index: src/StandAlone/Apps/Seg3D/PainterSignalTargets.cc =================================================================== --- src/StandAlone/Apps/Seg3D/PainterSignalTargets.cc (revision 44410) +++ src/StandAlone/Apps/Seg3D/PainterSignalTargets.cc (working copy) @@ -54,6 +54,7 @@ #include <StandAlone/Apps/Seg3D/ThresholdTool.h> #include <StandAlone/Apps/Seg3D/WindowLevelTool.h> #include <StandAlone/Apps/Seg3D/LineTool.h> +#include <StandAlone/Apps/Seg3D/TestTool.h> #include <StandAlone/Apps/Seg3D/SessionReader.h> #include <StandAlone/Apps/Seg3D/SessionWriter.h> #include <StandAlone/Apps/Seg3D/VolumeOps.h> @@ -136,6 +137,7 @@ REGISTER_CATCHER_TARGET(Painter::StartThresholdTool); REGISTER_CATCHER_TARGET(Painter::StartWindowLevelTool); REGISTER_CATCHER_TARGET(Painter::StartMeasurementTool); + REGISTER_CATCHER_TARGET(Painter::StartTestTool); REGISTER_CATCHER_TARGET(Painter::Autoview); REGISTER_CATCHER_TARGET(Painter::CopyLabel); @@ -438,7 +440,12 @@ return CONTINUE_E; } +BaseTool::propagation_state_e Painter::StartTestTool(event_handle_t &event) { + tm_.set_tool(new TestTool(this), 25); + return CONTINUE_E; +} + BaseTool::propagation_state_e Painter::Autoview(event_handle_t &) { Index: src/StandAlone/Apps/Seg3D/TestTool.h =================================================================== --- src/StandAlone/Apps/Seg3D/TestTool.h (revision 0) +++ src/StandAlone/Apps/Seg3D/TestTool.h (revision 0) @@ -0,0 +1,77 @@ +// +// For more information, please see: http://software.sci.utah.edu +// +// The MIT License +// +// Copyright (c) 2009 Scientific Computing and Imaging Institute, +// University of Utah. +// +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File : TestTool.h +// Author : Raf and Ramon +// Date : Sat Oct 14 12:06:30 2006 + +#ifndef SEG3D_TestTool_h +#define SEG3D_TestTool_h + +#include <Core/Events/BaseTool.h> +#include <Core/Geometry/BBox.h> +#include <vector> + + +namespace SCIRun { + +using std::vector; +class Painter; + + +class TestTool : public virtual BaseTool, + public PointerTool { +public: + TestTool(Painter *painter); + ~TestTool(); + propagation_state_e process_event(event_handle_t); + propagation_state_e pointer_motion(int b, int x, int y, + unsigned m, int t); + propagation_state_e pointer_down(int b, int x, int y, + unsigned m, int t); + propagation_state_e pointer_up(int b, int x, int y, + unsigned m, int t); +private: + int draw_gl(SliceWindow &window); + typedef vector<BBox> BBoxes; + propagation_state_e finish(); + void set_window_cursor(SliceWindow &window, int cursor); + void update_to_gui(); + void update_from_gui(); + Painter * painter_; + int pick_; + vector<int> minmax_[2]; + vector<Skinner::Var<double> > gui_minmax_[2]; + vector<int> pick_minmax_[2]; + vector<double> pick_index_; + double pick_dist_[2][3]; +}; + + +} + +#endif Index: src/StandAlone/Apps/Seg3D/CMakeLists.txt =================================================================== --- src/StandAlone/Apps/Seg3D/CMakeLists.txt (revision 44410) +++ src/StandAlone/Apps/Seg3D/CMakeLists.txt (working copy) @@ -104,6 +104,7 @@ BrushTool.cc CLUTLevelsTool.cc CropTool.cc + TestTool.cc ArithmeticTool.cc FloodFillCopyTool.cc FloodfillTool.cc @@ -179,6 +180,7 @@ GuiCode/itkspeedtopathgradientdescentfilter.cpp GuiCode/itkspeedtopathregularstepgradientdescentfilter.cpp GuiCode/itkspeedtopathiterateneighborhoodfilter.cpp + GuiCode/test.cpp ) IF(WIN32) Index: src/StandAlone/Apps/Seg3D/GuiCode/Seg3d.pjd =================================================================== --- src/StandAlone/Apps/Seg3D/GuiCode/Seg3d.pjd (revision 44410) +++ src/StandAlone/Apps/Seg3D/GuiCode/Seg3d.pjd (working copy) @@ -20,6 +20,7 @@ <string name="resource_prefix">""</string> <bool name="use_two_step_construction">0</bool> <bool name="use_enums">0</bool> + <bool name="generate_for_xrced">0</bool> <string name="current_platform">"<All platforms>"</string> <string name="target_wx_version">"2.8.4"</string> <string name="cpp_header_comment">"///////////////////////////////////////////////////////////////////////////// @@ -106,6 +107,7 @@ <bool name="archive_all_image_files">0</bool> <bool name="xrc_retain_relative_paths">1</bool> <bool name="xrc_generate_id_tags">0</bool> + <bool name="xrc_use_name_property">0</bool> </header> <data> <document> @@ -128,6 +130,7 @@ <long name="locked">0</long> <string name="template-name">""</string> <bool name="dirty">1</bool> + <long name="makefile-last-written">0</long> <string name="Compiler name">""</string> <string name="Build mode">"Debug"</string> <string name="Unicode mode">"ANSI"</string> @@ -148,6 +151,7 @@ <string name="Compiler location">"%AUTO%"</string> <string name="wxWidgets location">"%AUTO%"</string> <string name="C++ command">"%AUTO%"</string> + <string name="C command">"%AUTO%"</string> <string name="Resource compiler">"%AUTO%"</string> <string name="Make command">"%AUTO%"</string> <string name="Project makefile">"%AUTO%"</string> @@ -159,6 +163,7 @@ <string name="Optimizations">"%AUTO%"</string> <string name="Warnings">"%AUTO%"</string> <string name="Debug flags">"%AUTO%"</string> + <string name="Extra compile flags">"%AUTO%"</string> <string name="Libraries">"%AUTO%"</string> <string name="Library path">"%AUTO%"</string> <string name="Linker flags">"%AUTO%"</string> @@ -169,6 +174,9 @@ <string name="wxWidgets build command">"%AUTO%"</string> <string name="wxWidgets clean command">"%AUTO%"</string> <string name="PATH variable">"%AUTO%"</string> + <bool name="Suppress source rules">0</bool> + <bool name="Enable makefile generation">1</bool> + <string name="CFG">""</string> <document> <string name="title">"VC++ Debug"</string> <string name="type">"vc-config-data-document"</string> @@ -180,6 +188,7 @@ <long name="locked">0</long> <string name="template-name">"VC++"</string> <bool name="dirty">1</bool> + <long name="makefile-last-written">0</long> <string name="Compiler name">"VC++"</string> <string name="Build mode">"Debug"</string> <string name="Unicode mode">"ANSI"</string> @@ -200,6 +209,7 @@ <string name="Compiler location">"%AUTO%"</string> <string name="wxWidgets location">"%AUTO%"</string> <string name="C++ command">"%AUTO%"</string> + <string name="C command">"%AUTO%"</string> <string name="Resource compiler">"%AUTO%"</string> <string name="Make command">"%AUTO%"</string> <string name="Project makefile">"%AUTO%"</string> @@ -211,6 +221,7 @@ <string name="Optimizations">"%AUTO%"</string> <string name="Warnings">"%AUTO%"</string> <string name="Debug flags">"%AUTO%"</string> + <string name="Extra compile flags">"%AUTO%"</string> <string name="Libraries">"%AUTO%"</string> <string name="Library path">"%AUTO%"</string> <string name="Linker flags">"%AUTO%"</string> @@ -221,7 +232,10 @@ <string name="wxWidgets build command">"%AUTO%"</string> <string name="wxWidgets clean command">"%AUTO%"</string> <string name="PATH variable">"%AUTO%"</string> + <bool name="Suppress source rules">0</bool> + <bool name="Enable makefile generation">1</bool> <string name="CFG">""</string> + <string name="Ignore libraries">"%AUTO%"</string> </document> <document> <string name="title">"VC++ Release"</string> @@ -234,6 +248,7 @@ <long name="locked">0</long> <string name="template-name">"VC++"</string> <bool name="dirty">1</bool> + <long name="makefile-last-written">0</long> <string name="Compiler name">"VC++"</string> <string name="Build mode">"Release"</string> <string name="Unicode mode">"ANSI"</string> @@ -254,6 +269,7 @@ <string name="Compiler location">"%AUTO%"</string> <string name="wxWidgets location">"%AUTO%"</string> <string name="C++ command">"%AUTO%"</string> + <string name="C command">"%AUTO%"</string> <string name="Resource compiler">"%AUTO%"</string> <string name="Make command">"%AUTO%"</string> <string name="Project makefile">"%AUTO%"</string> @@ -265,6 +281,7 @@ <string name="Optimizations">"%AUTO%"</string> <string name="Warnings">"%AUTO%"</string> <string name="Debug flags">"%AUTO%"</string> + <string name="Extra compile flags">"%AUTO%"</string> <string name="Libraries">"%AUTO%"</string> <string name="Library path">"%AUTO%"</string> <string name="Linker flags">"%AUTO%"</string> @@ -275,7 +292,10 @@ <string name="wxWidgets build command">"%AUTO%"</string> <string name="wxWidgets clean command">"%AUTO%"</string> <string name="PATH variable">"%AUTO%"</string> + <bool name="Suppress source rules">0</bool> + <bool name="Enable makefile generation">1</bool> <string name="CFG">""</string> + <string name="Ignore libraries">"%AUTO%"</string> </document> <document> <string name="title">"VC++ Project Debug"</string> @@ -288,6 +308,7 @@ <long name="locked">0</long> <string name="template-name">"VC++ Project"</string> <bool name="dirty">0</bool> + <long name="makefile-last-written">0</long> <string name="Compiler name">"VC++ Project"</string> <string name="Build mode">"Debug"</string> <string name="Unicode mode">"ANSI"</string> @@ -309,6 +330,7 @@ <string name="Compiler location">"%AUTO%"</string> <string name="wxWidgets location">"%AUTO%"</string> <string name="C++ command">"%AUTO%"</string> + <string name="C command">"%AUTO%"</string> <string name="Resource compiler">"%AUTO%"</string> <string name="Make command">"%AUTO%"</string> <string name="Project makefile">"%AUTO%"</string> @@ -320,6 +342,7 @@ <string name="Optimizations">"%AUTO%"</string> <string name="Warnings">"%AUTO%"</string> <string name="Debug flags">"%AUTO%"</string> + <string name="Extra compile flags">"%AUTO%"</string> <string name="Libraries">"%AUTO%"</string> <string name="Library path">"%AUTO%"</string> <string name="Linker flags">"%AUTO%"</string> @@ -330,6 +353,9 @@ <string name="wxWidgets build command">"%AUTO%"</string> <string name="wxWidgets clean command">"%AUTO%"</string> <string name="PATH variable">"%AUTO%"</string> + <bool name="Suppress source rules">0</bool> + <bool name="Enable makefile generation">1</bool> + <string name="CFG">""</string> <string name="Project make command">"%AUTO%"</string> <string name="Project build command">"%AUTO%"</string> <string name="Project rebuild command">"%AUTO%"</string> @@ -338,7 +364,7 @@ <string name="Pre-build command">"%AUTO%"</string> <string name="Post-build command">"%AUTO%"</string> <string name="Pre-link command">"%AUTO%"</string> - <string name="CFG">""</string> + <string name="Ignore libraries">"%AUTO%"</string> </document> </document> </document> @@ -19515,6 +19541,435 @@ </document> </document> </document> + <document> + <string name="title">"Test"</string> + <string name="type">"dialog-document"</string> + <string name="filename">""</string> + <string name="icon-name">"dialog"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbDialogProxy"</string> + <long name="base-id">10000</long> + <bool name="use-id-prefix">0</bool> + <string name="id-prefix">""</string> + <bool name="use-id-suffix">0</bool> + <string name="id-suffix">""</string> + <long name="use-xrc">0</long> + <long name="working-mode">0</long> + <string name="proxy-Id name">"ID_TEST"</string> + <long name="proxy-Id value">10015</long> + <string name="proxy-Class">"Test"</string> + <string name="proxy-Base class">"wxPanel"</string> + <string name="proxy-Window kind">"wxPanel"</string> + <string name="proxy-Implementation filename">"test.cpp"</string> + <string name="proxy-Header filename">"test.h"</string> + <string name="proxy-XRC filename">""</string> + <string name="proxy-Title">"Test"</string> + <bool name="proxy-Centre">1</bool> + <string name="proxy-Icon">""</string> + <bool name="proxy-Dialog units">0</bool> + <string name="proxy-Help text">""</string> + <string name="proxy-Tooltip text">""</string> + <string name="proxy-Background colour">""</string> + <string name="proxy-Foreground colour">""</string> + <string name="proxy-Font">""</string> + <bool name="proxy-Hidden">0</bool> + <bool name="proxy-Enabled">1</bool> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-Data source">""</string> + <string name="proxy-Data class name">""</string> + <string name="proxy-Data class implementation filename">""</string> + <string name="proxy-Data class header filename">""</string> + <string name="proxy-Data class manager window">""</string> + <string name="proxy-Texture">""</string> + <string name="proxy-Texture style">"Tiled"</string> + <bool name="proxy-wxDEFAULT_DIALOG_STYLE">0</bool> + <bool name="proxy-wxCAPTION">0</bool> + <bool name="proxy-wxRESIZE_BORDER">0</bool> + <bool name="proxy-wxSYSTEM_MENU">0</bool> + <bool name="proxy-wxSTAY_ON_TOP">0</bool> + <bool name="proxy-wxDIALOG_NO_PARENT">0</bool> + <bool name="proxy-wxCLOSE_BOX">0</bool> + <bool name="proxy-wxMAXIMIZE_BOX">0</bool> + <bool name="proxy-wxMINIMIZE_BOX">0</bool> + <bool name="proxy-wxDIALOG_MODAL">1</bool> + <bool name="proxy-wxNO_BORDER">0</bool> + <bool name="proxy-wxSIMPLE_BORDER">0</bool> + <bool name="proxy-wxDOUBLE_BORDER">0</bool> + <bool name="proxy-wxSUNKEN_BORDER">0</bool> + <bool name="proxy-wxRAISED_BORDER">0</bool> + <bool name="proxy-wxSTATIC_BORDER">0</bool> + <bool name="proxy-wxWANTS_CHARS">0</bool> + <bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxCLIP_CHILDREN">0</bool> + <bool name="proxy-wxTAB_TRAVERSAL">1</bool> + <bool name="proxy-wxWS_EX_VALIDATE_RECURSIVELY">0</bool> + <bool name="proxy-wxWS_EX_BLOCK_EVENTS">0</bool> + <bool name="proxy-wxWS_EX_TRANSIENT">0</bool> + <string name="proxy-Custom styles">""</string> + <bool name="proxy-wxDIALOG_EX_CONTEXTHELP">0</bool> + <bool name="proxy-Fit to content">1</bool> + <long name="proxy-X">-1</long> + <long name="proxy-Y">-1</long> + <long name="proxy-Width">400</long> + <long name="proxy-Height">300</long> + <bool name="proxy-AUI manager">0</bool> + <string name="proxy-Event sources">""</string> + <document> + <string name="title">"wxGridSizerProxy"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"sizer"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbGridSizerProxy"</string> + <long name="proxy-Columns">1</long> + <long name="proxy-Rows">2</long> + <long name="proxy-ColumnSpacing">0</long> + <long name="proxy-RowSpacing">0</long> + <string name="proxy-Member variable name">""</string> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <document> + <string name="title">"wxGridSizerProxy"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"sizer"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbGridSizerProxy"</string> + <long name="proxy-Columns">2</long> + <long name="proxy-Rows">1</long> + <long name="proxy-ColumnSpacing">0</long> + <long name="proxy-RowSpacing">0</long> + <string name="proxy-Member variable name">""</string> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <document> + <string name="title">"wxStaticText: wxID_STATIC"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"statictext"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbStaticTextProxy"</string> + <string name="proxy-Id name">"wxID_STATIC"</string> + <long name="proxy-Id value">5105</long> + <string name="proxy-Name">""</string> + <string name="proxy-Class">"wxStaticText"</string> + <string name="proxy-Base class">"wxStaticText"</string> + <bool name="proxy-External implementation">1</bool> + <bool name="proxy-Separate files">0</bool> + <string name="proxy-Implementation filename">""</string> + <string name="proxy-Header filename">""</string> + <string name="proxy-Member variable name">""</string> + <string name="proxy-Label">"test spinner"</string> + <long name="proxy-Wrapping width">-1</long> + <string name="proxy-Help text">""</string> + <string name="proxy-Tooltip text">""</string> + <string name="proxy-Background colour">""</string> + <string name="proxy-Foreground colour">""</string> + <string name="proxy-Font">""</string> + <bool name="proxy-Hidden">0</bool> + <bool name="proxy-Enabled">1</bool> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-Data variable">""</string> + <string name="proxy-Data validator">""</string> + <string name="proxy-Data source">""</string> + <string name="proxy-Data class name">""</string> + <string name="proxy-Data class implementation filename">""</string> + <string name="proxy-Data class header filename">""</string> + <string name="proxy-Data class manager window">""</string> + <bool name="proxy-wxALIGN_LEFT">0</bool> + <bool name="proxy-wxALIGN_RIGHT">0</bool> + <bool name="proxy-wxALIGN_CENTRE">0</bool> + <bool name="proxy-wxST_NO_AUTORESIZE">0</bool> + <bool name="proxy-wxNO_BORDER">0</bool> + <bool name="proxy-wxSIMPLE_BORDER">0</bool> + <bool name="proxy-wxDOUBLE_BORDER">0</bool> + <bool name="proxy-wxSUNKEN_BORDER">0</bool> + <bool name="proxy-wxRAISED_BORDER">0</bool> + <bool name="proxy-wxSTATIC_BORDER">0</bool> + <bool name="proxy-wxWANTS_CHARS">0</bool> + <bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool> + <string name="proxy-Custom styles">""</string> + <long name="proxy-X">-1</long> + <long name="proxy-Y">-1</long> + <long name="proxy-Width">-1</long> + <long name="proxy-Height">-1</long> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <string name="proxy-Custom arguments">""</string> + <string name="proxy-Custom ctor arguments">""</string> + </document> + <document> + <string name="title">"wxSpinCtrl: ID_SPINCTRL"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"spinctrl"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbSpinCtrlProxy"</string> + <string name="proxy-Id name">"ID_SPINCTRL"</string> + <long name="proxy-Id value">10016</long> + <string name="proxy-Name">""</string> + <string name="proxy-Class">"wxSpinCtrl"</string> + <string name="proxy-Base class">"wxSpinCtrl"</string> + <bool name="proxy-External implementation">1</bool> + <bool name="proxy-Separate files">0</bool> + <string name="proxy-Implementation filename">""</string> + <string name="proxy-Header filename">""</string> + <string name="proxy-Member variable name">"mSpinner"</string> + <long name="proxy-Minimum value">0</long> + <long name="proxy-Maximum value">100</long> + <long name="proxy-Initial value">5</long> + <string name="proxy-Help text">""</string> + <string name="proxy-Tooltip text">""</string> + <string name="proxy-Background colour">""</string> + <string name="proxy-Foreground colour">""</string> + <string name="proxy-Font">""</string> + <bool name="proxy-Hidden">0</bool> + <bool name="proxy-Enabled">1</bool> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-Data variable">""</string> + <string name="proxy-Data validator">""</string> + <string name="proxy-Data source">""</string> + <string name="proxy-Data class name">""</string> + <string name="proxy-Data class implementation filename">""</string> + <string name="proxy-Data class header filename">""</string> + <string name="proxy-Data class manager window">""</string> + <bool name="proxy-wxSP_ARROW_KEYS">1</bool> + <bool name="proxy-wxSP_WRAP">0</bool> + <bool name="proxy-wxNO_BORDER">0</bool> + <bool name="proxy-wxSIMPLE_BORDER">0</bool> + <bool name="proxy-wxDOUBLE_BORDER">0</bool> + <bool name="proxy-wxSUNKEN_BORDER">0</bool> + <bool name="proxy-wxRAISED_BORDER">0</bool> + <bool name="proxy-wxSTATIC_BORDER">0</bool> + <bool name="proxy-wxWANTS_CHARS">0</bool> + <bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool> + <string name="proxy-Custom styles">""</string> + <long name="proxy-X">-1</long> + <long name="proxy-Y">-1</long> + <long name="proxy-Width">-1</long> + <long name="proxy-Height">-1</long> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <string name="proxy-Custom arguments">""</string> + <string name="proxy-Custom ctor arguments">""</string> + </document> + </document> + <document> + <string name="title">"wxGridSizerProxy"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"sizer"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbGridSizerProxy"</string> + <long name="proxy-Columns">2</long> + <long name="proxy-Rows">1</long> + <long name="proxy-ColumnSpacing">0</long> + <long name="proxy-RowSpacing">0</long> + <string name="proxy-Member variable name">""</string> + <string name="proxy-Platform">"<Any platform>"</string> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <document> + <string name="title">"wxButton: START_BUTTON"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"dialogcontrol"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbButtonProxy"</string> + <string name="proxy-Id name">"START_BUTTON"</string> + <long name="proxy-Id value">10017</long> + <string name="proxy-Name">""</string> + <string name="proxy-Class">"wxButton"</string> + <string name="proxy-Base class">"wxButton"</string> + <bool name="proxy-External implementation">1</bool> + <bool name="proxy-Separate files">0</bool> + <string name="proxy-Implementation filename">""</string> + <string name="proxy-Header filename">""</string> + <string name="proxy-Member variable name">"mStart"</string> + <string name="proxy-Label">"Start"</string> + <bool name="proxy-Default">1</bool> + <string name="proxy-Help text">""</string> + <string name="proxy-Tooltip text">""</string> + <string name="proxy-Data variable">""</string> + <string name="proxy-Data validator">""</string> + <string name="proxy-Data source">""</string> + <string name="proxy-Data class name">""</string> + <string name="proxy-Data class implementation filename">""</string> + <string name="proxy-Data class header filename">""</string> + <string name="proxy-Data class manager window">""</string> + <string name="proxy-Background colour">""</string> + <string name="proxy-Foreground colour">""</string> + <string name="proxy-Font">""</string> + <bool name="proxy-Hidden">0</bool> + <bool name="proxy-Enabled">1</bool> + <string name="proxy-Platform">"<Any platform>"</string> + <bool name="proxy-wxBU_LEFT">0</bool> + <bool name="proxy-wxBU_RIGHT">0</bool> + <bool name="proxy-wxBU_TOP">0</bool> + <bool name="proxy-wxBU_BOTTOM">0</bool> + <bool name="proxy-wxBU_EXACTFIT">0</bool> + <bool name="proxy-wxNO_BORDER">0</bool> + <bool name="proxy-wxWANTS_CHARS">0</bool> + <bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool> + <string name="proxy-Custom styles">""</string> + <long name="proxy-X">-1</long> + <long name="proxy-Y">-1</long> + <long name="proxy-Width">-1</long> + <long name="proxy-Height">-1</long> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <string name="proxy-Custom arguments">""</string> + <string name="proxy-Custom ctor arguments">""</string> + </document> + <document> + <string name="title">"wxButton: CLOSE_BUTTON"</string> + <string name="type">"dialog-control-document"</string> + <string name="filename">""</string> + <string name="icon-name">"dialogcontrol"</string> + <long name="is-transient">0</long> + <long name="owns-file">1</long> + <long name="title-mode">0</long> + <long name="locked">0</long> + <string name="proxy-type">"wbButtonProxy"</string> + <string name="proxy-Id name">"CLOSE_BUTTON"</string> + <long name="proxy-Id value">10018</long> + <string name="proxy-Name">""</string> + <string name="proxy-Class">"wxButton"</string> + <string name="proxy-Base class">"wxButton"</string> + <bool name="proxy-External implementation">1</bool> + <bool name="proxy-Separate files">0</bool> + <string name="proxy-Implementation filename">""</string> + <string name="proxy-Header filename">""</string> + <string name="proxy-Member variable name">"mStop"</string> + <string name="proxy-Label">"Stop"</string> + <bool name="proxy-Default">0</bool> + <string name="proxy-Help text">""</string> + <string name="proxy-Tooltip text">""</string> + <string name="proxy-Data variable">""</string> + <string name="proxy-Data validator">""</string> + <string name="proxy-Data source">""</string> + <string name="proxy-Data class name">""</string> + <string name="proxy-Data class implementation filename">""</string> + <string name="proxy-Data class header filename">""</string> + <string name="proxy-Data class manager window">""</string> + <string name="proxy-Background colour">""</string> + <string name="proxy-Foreground colour">""</string> + <string name="proxy-Font">""</string> + <bool name="proxy-Hidden">0</bool> + <bool name="proxy-Enabled">1</bool> + <string name="proxy-Platform">"<Any platform>"</string> + <bool name="proxy-wxBU_LEFT">0</bool> + <bool name="proxy-wxBU_RIGHT">0</bool> + <bool name="proxy-wxBU_TOP">0</bool> + <bool name="proxy-wxBU_BOTTOM">0</bool> + <bool name="proxy-wxBU_EXACTFIT">0</bool> + <bool name="proxy-wxNO_BORDER">0</bool> + <bool name="proxy-wxWANTS_CHARS">0</bool> + <bool name="proxy-wxNO_FULL_REPAINT_ON_RESIZE">0</bool> + <bool name="proxy-wxFULL_REPAINT_ON_RESIZE">0</bool> + <string name="proxy-Custom styles">""</string> + <long name="proxy-X">-1</long> + <long name="proxy-Y">-1</long> + <long name="proxy-Width">-1</long> + <long name="proxy-Height">-1</long> + <string name="proxy-AlignH">"Centre"</string> + <string name="proxy-AlignV">"Centre"</string> + <long name="proxy-Stretch factor">0</long> + <long name="proxy-Border">5</long> + <bool name="proxy-wxLEFT">1</bool> + <bool name="proxy-wxRIGHT">1</bool> + <bool name="proxy-wxTOP">1</bool> + <bool name="proxy-wxBOTTOM">1</bool> + <bool name="proxy-wxSHAPED">0</bool> + <bool name="proxy-wxADJUST_MINSIZE">0</bool> + <bool name="proxy-wxFIXED_MINSIZE">0</bool> + <string name="proxy-Custom arguments">""</string> + <string name="proxy-Custom ctor arguments">""</string> + </document> + </document> + </document> + </document> </document> <document> <string name="title">"Sources"</string> Index: src/StandAlone/Apps/Seg3D/GuiCode/test.h =================================================================== --- src/StandAlone/Apps/Seg3D/GuiCode/test.h (revision 0) +++ src/StandAlone/Apps/Seg3D/GuiCode/test.h (revision 0) @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.h +// Purpose: +// Author: +// Modified by: +// Created: Tue 04 Aug 2009 14:33:06 BST +// RCS-ID: +// Copyright: +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), Tue 04 Aug 2009 14:33:06 BST + +#ifndef _TEST_H_ +#define _TEST_H_ + + +/*! + * Includes + */ + +////@begin includes +#include "wx/xrc/xmlres.h" +#include "wx/spinctrl.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxSpinCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_TEST 10015 +#define SYMBOL_TEST_STYLE wxTAB_TRAVERSAL +#define SYMBOL_TEST_TITLE _("Test") +#define SYMBOL_TEST_IDNAME ID_TEST +#define SYMBOL_TEST_SIZE wxSize(400, 300) +#define SYMBOL_TEST_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * Test class declaration + */ + +class Test: public wxPanel +{ + DECLARE_DYNAMIC_CLASS( Test ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + Test(); + Test( wxWindow* parent, wxWindowID id = SYMBOL_TEST_IDNAME, const wxPoint& pos = SYMBOL_TEST_POSITION, const wxSize& size = SYMBOL_TEST_SIZE, long style = SYMBOL_TEST_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_TEST_IDNAME, const wxPoint& pos = SYMBOL_TEST_POSITION, const wxSize& size = SYMBOL_TEST_SIZE, long style = SYMBOL_TEST_STYLE ); + + /// Destructor + ~Test(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + void OnStartButtonClick( wxCommandEvent& event ); + + void OnCloseButtonClick( wxCommandEvent& event ); + +////@begin Test event handler declarations + +////@end Test event handler declarations + +////@begin Test member function declarations + + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end Test member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin Test member variables + wxSpinCtrl* mSpinner; + wxButton* mStart; + wxButton* mStop; +////@end Test member variables + + + +}; + +#endif + // _TEST_H_ Index: src/StandAlone/Apps/Seg3D/GuiCode/test.cpp =================================================================== --- src/StandAlone/Apps/Seg3D/GuiCode/test.cpp (revision 0) +++ src/StandAlone/Apps/Seg3D/GuiCode/test.cpp (revision 0) @@ -0,0 +1,207 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: test.cpp +// Purpose: +// Author: +// Modified by: +// Created: Tue 04 Aug 2009 14:33:06 BST +// RCS-ID: +// Copyright: +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), Tue 04 Aug 2009 14:33:06 BST + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif + +////@begin includes +////@end includes + +#include "test.h" + + +#include <StandAlone/Apps/Seg3D/Painter.h> + +#include "seg3devents.h" + +#include <StandAlone/Apps/Seg3D/Seg3DwxGuiUtils.h> + +////@begin XPM images +////@end XPM images + + +/*! + * Test type definition + */ + +IMPLEMENT_DYNAMIC_CLASS( Test, wxPanel ) + + +/*! + * Test event table definition + */ + +BEGIN_EVENT_TABLE( Test, wxPanel ) + +////@begin Test event table entries + +EVT_BUTTON( XRCID("START_BUTTON"), Test::OnStartButtonClick ) +EVT_BUTTON( XRCID("CLOSE_BUTTON"), Test::OnCloseButtonClick ) + +////@end Test event table entries + +END_EVENT_TABLE() + + +/*! + * Test constructors + */ + +Test::Test() +{ + Init(); +} + +Test::Test( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) +{ + Init(); + Create(parent, id, pos, size, style); +} + + +/*! + * Test creator + */ + +bool Test::Create( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) +{ +////@begin Test creation + std::cout << "Constructor: before setparent" << std::endl; // DEBUG + SetParent(parent); + std::cout << "Constructor: before createcontrols" << std::endl; // DEBUG + CreateControls(); + std::cout << "Constructor: before getsize" << std::endl; // DEBUG + if (GetSizer()) + { + std::cout << "Constructor: before getsizer" << std::endl; // DEBUG + GetSizer()->SetSizeHints(this); + } + std::cout << "Constructor: before centre" << std::endl; // DEBUG + Centre(); + std::cout << "Constructor: end" << std::endl; // DEBUG +////@end Test creation + return true; +} + + +/*! + * Test destructor + */ + +Test::~Test() +{ +////@begin Test destruction +////@end Test destruction +} + + +/*! + * Member initialisation + */ + +void Test::Init() +{ +////@begin Test member initialisation + mSpinner = NULL; + mStart = NULL; + mStop = NULL; +////@end Test member initialisation +} + + +/*! + * Control creation for Test + */ + +void Test::CreateControls() +{ +////@begin Test content construction + // Generated by DialogBlocks, Tue 04 Aug 2009 15:16:13 BST (unregistered) + + std::cout << "Before creating controls" << std::endl; // DEBUG + if (!wxXmlResource::Get()->LoadPanel(this, GetParent(), _T("ID_TEST"))) + wxLogError(wxT("Missing wxXmlResource::Get()->Load() in OnInit()?")); + std::cout << "Before creating control mSpinner" << std::endl; // DEBUG + mSpinner = XRCCTRL(*this, "ID_SPINCTRL", wxSpinCtrl); + std::cout << "Before creating control mStart" << std::endl; // DEBUG + mStart = XRCCTRL(*this, "START_BUTTON", wxButton); + std::cout << "Before creating control mStopr" << std::endl; // DEBUG + mStop = XRCCTRL(*this, "CLOSE_BUTTON", wxButton); + std::cout << "After creating controls" << std::endl; // DEBUG +////@end Test content construction + + // Create custom windows not generated automatically here. +////@begin Test content initialisation +////@end Test content initialisation +} + + +/*! + * Should we show tooltips? + */ + +bool Test::ShowToolTips() +{ + return true; +} + +/*! + * Get bitmap resources + */ + +wxBitmap Test::GetBitmapResource( const wxString& name ) +{ + // Bitmap retrieval +////@begin Test bitmap retrieval + wxUnusedVar(name); + return wxNullBitmap; +////@end Test bitmap retrieval +} + +/*! + * Get icon resources + */ + +wxIcon Test::GetIconResource( const wxString& name ) +{ + // Icon retrieval +////@begin Test icon retrieval + wxUnusedVar(name); + return wxNullIcon; +////@end Test icon retrieval + +} + + +void Test::OnStartButtonClick( wxCommandEvent& event ) { + + SCIRun::ThrowSkinnerSignalEvent *tsse = new SCIRun::ThrowSkinnerSignalEvent("Painter::FinishTool"); + tsse->add_var("Test::mSpinner",SCIRun::to_string(mSpinner->GetValue())); + +} + +void Test::OnCloseButtonClick( wxCommandEvent& event ) { + + SCIRun::Painter::global_seg3dframe_pointer_->HideTool(); + +} + + Index: src/StandAlone/Apps/Seg3D/GuiCode/test.xrc =================================================================== Index: src/StandAlone/Apps/Seg3D/Painter.h =================================================================== --- src/StandAlone/Apps/Seg3D/Painter.h (revision 44410) +++ src/StandAlone/Apps/Seg3D/Painter.h (working copy) @@ -229,6 +229,7 @@ CatcherFunction_t StartThresholdTool; CatcherFunction_t StartWindowLevelTool; CatcherFunction_t StartMeasurementTool; + CatcherFunction_t StartTestTool; CatcherFunction_t VolumeInformation; Index: src/StandAlone/Apps/Seg3D/Seg3DFrame.h =================================================================== --- src/StandAlone/Apps/Seg3D/Seg3DFrame.h (revision 44410) +++ src/StandAlone/Apps/Seg3D/Seg3DFrame.h (working copy) @@ -80,6 +80,7 @@ class ITKSpeedToPathRegularStepGradientDescentFilter; class ITKSpeedToPathIterateNeighborhoodFilter; class SpeedFunction; +class Test; #define PANEL_WIDTH 200 #define INFO_HEIGHT 250 @@ -126,6 +127,7 @@ MENU_TOOL_WINDOWLEVEL, MENU_TOOL_MOVESCALE, MENU_TOOL_MEASUREMENT, + MENU_TOOL_TEST, MENU_FILTER_C_A_D_F = 500, MENU_FILTER_C_C_F, @@ -258,6 +260,7 @@ void ToolWindowLevel( wxCommandEvent& WXUNUSED(event) ); void ToolMoveScale( wxCommandEvent& WXUNUSED(event) ); void ToolMeasurement( wxCommandEvent& WXUNUSED(event) ); + void ToolTest( wxCommandEvent& WXUNUSED(event) ); void Filter_CADF( wxCommandEvent& WXUNUSED(event) ); void Filter_CCF( wxCommandEvent& WXUNUSED(event) ); @@ -310,7 +313,7 @@ HistoEqFilter *histoEqTool_; ResampleTool* resampleTool_; MedianFilterTool* medianFilterTool_; - // New wx itk test + // New wx itk Test ITKCurvatureAnistopricDiffusionFilter* itk_CADF_; ITKConfidenceConnectedFilter* itk_CCF_; ITKNeighbourhoodConnectedFilter* itk_NCF_; @@ -327,6 +330,7 @@ MoveScaleToolPanel *movescaletoolpanel_; MeasurementTool *measurementtoolpanel_; IntensityCorrectionFilterPanel *intensitycorrectionfilterpanel_; + Test *testtoolpanel_; ITKSpeedToPathGradientDescentFilter* itk_STPGDF_; ITKSpeedToPathRegularStepGradientDescentFilter* itk_STPRSGDF_;
Archive powered by MHonArc 2.6.16.