예제 #1
0
MainWindow::MainWindow( QWidget* parent, Qt::WFlags flags )
    : QMainWindow( parent, flags )
   // Misc  -------------------------------------------------------------------------
    , content( new QStackedWidget() )
    , tabWidget( new QTabWidget() )
    , nextTabId( 1 )
    , carnaModelFactory( new CarnaModelFactory( server ) )
    , componentWindowFactory( *this )
   // File Menu  --------------------------------------------------------------------
    , exporting( new QAction( "&Export...", this ) )
    , normalizing( new QAction( "&Normalize...", this ) )
    , masking( new QAction( "&Mask Dataset...", this ) )
    , closing( new QAction( "&Close", this ) )
   // View Menu  --------------------------------------------------------------------
    , acquiringViewTab( new QAction( "New &Tab", this ) )
#ifndef NO_CRA
    , acquiringLocalizer( new QAction( "&Localizer", this ) )
    , acquiringRegistration( new QAction( "&Registration...", this ) )
#endif
    , acquiringModelInfo( new QAction( "&Properties", this ) )
    , acquiringObjectsManager( new QAction( "Objects...", this ) )
    , acquiringPointClouds( new QAction( "&Point Clouds...", this ) )
    , acquiringGulsun( new QAction( "&Gulsun Vessel Segmentation", this ) )
    , maskExporting( new QAction( "&Export Binary Mask...", this ) )
    , maskImporting( new QAction( "&Import Binary Mask...", this ) )
{
    this->setWindowTitle( "DICOM Viewer 3" );
    this->resize( 750, 750 );

    // -----------------------------------------------------------------

    QAction* exiting  = new QAction( "E&xit" , this );

    exiting->setShortcuts( QKeySequence::Quit );

    QMenu* fileMenu = menuBar()->addMenu( "&File" );
    fileMenu->addAction( acquiringModelInfo );
    fileMenu->addSeparator();
    fileMenu->addAction( normalizing );
    fileMenu->addAction( masking );
    fileMenu->addSeparator();
    fileMenu->addAction( maskImporting );
    fileMenu->addAction( maskExporting );
    fileMenu->addSeparator();
    fileMenu->addAction( exporting );
    fileMenu->addAction( closing );
    fileMenu->addSeparator();
    fileMenu->addAction( exiting );

    closing->setShortcut( QKeySequence( Qt::CTRL + Qt::Key_W ) );
    exiting->setShortcut( QKeySequence( Qt::ALT + Qt::Key_F4 ) );

    closing->setEnabled( false );
    exporting->setEnabled( false );
    normalizing->setEnabled( false );
    masking->setEnabled( false );
    maskExporting->setEnabled( false );
    maskImporting->setEnabled( false );

    connect( exporting    , SIGNAL( triggered() ), this, SLOT( exportRecord() ) );
    connect( normalizing  , SIGNAL( triggered() ), this, SLOT(    normalize() ) );
    connect( masking      , SIGNAL( triggered() ), this, SLOT(         mask() ) );
    connect( closing      , SIGNAL( triggered() ), this, SLOT(  closeRecord() ) );
    connect( exiting      , SIGNAL( triggered() ), this, SLOT(         exit() ) );
    connect( maskExporting, SIGNAL( triggered() ), this, SLOT(   exportMask() ) );
    connect( maskImporting, SIGNAL( triggered() ), this, SLOT(   importMask() ) );

    // -----------------------------------------------------------------

    acquiringObjectsManager->setCheckable( true );
    acquiringPointClouds->setCheckable( true );
    acquiringModelInfo->setCheckable( true );
    acquiringObjectsManager->setCheckable( true );
    acquiringGulsun->setCheckable( true );

#ifndef NO_CRA
    acquiringLocalizer->setCheckable( true );
    acquiringRegistration->setCheckable( true );
#endif

    QMenu* menuView = menuBar()->addMenu( "&View" );
    menuView->addAction( acquiringViewTab );
    menuView->addSeparator();
    menuView->addAction( acquiringObjectsManager );
    menuView->addAction( acquiringPointClouds );
    menuView->addAction( acquiringGulsun );

#ifndef NO_CRA
    menuView->addSeparator();
    menuView->addAction( acquiringLocalizer );
    menuView->addAction( acquiringRegistration );
#endif

    acquiringViewTab       ->setEnabled( false );
    acquiringModelInfo     ->setEnabled( false );
    acquiringObjectsManager->setEnabled( false );
    acquiringPointClouds   ->setEnabled( false );
    acquiringGulsun        ->setEnabled( false );

#ifndef NO_CRA
    acquiringLocalizer   ->setEnabled( false );
    acquiringRegistration->setEnabled( false );
#endif

    acquiringViewTab->setShortcut( QKeySequence::AddTab );
    acquiringGulsun->setShortcut( Qt::Key_F8 );
    acquiringObjectsManager->setShortcut( Qt::Key_F9 );
    acquiringPointClouds->setShortcut( Qt::Key_F10 );

#ifndef NO_CRA
    acquiringLocalizer->setShortcut( Qt::Key_F11 );
    acquiringRegistration->setShortcut( Qt::Key_F12 );
#endif

    connect( acquiringViewTab       , SIGNAL( triggered() ), this, SLOT(           acquireViewTab() ) );
    connect( acquiringModelInfo     , SIGNAL( triggered() ), this, SLOT(         acquireModelInfo() ) );
    connect( acquiringObjectsManager, SIGNAL( triggered() ), this, SLOT(    acquireObjectsManager() ) );
    connect( acquiringPointClouds   , SIGNAL( triggered() ), this, SLOT(       acquirePointClouds() ) );
    connect( acquiringGulsun        , SIGNAL( triggered() ), this, SLOT(            acquireGulsun() ) );

#ifndef NO_CRA
    connect( acquiringLocalizer   , SIGNAL( triggered() ), this, SLOT(    acquireLocalizer() ) );
    connect( acquiringRegistration, SIGNAL( triggered() ), this, SLOT( acquireRegistration() ) );
#endif

    // -----------------------------------------------------------------

    content->addWidget( carnaModelFactory );

    connect( carnaModelFactory, SIGNAL( created( Carna::base::model::Scene* ) ), this, SLOT( init( Carna::base::model::Scene* ) ) );

    tabWidget->setDocumentMode( true );
    content->addWidget( tabWidget );
    this->setCentralWidget( content );

    connect( tabWidget, SIGNAL( tabCloseRequested( int ) ), this, SLOT( tabCloseRequested( int ) ) );
}
예제 #2
0
void MainWindow::setupConnections()
{
    // Importing
    connect(importButton, SIGNAL(clicked()), this, SLOT(launchImageImport()));
    connect(filedata, SIGNAL(imagesImported()), aListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), bListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), vectorListWidget, SLOT(populate()));
    connect(filedata, SIGNAL(imagesImported()), this, SLOT(notifyFolderChange()));
    connect(filedata, SIGNAL(vectorListUpdated()), vectorListWidget, SLOT(update()));

    // Image selection
    connect(aListWidget, SIGNAL(fileClicked(int)), this, SLOT(pivAclicked(int)));
    connect(bListWidget, SIGNAL(fileClicked(int)), this, SLOT(pivBclicked(int)));
    connect(vectorListWidget, SIGNAL(fileClicked(int)), this, SLOT(vectorClicked(int)));
    connect(forwardButton, SIGNAL(clicked()), this, SLOT(forwardOne()));
    connect(backButton, SIGNAL(clicked()), this, SLOT(backwardOne()));

    // Image/vector viewing
    connect(zoomInButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomIn()));
    connect(zoomOutButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomOut()));
    connect(zoomFitButton, SIGNAL(clicked()), pivDisplay, SLOT(zoomFit()));
    // The following should be moved into settings
    connect(vectorToggle, SIGNAL(toggled(bool)), pivDisplay, SLOT(vectorsToggled(bool)));
    //
    connect(colourButtonFiltered, SIGNAL(clicked()), this, SLOT(chooseFilteredColour()));
    connect(colourButtonUnfiltered, SIGNAL(clicked()), this, SLOT(chooseUnfilteredColour()));
    connect(scaleSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorScale(double)));
    connect(subSpin, SIGNAL(valueChanged(double)), settings, SLOT(setVectorSub(double)));
    connect(settings, SIGNAL(vectorSettingChanged()), pivDisplay, SLOT(vectorsChanged()));

    // Masking
    connect(maskButton, SIGNAL(clicked()), maskButton, SLOT(showMenu()));
    connect(filedata,SIGNAL(imagesImported()), maskDropDown, SLOT(imageLoaded()));
    connect(maskDropDown, SIGNAL(importMaskClicked()), filedata, SLOT(importMask()));
    connect(filedata, SIGNAL(maskLoaded()), maskDropDown, SLOT(maskLoaded()));
    connect(maskDropDown, SIGNAL(gridToggled(bool)), pivDisplay, SLOT(maskToggled(bool)));
    connect(maskDropDown, SIGNAL(clearMask(bool)), settings, SLOT(setIsMask(bool)));

    // Process tab
    connect(hSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthX(int)));
    connect(vSizeCombo, SIGNAL(activated(int)), settings, SLOT(setIntLengthY(int)));
    connect(hSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaX(int)));
    connect(vSpaceSpin, SIGNAL(valueChanged(int)), settings, SLOT(setDeltaY(int)));

    // Filter tab
    connect(globalRangeCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(minUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(maxUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(minVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(maxVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(globalStDevCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(nStdDevSpin, SIGNAL(valueChanged(double)), this, SLOT(setFilterValues()));

    connect(localCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(localMethodCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(localNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(localUedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(localVedit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));

    connect(interpolateCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(interpolateMethodCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));
    connect(interpolateNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));

    connect(smoothCheck, SIGNAL(toggled(bool)), this, SLOT(filterChanged()));
    connect(smoothRadiusEdit, SIGNAL(textChanged(QString)), this, SLOT(setFilterValues()));
    connect(smoothNxNCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setFilterValues()));

    // DoingPIV
    connect(outputFolderEdit, SIGNAL(textEdited(QString)), this, SLOT(setOutput()));
    connect(outputFolderButton, SIGNAL(clicked()), this, SLOT(chooseOutputFolder()));
    connect(outputFormatCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setOutput()));
    connect(correlateButton, SIGNAL(clicked()), process, SLOT(processCurrentImagePair()));
    connect(process, SIGNAL(currentProcessed()), pivDisplay, SLOT(displayCurrent()));
    connect(process, SIGNAL(currentProcessed()), output, SLOT(outputCurrent()));
    connect(filterButton, SIGNAL(clicked()), analysis, SLOT(filterCurrent()));
    connect(analysis, SIGNAL(currentFiltered()), pivDisplay, SLOT(displayCurrent()));
    connect(analysis, SIGNAL(currentFiltered()), output, SLOT(outputCurrent()));
    connect(batchButton, SIGNAL(clicked()), process, SLOT(launchBatchWindow()));
    connect(process, SIGNAL(batchProcessed()), this, SLOT(batchDone()));
    connect(pivDisplay, SIGNAL(mouseMoved(QPointF)), this, SLOT(updatePositionLabel(QPointF)));

    // Data Quality
    connect(filterSNRCheck, SIGNAL(toggled(bool)), this, SLOT(qualityChanged()));
    connect(snrEdit, SIGNAL(textEdited(QString)), this, SLOT(qualityChanged()));
    connect(filterIntCheck, SIGNAL(toggled(bool)), this, SLOT(qualityChanged()));
    connect(intensityEdit, SIGNAL(textEdited(QString)), this, SLOT(qualityChanged()));
}