BiasImageForm.cpp

00001 /****************************************************************************
00002 ** Form implementation generated from reading ui file 'Qt/BiasImageForm.ui'
00003 **
00004 **
00005 ** WARNING! All changes made in this file will be lost!
00006 ****************************************************************************/
00007 
00008 #include "Qt/ui/BiasImageForm.h"
00009 
00010 #include <qvariant.h>
00011 #include <qfiledialog.h>
00012 #include <qlineedit.h>
00013 #include <qimage.h>
00014 #include <qpixmap.h>
00015 #include <qmessagebox.h>
00016 #include <qpushbutton.h>
00017 #include <qtabwidget.h>
00018 #include <qwidget.h>
00019 #include <qlabel.h>
00020 #include <qspinbox.h>
00021 #include <qcombobox.h>
00022 #include <qlayout.h>
00023 #include <qtooltip.h>
00024 #include <qwhatsthis.h>
00025 #include <qaction.h>
00026 #include <qmenubar.h>
00027 #include <qpopupmenu.h>
00028 #include <qtoolbar.h>
00029 #include <qimage.h>
00030 #include <qpixmap.h>
00031 
00032 #include "Raster/Raster.H"
00033 #include "QtUtil/ImageConvert.H"
00034 #include "SIFT/Histogram.H"
00035 #include "Image/FilterOps.H"
00036 #include "Image/ShapeOps.H"
00037 #include "Simulation/SimEventQueue.H"
00038 #include "Qt/ImageCanvas.h"
00039 #include "Qt/BiasImageForm.ui.h"
00040 static const unsigned char image1_data[] = {
00041     0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
00042     0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x16,
00043     0x08, 0x06, 0x00, 0x00, 0x00, 0xc4, 0xb4, 0x6c, 0x3b, 0x00, 0x00, 0x00,
00044     0x99, 0x49, 0x44, 0x41, 0x54, 0x38, 0x8d, 0xed, 0x94, 0x41, 0x0e, 0x85,
00045     0x20, 0x0c, 0x44, 0x5f, 0x89, 0xc7, 0x36, 0x7f, 0x61, 0xbc, 0x77, 0x5d,
00046     0x28, 0x48, 0xa4, 0x28, 0x60, 0xff, 0xce, 0xd9, 0x54, 0x8b, 0xbe, 0x8e,
00047     0x13, 0x04, 0x3e, 0x1d, 0x92, 0x81, 0x77, 0xf4, 0x81, 0xa1, 0x23, 0xdc,
00048     0x2b, 0x34, 0xf6, 0xf4, 0x7a, 0x3d, 0xe2, 0xb8, 0x65, 0xa8, 0x84, 0x3f,
00049     0x40, 0x01, 0x98, 0x2a, 0x0b, 0x3d, 0x5f, 0x62, 0xc5, 0x83, 0x00, 0xaa,
00050     0x1a, 0xd7, 0x05, 0x50, 0x44, 0x9a, 0xb9, 0xd5, 0x07, 0xa7, 0x73, 0xa8,
00051     0xa4, 0xba, 0x4f, 0x92, 0xa2, 0xdf, 0x33, 0x3c, 0x64, 0xc6, 0x3b, 0xeb,
00052     0xbd, 0x82, 0xe5, 0xb8, 0xad, 0xde, 0xcb, 0xcc, 0x78, 0x20, 0xeb, 0x42,
00053     0x66, 0xc6, 0x39, 0x74, 0x5d, 0xfa, 0x80, 0xf3, 0x6f, 0xaf, 0x66, 0xc6,
00054     0x6f, 0xa1, 0x9c, 0x3f, 0x88, 0x2f, 0xb4, 0x70, 0xec, 0x05, 0xcd, 0xc0,
00055     0xbe, 0xd0, 0x78, 0x93, 0xf6, 0x8e, 0x17, 0x14, 0x92, 0x63, 0x5f, 0x68,
00056     0x6c, 0x3e, 0xef, 0xf6, 0xba, 0x3c, 0x8f, 0xdd, 0x36, 0x6d, 0xc4, 0xc0,
00057     0x45, 0x2c, 0x87, 0x81, 0xf8, 0x08, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45,
00058     0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
00059 };
00060 
00061 
00062 /*
00063  *  Constructs a BiasImageForm as a child of 'parent', with the
00064  *  name 'name' and widget flags set to 'f'.
00065  *
00066  */
00067 BiasImageForm::BiasImageForm( QWidget* parent, const char* name, WFlags fl )
00068     : QMainWindow( parent, name, fl )
00069 {
00070     (void)statusBar();
00071     QImage img;
00072     img.loadFromData( image1_data, sizeof( image1_data ), "PNG" );
00073     image1 = img;
00074     if ( !name )
00075         setName( "BiasImageForm" );
00076     setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) );
00077     setCentralWidget( new QWidget( this, "qt_central_widget" ) );
00078     BiasImageFormLayout = new QVBoxLayout( centralWidget(), 11, 6, "BiasImageFormLayout");
00079 
00080     tabDisp = new QTabWidget( centralWidget(), "tabDisp" );
00081 
00082     tab = new QWidget( tabDisp, "tab" );
00083     tabLayout = new QHBoxLayout( tab, 11, 6, "tabLayout");
00084 
00085     imgDisp = new ImageCanvas( tab, "imgDisp" );
00086     tabLayout->addWidget( imgDisp );
00087     tabDisp->insertTab( tab, QString::fromLatin1("") );
00088     BiasImageFormLayout->addWidget( tabDisp );
00089 
00090     layout4 = new QHBoxLayout( 0, 0, 6, "layout4");
00091 
00092     textLabel1_2 = new QLabel( centralWidget(), "textLabel1_2" );
00093     layout4->addWidget( textLabel1_2 );
00094 
00095     itsSceneNumber = new QSpinBox( centralWidget(), "itsSceneNumber" );
00096     layout4->addWidget( itsSceneNumber );
00097 
00098     itsSelectObject = new QComboBox( FALSE, centralWidget(), "itsSelectObject" );
00099     itsSelectObject->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, itsSelectObject->sizePolicy().hasHeightForWidth() ) );
00100     layout4->addWidget( itsSelectObject );
00101 
00102     EvolveBrainButton = new QPushButton( centralWidget(), "EvolveBrainButton" );
00103     layout4->addWidget( EvolveBrainButton );
00104     spacer3_2 = new QSpacerItem( 80, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
00105     layout4->addItem( spacer3_2 );
00106 
00107     runButton = new QPushButton( centralWidget(), "runButton" );
00108     layout4->addWidget( runButton );
00109 
00110     textLabel1 = new QLabel( centralWidget(), "textLabel1" );
00111     layout4->addWidget( textLabel1 );
00112 
00113     timesSpinBox = new QSpinBox( centralWidget(), "timesSpinBox" );
00114     timesSpinBox->setMaxValue( 1000 );
00115     timesSpinBox->setMinValue( 0 );
00116     timesSpinBox->setValue( 1 );
00117     layout4->addWidget( timesSpinBox );
00118     BiasImageFormLayout->addLayout( layout4 );
00119 
00120     layout3 = new QHBoxLayout( 0, 0, 6, "layout3");
00121 
00122     textLabel2 = new QLabel( centralWidget(), "textLabel2" );
00123     textLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, textLabel2->sizePolicy().hasHeightForWidth() ) );
00124     layout3->addWidget( textLabel2 );
00125 
00126     msgLabel = new QLabel( centralWidget(), "msgLabel" );
00127     msgLabel->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, msgLabel->sizePolicy().hasHeightForWidth() ) );
00128     layout3->addWidget( msgLabel );
00129 
00130     itsObjectName = new QLineEdit( centralWidget(), "itsObjectName" );
00131     layout3->addWidget( itsObjectName );
00132     BiasImageFormLayout->addLayout( layout3 );
00133 
00134     // actions
00135     fileOpenAction = new QAction( this, "fileOpenAction" );
00136     fileOpenAction->setIconSet( QIconSet( image1 ) );
00137     fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
00138     fileExitAction = new QAction( this, "fileExitAction" );
00139     editConfigureAction = new QAction( this, "editConfigureAction" );
00140     editConfigureAction->setToggleAction( TRUE );
00141     editConfigureAction->setOn( FALSE );
00142     editBias_SettingsAction = new QAction( this, "editBias_SettingsAction" );
00143     viewActionGroup = new QActionGroup( this, "viewActionGroup" );
00144     viewActionGroup->setOn( FALSE );
00145     viewActionGroup->setExclusive( FALSE );
00146     viewActionGroup->setUsesDropDown( FALSE );
00147     viewTrajAction = new QAction( viewActionGroup, "viewTrajAction" );
00148     viewTrajAction->setToggleAction( TRUE );
00149     viewSMapAction = new QAction( viewActionGroup, "viewSMapAction" );
00150     viewSMapAction->setToggleAction( TRUE );
00151     viewChannelsAction = new QAction( viewActionGroup, "viewChannelsAction" );
00152     viewChannelsAction->setToggleAction( TRUE );
00153     editDescriptor_VecAction = new QAction( this, "editDescriptor_VecAction" );
00154     editBayes_NetworkAction = new QAction( this, "editBayes_NetworkAction" );
00155     editBayes_NetworkViewAction = new QAction( this, "editBayes_NetworkViewAction" );
00156     editBayes_NetworkLoad_NetworkAction = new QAction( this, "editBayes_NetworkLoad_NetworkAction" );
00157     editBayes_NetworkSave_NetworkAction = new QAction( this, "editBayes_NetworkSave_NetworkAction" );
00158     editConfigureBias_ImageAction = new QAction( this, "editConfigureBias_ImageAction" );
00159     editConfigureBias_ImageAction->setToggleAction( TRUE );
00160     editConfigureBias_ImageAction->setOn( FALSE );
00161     editConfigureScene_SettingsAction = new QAction( this, "editConfigureScene_SettingsAction" );
00162     editConfigureTrainAction = new QAction( this, "editConfigureTrainAction" );
00163     editConfigureTrainAction->setToggleAction( TRUE );
00164     editConfigureTestAction = new QAction( this, "editConfigureTestAction" );
00165     editConfigureTestAction->setToggleAction( TRUE );
00166     viewShow_LabelsAction = new QAction( this, "viewShow_LabelsAction" );
00167     viewShow_LabelsAction->setToggleAction( TRUE );
00168     viewShow_Object_LabelAction = new QAction( this, "viewShow_Object_LabelAction" );
00169     viewShow_Object_LabelAction->setToggleAction( TRUE );
00170 
00171 
00172     // toolbars
00173 
00174 
00175     // menubar
00176     MenuBar = new QMenuBar( this, "MenuBar" );
00177 
00178 
00179     fileMenu = new QPopupMenu( this );
00180     fileOpenAction->addTo( fileMenu );
00181     fileSaveAsAction->addTo( fileMenu );
00182     fileMenu->insertSeparator();
00183     fileMenu->insertSeparator();
00184     fileExitAction->addTo( fileMenu );
00185     MenuBar->insertItem( QString(""), fileMenu, 1 );
00186 
00187     Edit = new QPopupMenu( this );
00188     popupMenu_6 = new QPopupMenu( this );
00189     Edit->insertItem( editConfigureAction->iconSet(), tr( "&Configure" ), popupMenu_6 );
00190     editConfigureBias_ImageAction->addTo( popupMenu_6 );
00191     editConfigureScene_SettingsAction->addTo( popupMenu_6 );
00192     editConfigureTestAction->addTo( popupMenu_6 );
00193     editBias_SettingsAction->addTo( Edit );
00194     editDescriptor_VecAction->addTo( Edit );
00195     popupMenu_12 = new QPopupMenu( this );
00196     Edit->insertItem( editBayes_NetworkAction->iconSet(), tr( "&Bayes Network" ), popupMenu_12 );
00197     editBayes_NetworkViewAction->addTo( popupMenu_12 );
00198     editBayes_NetworkLoad_NetworkAction->addTo( popupMenu_12 );
00199     editBayes_NetworkSave_NetworkAction->addTo( popupMenu_12 );
00200     MenuBar->insertItem( QString(""), Edit, 2 );
00201 
00202     View = new QPopupMenu( this );
00203     viewChannelsAction->addTo( View );
00204     viewSMapAction->addTo( View );
00205     viewTrajAction->addTo( View );
00206     viewShow_LabelsAction->addTo( View );
00207     viewShow_Object_LabelAction->addTo( View );
00208     MenuBar->insertItem( QString(""), View, 3 );
00209 
00210     languageChange();
00211     resize( QSize(765, 820).expandedTo(minimumSizeHint()) );
00212     clearWState( WState_Polished );
00213 
00214     // signals and slots connections
00215     connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
00216     connect( fileExitAction, SIGNAL( activated() ), this, SLOT( close() ) );
00217     connect( editBias_SettingsAction, SIGNAL( activated() ), this, SLOT( showBiasSettings() ) );
00218     connect( viewActionGroup, SIGNAL( selected(QAction*) ), this, SLOT( configureView(QAction*) ) );
00219     connect( imgDisp, SIGNAL( mousePressed(int,int,int) ), this, SLOT( getDescriptor(int,int,int) ) );
00220     connect( editDescriptor_VecAction, SIGNAL( activated() ), this, SLOT( showDescriptorVec() ) );
00221     connect( runButton, SIGNAL( clicked() ), this, SLOT( run() ) );
00222     connect( editBayes_NetworkLoad_NetworkAction, SIGNAL( activated() ), this, SLOT( loadBayesNetwork() ) );
00223     connect( editBayes_NetworkSave_NetworkAction, SIGNAL( activated() ), this, SLOT( saveBayesNetwork() ) );
00224     connect( editBayes_NetworkViewAction, SIGNAL( activated() ), this, SLOT( viewBayesNetwork() ) );
00225     connect( editConfigureBias_ImageAction, SIGNAL( toggled(bool) ), this, SLOT( setBiasImage(bool) ) );
00226     connect( EvolveBrainButton, SIGNAL( pressed() ), this, SLOT( evolveBrain() ) );
00227     connect( editConfigureScene_SettingsAction, SIGNAL( activated() ), this, SLOT( showSceneSettings() ) );
00228     connect( itsSceneNumber, SIGNAL( valueChanged(int) ), this, SLOT( getScene(int) ) );
00229     connect( viewShow_LabelsAction, SIGNAL( toggled(bool) ), this, SLOT( showLabels(bool) ) );
00230     connect( itsSelectObject, SIGNAL( activated(int) ), this, SLOT( biasForObject(int) ) );
00231     connect( viewShow_Object_LabelAction, SIGNAL( toggled(bool) ), this, SLOT( showObjectLabel(bool) ) );
00232 }
00233 
00234 /*
00235  *  Destroys the object and frees any allocated resources
00236  */
00237 BiasImageForm::~BiasImageForm()
00238 {
00239     // no need to delete child widgets, Qt does it all for us
00240 }
00241 
00242 /*
00243  *  Sets the strings of the subwidgets using the current
00244  *  language.
00245  */
00246 void BiasImageForm::languageChange()
00247 {
00248     setCaption( tr( "Bias Image" ) );
00249     tabDisp->changeTab( tab, tr( "Original" ) );
00250     textLabel1_2->setText( tr( "Scene Number:" ) );
00251     EvolveBrainButton->setText( tr( "Evolve Brain" ) );
00252     runButton->setText( tr( "Run" ) );
00253     textLabel1->setText( tr( "Epochs:" ) );
00254     textLabel2->setText( tr( "Mesg:" ) );
00255     msgLabel->setText( QString::null );
00256     fileOpenAction->setText( tr( "Open" ) );
00257     fileOpenAction->setMenuText( tr( "&Open..." ) );
00258     fileOpenAction->setAccel( tr( "Ctrl+O" ) );
00259     fileSaveAsAction->setText( tr( "Save As" ) );
00260     fileSaveAsAction->setMenuText( tr( "Save &As..." ) );
00261     fileSaveAsAction->setAccel( QString::null );
00262     fileExitAction->setText( tr( "Exit" ) );
00263     fileExitAction->setMenuText( tr( "E&xit" ) );
00264     fileExitAction->setAccel( QString::null );
00265     editConfigureAction->setText( tr( "Configure" ) );
00266     editConfigureAction->setMenuText( tr( "&Configure" ) );
00267     editBias_SettingsAction->setText( tr( "&Bias Settings" ) );
00268     editBias_SettingsAction->setMenuText( tr( "&Bias Settings" ) );
00269     viewActionGroup->setText( tr( "View" ) );
00270     viewActionGroup->setAccel( tr( "Alt+F, S" ) );
00271     viewTrajAction->setText( tr( "View Traj" ) );
00272     viewTrajAction->setMenuText( tr( "View &Traj" ) );
00273     viewTrajAction->setAccel( tr( "Ctrl+T" ) );
00274     viewSMapAction->setText( tr( "View SMap" ) );
00275     viewSMapAction->setAccel( tr( "Ctrl+S" ) );
00276     viewChannelsAction->setText( tr( "view Channels" ) );
00277     editDescriptor_VecAction->setText( tr( "&Descriptor Vec" ) );
00278     editDescriptor_VecAction->setMenuText( tr( "&Descriptor Vec" ) );
00279     editBayes_NetworkAction->setText( tr( "&Bayes Network" ) );
00280     editBayes_NetworkAction->setMenuText( tr( "&Bayes Network" ) );
00281     editBayes_NetworkViewAction->setText( tr( "View" ) );
00282     editBayes_NetworkViewAction->setMenuText( tr( "View" ) );
00283     editBayes_NetworkLoad_NetworkAction->setText( tr( "Load Network" ) );
00284     editBayes_NetworkLoad_NetworkAction->setMenuText( tr( "Load Network" ) );
00285     editBayes_NetworkSave_NetworkAction->setText( tr( "Save Network" ) );
00286     editBayes_NetworkSave_NetworkAction->setMenuText( tr( "Save Network" ) );
00287     editConfigureBias_ImageAction->setText( tr( "Bias Image" ) );
00288     editConfigureBias_ImageAction->setMenuText( tr( "Bias Image" ) );
00289     editConfigureScene_SettingsAction->setText( tr( "Scene Settings" ) );
00290     editConfigureScene_SettingsAction->setMenuText( tr( "Scene Settings" ) );
00291     editConfigureTrainAction->setText( tr( "Train" ) );
00292     editConfigureTrainAction->setMenuText( tr( "Train" ) );
00293     editConfigureTestAction->setText( tr( "Test" ) );
00294     editConfigureTestAction->setMenuText( tr( "Test" ) );
00295     viewShow_LabelsAction->setText( tr( "Show &Labels" ) );
00296     viewShow_LabelsAction->setMenuText( tr( "Show &Labels" ) );
00297     viewShow_LabelsAction->setAccel( tr( "Ctrl+L" ) );
00298     viewShow_Object_LabelAction->setText( tr( "Show &Object Label" ) );
00299     viewShow_Object_LabelAction->setMenuText( tr( "Show &Object Label" ) );
00300     viewShow_Object_LabelAction->setAccel( tr( "Ctrl+O" ) );
00301     if (MenuBar->findItem(1))
00302         MenuBar->findItem(1)->setText( tr( "&File" ) );
00303     Edit->changeItem( Edit->idAt( 0 ), tr( "&Configure" ) );
00304     Edit->changeItem( Edit->idAt( 3 ), tr( "&Bayes Network" ) );
00305     if (MenuBar->findItem(2))
00306         MenuBar->findItem(2)->setText( tr( "&Edit" ) );
00307     if (MenuBar->findItem(3))
00308         MenuBar->findItem(3)->setText( tr( "&View" ) );
00309 }
00310 
Generated on Sun May 8 08:05:33 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3