Skip to content

Commit

Permalink
slide localization visibility
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://orchestra.med.harvard.edu/svn/megason/Code/GoFigure2@1590 ef826fda-c0ae-4237-af8e-f8dcbcf7929c
  • Loading branch information
Arnaud Gelas committed Oct 13, 2009
1 parent 9d2d277 commit d40d918
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 96 deletions.
85 changes: 48 additions & 37 deletions branches/GoFigure2Beta/Code/GUI/lib/QGoTabImageView3D.cxx
Expand Up @@ -17,6 +17,50 @@ QGoTabImageView3D::QGoTabImageView3D( QWidget* parent ) :
{
setupUi( this );

m_DockWidget = new QDockWidget( tr( "Slice" ) );
m_DockWidget->resize( 120, 300 );

QWidget* temp = new QWidget();
temp->resize( 100, 150 );

QGridLayout* layout = new QGridLayout( temp );
layout->setContentsMargins(3, -1, 3, -1);

QLabel* SliceX = new QLabel( "X Slice" );
layout->addWidget( SliceX, 0, 0 );
m_XSliceSpinBox = new QSpinBox();
layout->addWidget( m_XSliceSpinBox, 0, 1 );

QObject::connect( m_XSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewYZ( int ) ) );

QLabel* SliceY = new QLabel( "Y Slice" );
layout->addWidget( SliceY, 1, 0 );
m_YSliceSpinBox = new QSpinBox( );
layout->addWidget( m_YSliceSpinBox, 1, 1 );

QObject::connect( m_YSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXZ( int ) ) );

QLabel* SliceZ = new QLabel( "Z Slice" );
layout->addWidget( SliceZ, 2, 0 );
m_ZSliceSpinBox = new QSpinBox( );
layout->addWidget( m_ZSliceSpinBox, 2, 1 );

QObject::connect( m_ZSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXY( int ) ) );

m_DockWidget->layout()->addWidget( temp );

CreateAllViewActions();

ReadSettings();
}
//--------------------------------------------------------------------------

//--------------------------------------------------------------------------
void QGoTabImageView3D::CreateAllViewActions()
{
QActionGroup* group = new QActionGroup( this );

QAction* QuadViewAction = new QAction( tr("Quad-View"), this );
Expand Down Expand Up @@ -75,6 +119,10 @@ QGoTabImageView3D::QGoTabImageView3D( QWidget* parent ) :

m_ViewActions.push_back( separator );

QAction* toggleviewaction = m_DockWidget->toggleViewAction();
toggleviewaction->setText( tr( "Slide Location" ) );
m_ViewActions.push_back( toggleviewaction );

QAction* LookupTableAction = new QAction( tr( "Lookup Table" ), this );
LookupTableAction->setStatusTip( tr(" Change the associated lookup table" ) );

Expand All @@ -96,43 +144,6 @@ QGoTabImageView3D::QGoTabImageView3D( QWidget* parent ) :

QObject::connect( BackgroundColorAction, SIGNAL( triggered() ),
this, SLOT( ChangeBackgroundColor() ) );

m_DockWidget = new QDockWidget( tr( "Slice" ) );
m_DockWidget->resize( 120, 300 );

QWidget* temp = new QWidget();
temp->resize( 100, 150 );

QGridLayout* layout = new QGridLayout( temp );
layout->setContentsMargins(3, -1, 3, -1);

QLabel* SliceX = new QLabel( "X Slice" );
layout->addWidget( SliceX, 0, 0 );
m_XSliceSpinBox = new QSpinBox();
layout->addWidget( m_XSliceSpinBox, 0, 1 );

QObject::connect( m_XSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewYZ( int ) ) );

QLabel* SliceY = new QLabel( "Y Slice" );
layout->addWidget( SliceY, 1, 0 );
m_YSliceSpinBox = new QSpinBox( );
layout->addWidget( m_YSliceSpinBox, 1, 1 );

QObject::connect( m_YSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXZ( int ) ) );

QLabel* SliceZ = new QLabel( "Z Slice" );
layout->addWidget( SliceZ, 2, 0 );
m_ZSliceSpinBox = new QSpinBox( );
layout->addWidget( m_ZSliceSpinBox, 2, 1 );

QObject::connect( m_ZSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXY( int ) ) );

m_DockWidget->layout()->addWidget( temp );

ReadSettings();
}
//--------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions branches/GoFigure2Beta/Code/GUI/lib/QGoTabImageView3D.h
Expand Up @@ -77,6 +77,7 @@ class QGoTabImageView3D : public QGoTabImageViewElementBase

void GetBackgroundColorFromImageViewer( );
void SetBackgroundColorToImageViewer( );
void CreateAllViewActions();

// private:
};
Expand Down
100 changes: 55 additions & 45 deletions branches/GoFigure2Beta/Code/GUI/lib/QGoTabImageView3DwT.cxx
Expand Up @@ -23,6 +23,57 @@ QGoTabImageView3DwT::QGoTabImageView3DwT( QWidget* parent ) :

m_MultiFileReader = itk::MultiFileReader::New();

m_DockWidget = new QDockWidget( tr( "Slice" ) );
m_DockWidget->resize( 120, 300 );

QWidget* temp = new QWidget();
temp->resize( 100, 150 );

QGridLayout* layout = new QGridLayout( temp );
layout->setContentsMargins(3, -1, 3, -1);

QLabel* SliceX = new QLabel( "X Slice" );
layout->addWidget( SliceX, 0, 0 );
m_XSliceSpinBox = new QSpinBox();
layout->addWidget( m_XSliceSpinBox, 0, 1 );

QObject::connect( m_XSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewYZ( int ) ) );

QLabel* SliceY = new QLabel( "Y Slice" );
layout->addWidget( SliceY, 1, 0 );
m_YSliceSpinBox = new QSpinBox( );
layout->addWidget( m_YSliceSpinBox, 1, 1 );

QObject::connect( m_YSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXZ( int ) ) );

QLabel* SliceZ = new QLabel( "Z Slice" );
layout->addWidget( SliceZ, 2, 0 );
m_ZSliceSpinBox = new QSpinBox( );
layout->addWidget( m_ZSliceSpinBox, 2, 1 );

QObject::connect( m_ZSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXY( int ) ) );

QLabel* SliceT = new QLabel( "T Time" );
layout->addWidget( SliceT, 3, 0 );
m_TSliceSpinBox = new QSpinBox( );
layout->addWidget( m_TSliceSpinBox, 3, 1 );

QObject::connect( m_TSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetTimePoint( int ) ) );

m_DockWidget->layout()->addWidget( temp );

CreateAllViewActions();
ReadSettings();
}
//--------------------------------------------------------------------------

//--------------------------------------------------------------------------
void QGoTabImageView3DwT::CreateAllViewActions()
{
QActionGroup* group = new QActionGroup( this );

QAction* QuadViewAction = new QAction( tr("Quad-View"), this );
Expand Down Expand Up @@ -81,6 +132,10 @@ QGoTabImageView3DwT::QGoTabImageView3DwT( QWidget* parent ) :

m_ViewActions.push_back( separator );

QAction* toggleviewaction = m_DockWidget->toggleViewAction();
toggleviewaction->setText( tr( "Slide Location" ) );
m_ViewActions.push_back( toggleviewaction );

QAction* LookupTableAction = new QAction( tr( "Lookup Table" ), this );
LookupTableAction->setStatusTip( tr(" Change the associated lookup table" ) );

Expand All @@ -102,51 +157,6 @@ QGoTabImageView3DwT::QGoTabImageView3DwT( QWidget* parent ) :

QObject::connect( BackgroundColorAction, SIGNAL( triggered() ),
this, SLOT( ChangeBackgroundColor() ) );

m_DockWidget = new QDockWidget( tr( "Slice" ) );
m_DockWidget->resize( 120, 300 );

QWidget* temp = new QWidget();
temp->resize( 100, 150 );

QGridLayout* layout = new QGridLayout( temp );
layout->setContentsMargins(3, -1, 3, -1);

QLabel* SliceX = new QLabel( "X Slice" );
layout->addWidget( SliceX, 0, 0 );
m_XSliceSpinBox = new QSpinBox();
layout->addWidget( m_XSliceSpinBox, 0, 1 );

QObject::connect( m_XSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewYZ( int ) ) );

QLabel* SliceY = new QLabel( "Y Slice" );
layout->addWidget( SliceY, 1, 0 );
m_YSliceSpinBox = new QSpinBox( );
layout->addWidget( m_YSliceSpinBox, 1, 1 );

QObject::connect( m_YSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXZ( int ) ) );

QLabel* SliceZ = new QLabel( "Z Slice" );
layout->addWidget( SliceZ, 2, 0 );
m_ZSliceSpinBox = new QSpinBox( );
layout->addWidget( m_ZSliceSpinBox, 2, 1 );

QObject::connect( m_ZSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetSliceViewXY( int ) ) );

QLabel* SliceT = new QLabel( "T Time" );
layout->addWidget( SliceT, 3, 0 );
m_TSliceSpinBox = new QSpinBox( );
layout->addWidget( m_TSliceSpinBox, 3, 1 );

QObject::connect( m_TSliceSpinBox, SIGNAL( valueChanged( int ) ),
this, SLOT( SetTimePoint( int ) ) );

m_DockWidget->layout()->addWidget( temp );

ReadSettings();
}
//--------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions branches/GoFigure2Beta/Code/GUI/lib/QGoTabImageView3DwT.h
Expand Up @@ -88,6 +88,7 @@ public slots:

void GetBackgroundColorFromImageViewer( );
void SetBackgroundColorToImageViewer( );
void CreateAllViewActions();
};

#endif
59 changes: 45 additions & 14 deletions branches/GoFigure2Beta/Code/GUI/src/QGoMainWindow.cxx
Expand Up @@ -42,6 +42,7 @@
#include "QGoTabElementBase.h"
#include "QGoTabImageView2D.h"
#include "QGoTabImageView3D.h"
#include "QGoTabImageView3DwT.h"

// Plugin stuff
#include "QGoPluginHelper.h"
Expand Down Expand Up @@ -97,6 +98,8 @@ QGoMainWindow::QGoMainWindow( )
this->m_ViewToolBar = new QToolBar( tr("View"), this );
this->addToolBar( Qt::TopToolBarArea, this->m_ViewToolBar );

m_LSMReader = vtkLSMReader::New();

m_Bar.hide();
QString temp;
SetCurrentSingleFile( temp );
Expand All @@ -110,6 +113,7 @@ QGoMainWindow::QGoMainWindow( )
// *************************************************************************
QGoMainWindow::~QGoMainWindow()
{
m_LSMReader->Delete();
this->WriteSettings();
}
// *************************************************************************
Expand Down Expand Up @@ -393,13 +397,12 @@ void QGoMainWindow::SetSingleFileName( const QString& iFile )
//--------------------------------------------------------------------------
void QGoMainWindow::OpenLSMImage( const QString& iFile, const int& iTimePoint )
{
vtkLSMReader* reader = vtkLSMReader::New();
reader->SetFileName( iFile.toAscii().data() );
reader->SetUpdateTimePoint( iTimePoint );
reader->Update();
m_LSMReader->SetFileName( iFile.toAscii().data() );
m_LSMReader->SetUpdateTimePoint( iTimePoint );
m_LSMReader->Update();

int dim[5];
reader->GetDimensions( dim );
m_LSMReader->GetDimensions( dim );

int ImageDimensionality = 4;
// bool Color = ( dim[4] > 1 );
Expand All @@ -424,29 +427,57 @@ void QGoMainWindow::OpenLSMImage( const QString& iFile, const int& iTimePoint )
{
case 2:
{
CreateNewTabFor2DImage( reader->GetOutput(), iFile );
CreateNewTabFor2DImage( m_LSMReader->GetOutput(), iFile );
break;
}
case 3:
{
CreateNewTabFor3DImage( reader->GetOutput(), iFile );
CreateNewTabFor3DImage( m_LSMReader->GetOutput(), iFile );
break;
}
case 4:
{
// QGoTabImageView3Dt* w3dt = new QGoTabImageView3Dt;
// w3dt->SetImage( reader->GetOutput() );
// w3dt->SetTimePoint( iTimePoint );
// w3dt->SetLSMReader( reader );
// w3dt->Update();
CreateNewTabFor3DwtImage( m_LSMReader, iFile );
break;
}
}

reader->Delete();
}
//--------------------------------------------------------------------------------

void QGoMainWindow::CreateNewTabFor3DwtImage( vtkLSMReader* iReader, const QString& iFile )
{
QGoTabImageView3DwT* w3t = new QGoTabImageView3DwT;
w3t->SetLSMReader( iReader, 0 );
w3t->Update();

for( std::list< QAction* >::iterator
list_it = m_TabDimPluginActionMap[w3t->GetTabDimensionType()].begin();
list_it != m_TabDimPluginActionMap[w3t->GetTabDimensionType()].end();
list_it++
)
{
(*list_it)->setEnabled( true );
}

w3t->SetPluginActions( m_TabDimPluginActionMap[w3t->GetTabDimensionType()] );

std::list< QDockWidget* > dock_list = w3t->DockWidget();

for( std::list< QDockWidget* >::iterator
dck_it = dock_list.begin();
dck_it != dock_list.end();
++dck_it )
{
this->addDockWidget( Qt::LeftDockWidgetArea, (*dck_it) );//->show();
}

int idx = this->CentralTabWidget->addTab( w3t, iFile );
this->menuView->setEnabled( true );
this->menuFiltering->setEnabled( true );
this->menuSegmentation->setEnabled( true );
this->CentralTabWidget->setCurrentIndex( idx );
}

void QGoMainWindow::CreateNewTabFor3DImage( vtkImageData* iInput, const QString& iFile )
{
QGoTabImageView3D* w3 = new QGoTabImageView3D;
Expand Down
2 changes: 2 additions & 0 deletions branches/GoFigure2Beta/Code/GUI/src/QGoMainWindow.h
Expand Up @@ -134,6 +134,7 @@ protected slots:
void UpdateRecentFileActions( QStringList list, QMenu *menu,
QAction *recentFileActions[MaxRecentFiles] );

void CreateNewTabFor3DwtImage( vtkLSMReader* iReader, const QString& iFile );
void CreateNewTabFor3DImage( vtkImageData*, const QString& );
void CreateNewTabFor2DImage( vtkImageData*, const QString& );

Expand All @@ -152,6 +153,7 @@ protected slots:
QStringList m_PluginFileNames;
QGoTabManager* m_TabManager;
QToolBar* m_ViewToolBar;
vtkLSMReader* m_LSMReader;

/** \brief */
void ReadSettings();
Expand Down

0 comments on commit d40d918

Please sign in to comment.