00001 /*! @file Qt/BiasSettingsDialog.ui.h Dialog for biasing images */ 00002 00003 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Qt/BiasSettingsDialog.ui.h $ 00004 // $Id: BiasSettingsDialog.ui.h 10827 2009-02-11 09:40:02Z itti $ 00005 00006 00007 /**************************************************************************** 00008 ** ui.h extension file, included from the uic-generated form implementation. 00009 ** 00010 ** If you want to add, delete, or rename functions or slots, use 00011 ** Qt Designer to update this file, preserving your code. 00012 ** 00013 ** You should not define a constructor or destructor in this file. 00014 ** Instead, write your code in functions called init() and destroy(). 00015 ** These will automatically be called by the form's constructor and 00016 ** destructor. 00017 *****************************************************************************/ 00018 00019 00020 void BiasSettingsDialog::init( ModelManager & manager ) 00021 { 00022 static bool isInit = false; 00023 00024 if (!isInit){ 00025 00026 //remove the first dummy page 00027 QWidget *page = tabDisp->page(0); //get the firs page of the tab 00028 tabDisp->removePage(page); 00029 00030 LFATAL("fixme"); 00031 /* 00032 itsMgr = &manager; 00033 // showFeatures(); 00034 nub::ref<StdBrain> brain = dynCastWeak<StdBrain>(itsMgr->subComponent("Brain")); 00035 00036 for (unsigned int i=0; i<brain->getVC()->numChans(); i++){ 00037 nub::ref<ChannelBase> cb = brain->getVC()->subChan(i); 00038 00039 ComplexChannel* const cc = dynamic_cast<ComplexChannel*>(cb.get()); 00040 00041 if (cc != 0){ //do we have a complex channel or a simple one 00042 const int numc = cc->numChans(); 00043 LINFO("Channel %s nc:%i", cb->descriptiveName().c_str(), numc); 00044 for (int j=0; j<numc; j++){ 00045 nub::ref<ChannelBase> cb = cc->subChan(j); 00046 SingleChannel& sc = dynamic_cast<SingleChannel&>(*cb); 00047 setupTab(*cc, sc); 00048 } 00049 } else { 00050 LINFO("Channel %s nc:%i", cb->descriptiveName().c_str(), 0); 00051 SingleChannel& sc = dynamic_cast<SingleChannel&>(*cb); 00052 setupTab(*(brain->getVC()), sc); 00053 } 00054 } 00055 isInit = true; 00056 */ 00057 } 00058 } 00059 00060 00061 void BiasSettingsDialog::biasFeature(int value) 00062 { 00063 00064 } 00065 00066 void BiasSettingsDialog::showFeatures( ) 00067 { 00068 00069 } 00070 00071 00072 void BiasSettingsDialog::setupTab( ComplexChannel& cc, SingleChannel &sc ) 00073 { 00074 int nsubmap = sc.numSubmaps(); 00075 QWidget* tab = new QWidget(tabDisp); 00076 QGridLayout* tabLayout = new QGridLayout( tab, 1, 1, 3, 3, "tabLayout"); 00077 00078 00079 /*ImageCanvas* combinedDisp = new ImageCanvas(tab); 00080 Image<float> img = sc.getOutput(); 00081 inplaceNormalize(img, 0.0F, 255.0F); 00082 Image<PixRGB<byte> > colImg = toRGB(img); 00083 combinedDisp->setImage(colImg);*/ 00084 00085 BiasValImage *combinedDisp = new BiasValImage(cc, sc, -1, tab); 00086 00087 for(int i=0; i<nsubmap; i++){ 00088 int xpos = (i/2); 00089 int ypos = i%2; 00090 unsigned int clev = 0, slev = 0; 00091 sc.getLevelSpec().indexToCS(i, clev, slev); 00092 00093 BiasValImage *biasValImage = new BiasValImage(cc, sc, i, tab); 00094 itsBiasValImage.push_back(biasValImage); 00095 //signal the combined display on updates 00096 connect(biasValImage, SIGNAL(updateOutput()), 00097 combinedDisp, SLOT(updateValues())); 00098 00099 //update the display when the update button is pressed 00100 connect(updateValButton, SIGNAL(clicked()), 00101 biasValImage, SLOT(updateValues())); 00102 00103 tabLayout->addWidget( biasValImage, xpos, ypos ); 00104 00105 } 00106 00107 tabLayout->addMultiCellWidget( combinedDisp, 1, 1, 2, 2 ); 00108 tabDisp->insertTab( tab, sc.descriptiveName()); 00109 00110 } 00111 00112 00113 void BiasSettingsDialog::update() 00114 { 00115 for(uint i=0; i<itsBiasValImage.size(); i++) 00116 { 00117 itsBiasValImage[i]->setShowRaw(chkBoxShowRaw->isChecked()); 00118 itsBiasValImage[i]->setResizeToSLevel(chkBoxResizeToSLevel->isChecked()); 00119 } 00120 00121 }