NIREP
|
00001 // For compilers that support precompilation, includes "wx/wx.h". 00002 #include "wx/wxprec.h" 00003 00004 #ifdef __BORLANDC__ 00005 #pragma hdrstop 00006 #endif 00007 00008 #ifndef WX_PRECOMP 00009 #include "wx/wx.h" 00010 #endif 00011 00012 00013 #include "PanelForm.h" 00014 #include "Panel.h" 00015 #include "vtkLookupTableManager.h" 00016 #include "NIREPDisplay.h" 00017 00018 00019 00024 IMPLEMENT_DYNAMIC_CLASS( PanelForm, wxDialog ) 00025 00026 00027 00031 BEGIN_EVENT_TABLE( PanelForm, wxDialog ) 00032 00033 EVT_BUTTON( ID_OK, PanelForm::OnOkClick ) 00034 00035 EVT_BUTTON( ID_CANCEL, PanelForm::OnCancelClick ) 00036 00037 EVT_BUTTON( ID_HELP, PanelForm::OnHelpClick ) 00038 00039 EVT_BUTTON( ID_DELETE, PanelForm::OnDeleteClick ) 00040 00041 EVT_CHOICE( ID_CHOICE, PanelForm::EnableOrDisableChoiceTwo ) 00042 00043 EVT_CHOICE( ID_CHOICE2, PanelForm::OnChoiceSelected ) 00044 00045 EVT_CHOICE( ID_CHOICE3, PanelForm::OnChoiceTwoSelected ) 00046 00047 END_EVENT_TABLE() 00048 00049 00054 PanelForm::PanelForm() 00055 { 00056 Init(); 00057 } 00058 00059 PanelForm::PanelForm( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00060 { 00061 Init(); 00062 00063 //Set panel equal to the parent which should be a panel. 00064 panel = (Panel*)parent; 00065 Create(parent, id, caption, pos, size, style); 00066 } 00067 00068 00073 bool PanelForm::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) 00074 { 00075 00076 SetExtraStyle(wxWS_EX_BLOCK_EVENTS); 00077 wxDialog::Create( parent, id, caption, pos, size, style ); 00078 00079 CreateControls(); 00080 if (GetSizer()) 00081 { 00082 GetSizer()->SetSizeHints(this); 00083 } 00084 Centre(); 00085 return true; 00086 } 00087 00088 00093 PanelForm::~PanelForm() 00094 { 00095 } 00096 00097 00102 void PanelForm::Init() 00103 { 00105 //viewList.Add("2DImage"); 00106 //viewList.Add("Checkerboard"); 00107 //viewList.Add("Wipe"); 00108 //viewList.Add("Difference"); 00109 //viewList.Add("ObjectMap"); 00110 //viewList.Add("overlayObjectMap"); 00111 //viewList.Add("overlayImage"); 00112 //viewList.Add("relativeOverlap"); 00113 //viewList.Add("RelativeOverlapText"); 00114 //viewList.Add("intensittyVarianceTextWidget"); 00115 //viewList.Add("inverseConsistencyTextWidget"); 00116 //viewList.Add("transitivityErrorTextWidget"); 00117 00118 // Create a vector of widget commands for wxChoice control. 00119 // This control will allow the user to select the desired widget they want to use. 00120 WidgetCmdList::iterator iter; 00121 for(iter = WidgetCmd.begin(); iter != WidgetCmd.end(); iter++){ 00122 viewList.Add(wxString(iter->second.c_str(), wxConvUTF8)); 00123 } 00124 } 00125 00126 00132 //This is the main function of this class. This will create 00133 //the form for the user to change different items of the panel. 00134 //Such as the view, the images used, color map, the label text, 00135 //the label font the label size. 00136 void PanelForm::CreateControls() 00137 { 00138 PanelForm* itemDialog1 = this; 00139 00140 wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0); 00141 itemFlexGridSizer2->AddGrowableRow(0); 00142 itemFlexGridSizer2->AddGrowableRow(1); 00143 itemFlexGridSizer2->AddGrowableCol(0); 00144 itemDialog1->SetSizer(itemFlexGridSizer2); 00145 00146 wxFlexGridSizer* itemFlexGridSizer3 = new wxFlexGridSizer(2, 0, 0); 00147 itemFlexGridSizer3->AddGrowableCol(0); 00148 itemFlexGridSizer3->AddGrowableCol(1); 00149 itemFlexGridSizer2->Add(itemFlexGridSizer3, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00150 00151 wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Widget"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); 00152 itemFlexGridSizer3->Add(itemStaticText4, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00153 00154 wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Orientation"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE ); 00155 itemFlexGridSizer3->Add(itemStaticText5, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00156 00157 00158 00159 view = new wxChoice( itemDialog1, ID_CHOICE, wxDefaultPosition, wxSize(135, -1), viewList, 0 ); 00160 00161 // Get index of the current widget type. 00162 int widget_index = 0; 00163 for(int i=0; i<viewList.size(); i++){ 00164 if (panel->GetWidgetType().compare(std::string(viewList[i].mb_str())) == 0){ 00165 widget_index = i; 00166 } 00167 } 00168 00169 //view->SetSelection(panel->GetWidgetType()); 00170 view->SetSelection(widget_index); 00171 itemFlexGridSizer3->Add(view, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00172 00173 wxArrayString itemChoice7Strings; 00174 itemChoice7Strings.Add(wxT("Transverse")); 00175 itemChoice7Strings.Add(wxT("Sagittal")); 00176 itemChoice7Strings.Add(wxT("Coronal")); 00177 OrientationChoice = new wxChoice( itemDialog1, ID_ORIENTATION, wxDefaultPosition, wxSize(135, -1), itemChoice7Strings, 0 ); 00178 itemFlexGridSizer3->Add(OrientationChoice, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00179 00180 if(this->panel->GetWidget() != NULL) 00181 OrientationChoice->SetSelection(this->panel->GetWidget()->GetOrientation()); 00182 wxStaticText* itemStaticText8 = new wxStaticText( itemDialog1, wxID_STATIC, _("Image One"), wxDefaultPosition, wxDefaultSize, 0 ); 00183 itemFlexGridSizer3->Add(itemStaticText8, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00184 00185 wxStaticText* itemStaticText9 = new wxStaticText( itemDialog1, wxID_STATIC, _("Image Two"), wxDefaultPosition, wxDefaultSize, 0 ); 00186 itemFlexGridSizer3->Add(itemStaticText9, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00187 00188 wxArrayString itemChoice10Strings; 00189 00190 //This is for the first image. 00191 //Get the keys and values of the evaluator list. This way we can display to the user the different 00192 //images that can be displayed and used. 00193 panel->GetPanelParent()->GetDisplayDescription()->GetEvaluatorList()->GetTasks(&keys, &values, 1); 00194 int choiceOne = -1; 00195 for(int i=0;i<keys.size();i++) 00196 { 00197 itemChoice10Strings.Add(wxString(values[i].c_str(), wxConvUTF8)); 00198 00199 if(panel->GetIds().size() > 0) { 00200 //Figure out which image is being displayed and highlight the choice. 00201 if(keys[i].compare(panel->GetIds()[0])==0) 00202 { 00203 choiceOne = i; 00204 } 00205 } 00206 } 00207 ImageOneChoice = new wxChoice( itemDialog1, ID_CHOICE2, wxDefaultPosition, wxSize(135, -1), itemChoice10Strings, 0 ); 00208 itemFlexGridSizer3->Add(ImageOneChoice, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00209 if(choiceOne != -1) 00210 ImageOneChoice->SetSelection(choiceOne); 00211 00212 wxArrayString itemChoice11Strings; 00213 00214 //This is for the second image. 00215 //Get the keys and values of the evaluator list. This way we can display to the user the different 00216 //images that can be displayed and used. 00217 for(int i=0;i<keys.size();i++) 00218 { 00219 itemChoice11Strings.Add(wxString(values[i].c_str(), wxConvUTF8)); 00220 00221 //See if the panel has more then one image 00222 if(panel->GetIds().size() >1) 00223 { 00224 //Figure out which image is being displayed and highlight the choice. 00225 if(keys[i].compare(panel->GetIds()[1])==0) 00226 { 00227 choiceOne = i; 00228 } 00229 } 00230 } 00231 ImageTwoChoice = new wxChoice( itemDialog1, ID_CHOICE3, wxDefaultPosition, wxSize(135, -1), itemChoice11Strings, 0 ); 00232 itemFlexGridSizer3->Add(ImageTwoChoice, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00233 00234 //figure out if the panel has more then one image. If the panel does not have more then 00235 //one image then set ImageTwoChoice to the first selection of the list. Else set the 00236 //selection to what the panel is displaying. 00237 if(choiceOne != -1) 00238 { 00239 if(choiceOne == keys.size()) 00240 ImageTwoChoice->SetSelection(1); 00241 else 00242 ImageTwoChoice->SetSelection(choiceOne); 00243 } 00244 00245 //if the panel is just a a normal 2D view then disable ImageTwoChoice. This will need 00246 //some work because its not just the normal 2D view that will disable ImageTwoChoice. 00247 if(panel->GetWidgetType().compare(WidgetCmd["view"]) == 0) 00248 { 00249 ImageTwoChoice->Disable(); 00250 } 00251 00252 wxStaticText* itemStaticText12 = new wxStaticText( itemDialog1, wxID_STATIC, _("Overlap Image"), wxDefaultPosition, wxDefaultSize, 0 ); 00253 itemFlexGridSizer3->Add(itemStaticText12, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00254 00255 wxStaticText* itemStaticText13 = new wxStaticText( itemDialog1, wxID_STATIC, _("Link Widgets"), wxDefaultPosition, wxDefaultSize, 0 ); 00256 itemFlexGridSizer3->Add(itemStaticText13, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00257 00258 wxArrayString itemChoice14Strings; 00259 wxChoice* itemChoice14 = new wxChoice( itemDialog1, ID_CHOICE4, wxDefaultPosition, wxSize(135, -1), itemChoice14Strings, 0 ); 00260 itemFlexGridSizer3->Add(itemChoice14, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00261 00262 itemChoice14->Disable(); 00263 00264 00265 wxArrayString itemCheckListBox15Strings; 00266 00267 //Get the column dimension and the row dimension 00268 int colDim = panel->GetPanelParent()->GetDisplayDescription()->GetDisplayAttributes()->GetColDimension(); 00269 int rowDim = panel->GetPanelParent()->GetDisplayDescription()->GetDisplayAttributes()->GetRowDimension(); 00270 00271 //Run through two for loops based on the rows and columns. What we will 00272 //be doing is adding the string names of the panels so that we can do linking. 00273 //To do that, we have to start with W, then append the row number, then append 00274 //a comma and then append the column 00275 for(int i=0; i < rowDim; i++) 00276 { 00277 for(int j=0; j<colDim; j++) 00278 { 00279 if( (i*colDim+j) != panel->GetID() ) 00280 { 00281 std::string s = "W"; 00282 std::stringstream row; 00283 row << (i+1); 00284 std::stringstream col; 00285 col << (j+1); 00286 s = s.append(row.str()); 00287 s = s.append(","); 00288 s = s.append(col.str()); 00289 itemCheckListBox15Strings.Add(wxString(s.c_str(), wxConvUTF8)); 00290 } 00291 else 00292 { 00293 PanelName = "W"; 00294 std::stringstream row; 00295 row << (i+1); 00296 std::stringstream col; 00297 col << (j+1); 00298 PanelName = PanelName.append(row.str()); 00299 PanelName = PanelName.append(","); 00300 PanelName = PanelName.append(col.str()); 00301 } 00302 } 00303 } 00304 00305 LinkWidgetsCheckList = new wxCheckListBox( itemDialog1, ID_CHECKLISTBOX, wxDefaultPosition, wxDefaultSize, itemCheckListBox15Strings, wxLB_SINGLE ); 00306 00307 //Run through the rows and columns and the size of the vector of linked widgets for the panel. 00308 //We will be checking those panels that are linked with the panel. We need to take into 00309 //account that the panel is part of the vector. 00310 for(int i=0; i < rowDim; i++) 00311 { 00312 for(int j=0; j<colDim; j++) 00313 { 00314 for( int k=0; k < panel->GetLinkedWidgets().size(); k++) 00315 { 00316 if( (i*colDim+j) == panel->GetLinkedWidgets().at(k)) 00317 { 00318 //This is taking into account that the panel is part of the vector. 00319 00320 if((i*colDim+j) < panel->GetID() ) 00321 { 00322 LinkWidgetsCheckList->Check(i*colDim+j); 00323 } 00324 else if( (i*colDim+j) != panel->GetID() ) 00325 { 00326 //Skip over the panel and minus one from the check image because 00327 //we did the skip. 00328 LinkWidgetsCheckList->Check(i*colDim+j-1); 00329 } 00330 } 00331 } 00332 } 00333 } 00334 itemFlexGridSizer3->Add(LinkWidgetsCheckList, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00335 00336 wxStaticText* itemStaticText16 = new wxStaticText( itemDialog1, wxID_STATIC, _("Color Map"), wxDefaultPosition, wxDefaultSize, 0 ); 00337 itemFlexGridSizer3->Add(itemStaticText16, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00338 00339 wxArrayString itemChoice17Strings; 00340 //set up the choices of the color maps 00341 itemChoice17Strings.Add(wxT("B/W")); 00342 itemChoice17Strings.Add(wxT("B/W Inverse")); 00343 itemChoice17Strings.Add(wxT("Spectrum")); 00344 itemChoice17Strings.Add(wxT("HotMetal")); 00345 itemChoice17Strings.Add(wxT("GEColor")); 00346 itemChoice17Strings.Add(wxT("Flow")); 00347 itemChoice17Strings.Add(wxT("LONI")); 00348 itemChoice17Strings.Add(wxT("LONI2")); 00349 itemChoice17Strings.Add(wxT("Asymmetry")); 00350 itemChoice17Strings.Add(wxT("P-Value")); 00351 itemChoice17Strings.Add(wxT("ROI")); 00352 itemChoice17Strings.Add(wxT("Other")); 00353 colorMapChoices = new wxChoice( itemDialog1, ID_CHOICE5, wxDefaultPosition, wxSize(135, -1), itemChoice17Strings, 0 ); 00354 int selection = panel->GetLookupTableSelection(); 00355 colorMapChoices->SetSelection(panel->GetLookupTableSelection()); 00356 itemFlexGridSizer3->Add(colorMapChoices, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_TOP|wxALL, 5); 00357 00358 wxStaticText* itemStaticText19 = new wxStaticText( itemDialog1, wxID_STATIC, _("Title Text"), wxDefaultPosition, wxDefaultSize, 0 ); 00359 itemFlexGridSizer3->Add(itemStaticText19, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00360 00361 wxStaticText* itemStaticText20 = new wxStaticText( itemDialog1, wxID_STATIC, _("Font, Size, Color"), wxDefaultPosition, wxDefaultSize, 0 ); 00362 itemFlexGridSizer3->Add(itemStaticText20, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00363 00364 wxStaticText *st = panel->GetPanelParent()->GetPanelTitle(panel->GetID()); 00365 00366 if(st != NULL) { 00367 wxString labelString = st->GetLabel(); 00368 PanelTitle = new wxTextCtrl( itemDialog1, ID_TEXTCTRL12, labelString, wxDefaultPosition, wxDefaultSize, 0 ); 00369 itemFlexGridSizer3->Add(PanelTitle, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00370 } 00371 else { 00372 PanelTitle = new wxTextCtrl( itemDialog1, ID_TEXTCTRL12, wxT(""), wxDefaultPosition, wxDefaultSize, 0 ); 00373 itemFlexGridSizer3->Add(PanelTitle, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00374 } 00375 TitleFontPicker = new wxFontPickerCtrl( itemDialog1, ID_FONTCTRL, wxFont(), wxDefaultPosition, wxDefaultSize, wxFNTP_DEFAULT_STYLE|wxFNTP_FONTDESC_AS_LABEL|wxFNTP_USEFONT_FOR_LABEL ); 00376 itemFlexGridSizer3->Add(TitleFontPicker, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00377 if(st != NULL) 00378 TitleFontPicker->SetSelectedFont(st->GetFont()); 00379 wxStaticText* itemStaticText21 = new wxStaticText( itemDialog1, wxID_STATIC, _("Min"), wxDefaultPosition, wxDefaultSize, 0 ); 00380 itemFlexGridSizer3->Add(itemStaticText21, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00381 00382 wxStaticText* itemStaticText22 = new wxStaticText( itemDialog1, wxID_STATIC, _("Max"), wxDefaultPosition, wxDefaultSize, 0 ); 00383 itemFlexGridSizer3->Add(itemStaticText22, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00384 00385 00386 minSize = new wxTextCtrl( itemDialog1, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); 00387 itemFlexGridSizer3->Add(minSize, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00388 00389 maxSize = new wxTextCtrl( itemDialog1, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, 0 ); 00390 itemFlexGridSizer3->Add(maxSize, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00391 00392 00393 //Add another sizer for the four buttons. 00394 wxFlexGridSizer* itemFlexGridSizer18 = new wxFlexGridSizer(1, 4, 0, 0); 00395 itemFlexGridSizer18->AddGrowableRow(0); 00396 itemFlexGridSizer18->AddGrowableCol(0); 00397 itemFlexGridSizer18->AddGrowableCol(1); 00398 itemFlexGridSizer18->AddGrowableCol(2); 00399 itemFlexGridSizer18->AddGrowableCol(3); 00400 itemFlexGridSizer2->Add(itemFlexGridSizer18, 0, wxGROW|wxGROW|wxALL, 5); 00401 00402 wxButton* itemButton19 = new wxButton( itemDialog1, ID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 ); 00403 itemFlexGridSizer18->Add(itemButton19, 0, wxGROW|wxGROW|wxALL, 5); 00404 00405 wxButton* itemButton20 = new wxButton( itemDialog1, ID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); 00406 itemFlexGridSizer18->Add(itemButton20, 0, wxGROW|wxGROW|wxALL, 5); 00407 00408 wxButton* itemButton21 = new wxButton( itemDialog1, ID_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 ); 00409 itemFlexGridSizer18->Add(itemButton21, 0, wxGROW|wxGROW|wxALL, 5); 00410 00411 wxButton* itemButton22 = new wxButton( itemDialog1, ID_DELETE, _("Delete Widget"), wxDefaultPosition, wxDefaultSize, 0 ); 00412 itemFlexGridSizer18->Add(itemButton22, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 5); 00413 00414 //if( view->GetCurrentSelection() == 4 ||view->GetCurrentSelection() == 5 || view->GetCurrentSelection() == 7) 00415 std::string widget_type = std::string(viewList[view->GetCurrentSelection()].mb_str()); 00416 if(widget_type.compare(WidgetCmd["overlayObjectMap"]) == 0 || 00417 widget_type.compare(WidgetCmd["overlayImage" ]) == 0 || 00418 widget_type.compare(WidgetCmd["relativeOverlap" ]) == 0) 00419 { 00420 int count = colorMapChoices->GetCount(); 00421 colorMapChoices->SetSelection(count -1); 00422 colorMapChoices->Enable(false); 00423 //colorMapChoices->setSelection(); 00424 } 00425 else 00426 { 00427 colorMapChoices->Enable(); 00428 } 00429 } 00430 00431 00436 bool PanelForm::ShowToolTips() 00437 { 00438 return true; 00439 } 00440 00445 wxBitmap PanelForm::GetBitmapResource( const wxString& name ) 00446 { 00447 // Bitmap retrieval 00448 wxUnusedVar(name); 00449 return wxNullBitmap; 00450 } 00451 00456 wxIcon PanelForm::GetIconResource( const wxString& name ) 00457 { 00458 // Icon retrieval 00459 wxUnusedVar(name); 00460 return wxNullIcon; 00461 } 00462 00463 00468 //This function takes care of updating the panel when the user 00469 //presses okay. 00470 void PanelForm::OnOkClick( wxCommandEvent& event ) 00471 { 00472 //Get the label of the panel 00473 wxStaticText *st = panel->GetPanelParent()->GetPanelTitle(panel->GetID()); 00474 00475 if(st != NULL) { 00476 //Set the text of the label to what the user put in. 00477 st->SetLabel(PanelTitle->GetValue()); 00478 00479 //Set the font to what the user choose. 00480 st->SetFont(TitleFontPicker->GetSelectedFont()); 00481 } 00482 00483 //Get the image choices 00484 int oneChoice = ImageOneChoice->GetCurrentSelection(); 00485 int twoChoice = ImageTwoChoice->GetCurrentSelection(); 00486 00487 //Clear the ids of the panel 00488 panel->ClearIds(); 00489 00490 //Set the ids of the panel. Might want to check to see if the 00491 //ids match and if they do, do nothing. 00492 panel->SetIds(keys[oneChoice]); 00493 00494 //panel->GetWidget()->Clear(); 00495 00496 //Get the color map choice 00497 int colorMapChoice = colorMapChoices->GetCurrentSelection(); 00498 00499 //Get the min size 00500 wxString min = minSize->GetValue(); 00501 double mins; 00502 00503 //change the min size to a double 00504 min.ToDouble(&mins); 00505 double maxs; 00506 00507 //get the max size 00508 wxString max = maxSize->GetValue(); 00509 00510 //change the max size to a double 00511 max.ToDouble(&maxs); 00512 00513 00514 panel->SetOrientation(OrientationChoice->GetSelection()); 00515 00516 //Get the string representation of the widget that is selected 00517 //std::string temp = view->GetString(view->GetCurrentSelection()).c_str(); 00518 std::string widget_type = std::string(viewList[view->GetCurrentSelection()].mb_str()); 00519 00520 //figure out which view the user wants and have the panel use it. 00521 //if(viewList[8]==temp) 00522 //{ 00523 // panel->SetIds(keys[twoChoice]); 00524 // panel->UseRelativeOverlapTextStatistic(); 00525 // this->Close(); 00526 // event.Skip(); 00527 // return; 00528 //} 00529 //else if(viewList[0]==temp) 00530 if(widget_type.compare(WidgetCmd["view"]) == 0) 00531 { 00532 panel->UseImage(); 00533 00534 //This is where the min and max size comes into play. I need 00535 //to update the other views to accept this. 00536 //panel->GetWidget()->GetLookupTable()->SetRange(mins,maxs); 00537 } 00538 //else if(viewList[1]==temp) 00539 else if(widget_type.compare(WidgetCmd["checkerboard"]) == 0) 00540 { 00541 panel->SetIds(keys[twoChoice]); 00542 panel->UseCheckerboard(); 00543 } 00544 //else if(viewList[2]==temp) 00545 else if(widget_type.compare(WidgetCmd["wipe"]) == 0) 00546 { 00547 panel->SetIds(keys[twoChoice]); 00548 panel->UseWipe(); 00549 } 00550 //else if(viewList[3]==temp) 00551 else if(widget_type.compare(WidgetCmd["objectmap"]) == 0) 00552 { 00553 panel->SetIds(keys[twoChoice]); 00554 panel->UseObjectMap(); 00555 } 00556 //else if(viewList[4]==temp) 00557 else if(widget_type.compare(WidgetCmd["overlayObjectMap"]) == 0) 00558 { 00559 panel->SetIds(keys[twoChoice]); 00560 panel->UseOverlayObjectMap(); 00561 } 00562 //else if(viewList[5]==temp) 00563 else if(widget_type.compare(WidgetCmd["overlayImage"]) == 0) 00564 { 00565 panel->SetIds(keys[twoChoice]); 00566 panel->UseOverlayImage(); 00567 } 00568 //else if(viewList[6]==temp) 00569 else if(widget_type.compare(WidgetCmd["relativeOverlap"]) == 0) 00570 { 00571 panel->SetIds(keys[twoChoice]); 00572 panel->UseRelativeOverlap(); 00573 } 00574 else if(widget_type.compare(WidgetCmd["relativeOverlapTextWidget"]) == 0) { 00575 panel->SetIds(keys[twoChoice]); 00576 panel->UseRelativeOverlapTextStatistic(); 00577 this->Close(); 00578 event.Skip(); 00579 return; 00580 } 00581 // GEC: Added the following widgets based on the relativeOverlapTextStatistic above 00582 // I am not sure if the panel->SetIds(keys[twoChoice]); command is correct 00583 else if(widget_type.compare(WidgetCmd["intensityVarianceTextWidget"]) == 0) { 00584 panel->SetIds(keys[twoChoice]); 00585 panel->UseIntensityVarianceTextStatistic(); 00586 this->Close(); 00587 event.Skip(); 00588 return; 00589 } 00590 else if(widget_type.compare(WidgetCmd["inverseConsistencyTextWidget"]) == 0) { 00591 panel->SetIds(keys[twoChoice]); 00592 panel->UseInverseConsistencyTextStatistic(); 00593 this->Close(); 00594 event.Skip(); 00595 return; 00596 } 00597 else if(widget_type.compare(WidgetCmd["transitivityErrorTextWidget"]) == 0) { 00598 panel->SetIds(keys[twoChoice]); 00599 panel->UseTransitivityErrorTextStatistic(); 00600 this->Close(); 00601 event.Skip(); 00602 return; 00603 } 00604 else if(widget_type.compare(WidgetCmd["varianceTransformText"]) == 0) { 00605 panel->SetIds(keys[twoChoice]); 00606 panel->UseVarianceTransformTextStatistic(); 00607 this->Close(); 00608 event.Skip(); 00609 return; 00610 } 00611 else if(widget_type.compare(WidgetCmd["varianceImageText"]) == 0) { 00612 panel->SetIds(keys[twoChoice]); 00613 panel->UseVarianceImageTextStatistic(); 00614 this->Close(); 00615 event.Skip(); 00616 return; 00617 } 00618 00619 //make sure the color map is not other. If it is, then it 00620 //is most likely a colormap, which I don't want to deal 00621 //with right now. 00622 //if(colorMapChoice != OTHER ) 00623 //{ 00624 // vtkLookupTableManager *tempTwo = vtkLookupTableManager::New(); 00625 // vtkLookupTable *temp = tempTwo->GetLookupTable(colorMapChoice); 00626 // // = vtkLookupTableManager::GetLookupTable(colorMapChoice); 00627 // panel->SetLookUpTable(temp,colorMapChoice); 00628 // temp->Delete(); 00629 // tempTwo->Delete(); 00630 //} 00631 00632 //panel->GetWidget()->SetBackgroundColor(0,0,0); 00633 00634 00635 //Figure out which other panels the user wants to be 00636 //linked to the panel associated with this panel form. 00637 int numSelects = LinkWidgetsCheckList->GetCount(); 00638 std::vector<int> lw; 00639 lw.push_back(panel->GetID()); 00640 std::vector<int> unlw; 00641 00642 //Run through a for loop and convert the strings 00643 //into numbers so that it is easier to do the 00644 //linking. 00645 for(int i=0;i<numSelects;i++) 00646 { 00647 double col; 00648 double row; 00649 std::string line = std::string(LinkWidgetsCheckList->GetString(i).mb_str()); 00650 size_t found = line.find_first_of(","); 00651 00652 std::string id(line, 1,found); 00653 wxString wxID = wxString(id.c_str(), wxConvUTF8); 00654 wxID.Trim(); 00655 wxID.Trim(false); 00656 id = wxID.ToAscii(); 00657 00658 //Get the row that the widget is supposed to be in 00659 size_t foundTwo = line.find_first_of("="); 00660 std::string idTwo(line, found+1,foundTwo); 00661 wxString wxIDTwo = wxString(idTwo.c_str(), wxConvUTF8); 00662 wxIDTwo.Trim(); 00663 wxIDTwo.Trim(false); 00664 idTwo = wxIDTwo.ToAscii(); 00665 00666 wxIDTwo.ToDouble(&col); 00667 wxID.ToDouble(&row); 00668 int tempTwo = ((int)row-1)*panel->GetPanelParent()->GetColumns()+(int)col-1; 00669 00670 //Figure out if the current panel item is supposed to 00671 //be linked or not and place it into the respective 00672 //vector. 00673 if(LinkWidgetsCheckList->IsChecked(i)) 00674 { 00675 00676 lw.push_back(tempTwo); 00677 00678 } 00679 else 00680 { 00681 unlw.push_back(tempTwo); 00682 } 00683 } 00684 00685 //Set the panel with the linked widgets. 00686 panel->SetLinkedWidgets(lw); 00687 00688 //Link the panels up. 00689 panel->GetPanelParent()->LinkViews(lw); 00690 00691 //Unlink any views that have a panel that should 00692 //not be linked to the panel associated with this form. 00693 panel->GetPanelParent()->UnLinkViews(lw, unlw); 00694 00695 00696 00697 //Close this window 00698 this->Close(); 00699 event.Skip(); 00700 } 00701 00702 00707 //Don't do anything but close this window if the user hit close. 00708 void PanelForm::OnCancelClick( wxCommandEvent& event ) 00709 { 00710 this->Close(); 00711 event.Skip(); 00712 } 00713 00714 00719 //Have not figured out what we will do when the user 00720 //hits the help button. Currently it does nothing. 00721 void PanelForm::OnHelpClick( wxCommandEvent& event ) 00722 { 00723 event.Skip(); 00724 } 00725 00726 00731 //Currently the way to delete a panel is not correctly 00732 //done so this is doing nothing. Eventually this will 00733 //allow a user to delete the panel. 00734 void PanelForm::OnDeleteClick( wxCommandEvent& event ) 00735 { 00736 00737 this->Close(); 00738 panel->Delete(); 00739 } 00740 00741 void PanelForm::EnableOrDisableChoiceTwo( wxCommandEvent& event ) 00742 { 00743 //Figure out if ImageTwoChoice should be enabled or disabled on the fly. 00744 if(ImageTwoChoice->IsEnabled() && view->GetCurrentSelection() == 0 || view->GetCurrentSelection() == 4) 00745 { 00746 ImageTwoChoice->Disable(); 00747 } 00748 else if(!ImageTwoChoice->IsEnabled() && view->GetCurrentSelection() != 0) 00749 { 00750 ImageTwoChoice->Enable(); 00751 } 00752 00753 00754 00755 if(view->GetCurrentSelection() == 4 || view->GetCurrentSelection() == 5 || view->GetCurrentSelection() == 7) 00756 { 00757 int count = colorMapChoices->GetCount(); 00758 colorMapChoices->SetSelection(count -1); 00759 colorMapChoices->Enable(false); 00760 //colorMapChoices->setSelection(); 00761 } 00762 else 00763 { 00764 colorMapChoices->Enable(); 00765 } 00766 } 00767 00768 void PanelForm::OnChoiceSelected( wxCommandEvent& event ) 00769 { 00770 ImageOneChoice->SetToolTip(ImageOneChoice->GetString(event.GetSelection())); 00771 } 00772 00773 void PanelForm::OnChoiceTwoSelected( wxCommandEvent& event ) 00774 { 00775 ImageTwoChoice->SetToolTip(ImageTwoChoice->GetString(event.GetSelection())); 00776 } 00777