From: ouv Date: Wed, 28 Sep 2005 14:25:55 +0000 (+0000) Subject: Outside Cursor Gauss Points box added X-Git-Tag: BR-D5-38-2003_D2005-12-10~115 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d6eb874e3f09dbb92869b369fcc135016f3f972e;p=modules%2Fvisu.git Outside Cursor Gauss Points box added --- diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 56255e1e..1f295ccf 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -10,34 +10,53 @@ #include "VVTK_SegmentationCursorDlg.h" +#include "VISU_GaussPtsAct.h" #include "VISU_ImplicitFunctionWidget.h" -#include "QtxAction.h" -#include "QtxDblSpinBox.h" +#include "VISU_GaussPointsPL.hxx" + +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + +#include +#include +#include +#include +#include +#include #include "utilities.h" -#include -#include +#include +#include +#include #include #include -#include #include +#include +#include +#include +#include +#include -#include -#include +#include "QtxAction.h" +#include "QtxDblSpinBox.h" using namespace std; VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const char* name ) :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - myEventCallbackCommand( vtkCallbackCommand::New() ) + myEventCallbackCommand( vtkCallbackCommand::New() ), + myActorCollection( vtkActorCollection::New() ), + myOutsideCursorSettings( VISU_OutsideCursorSettings::New() ) { myPriority = 0.0; myEventCallbackCommand->Delete(); myEventCallbackCommand->SetClientData(this); myEventCallbackCommand->SetCallback(VVTK_SegmentationCursorDlg::ProcessEvents); + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + setCaption( tr( "SEGMENTATION_CURSOR_DLG_TITLE" ) ); setSizeGripEnabled(TRUE); @@ -45,15 +64,15 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c TopLayout->setSpacing(6); TopLayout->setMargin(11); - QTabWidget* TabBox = new QTabWidget( this ); + myTabBox = new QTabWidget( this ); // Segmentation cursor pane - QVBox* SegmentationCursorBox = new QVBox( this ); - SegmentationCursorBox->setMargin(11); - SegmentationCursorBox->setSpacing(6); + mySegmentationCursorBox = new QVBox( this ); + mySegmentationCursorBox->setMargin(11); + mySegmentationCursorBox->setSpacing(6); // Origin - QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), SegmentationCursorBox, "OriginGroup" ); + QGroupBox* OriginGroup = new QGroupBox( tr( "ORIGIN_TITLE" ), mySegmentationCursorBox, "OriginGroup" ); OriginGroup->setColumnLayout( 0, Qt::Vertical ); OriginGroup->layout()->setSpacing( 0 ); OriginGroup->layout()->setMargin( 0 ); @@ -64,19 +83,19 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c OriginGroupLayout->setMargin(11); QLabel* XOriginLabel = new QLabel( tr( "ORIGIN_X" ), OriginGroup ); - myXOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 1.0, OriginGroup ); + myXOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); myXOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myXOriginSpinBox->setMinimumWidth( 100 ); myXOriginSpinBox->setValue( 0.0 ); QLabel* YOriginLabel = new QLabel( tr( "ORIGIN_Y" ), OriginGroup ); - myYOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 1.0, OriginGroup ); + myYOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); myYOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myYOriginSpinBox->setMinimumWidth( 100 ); myYOriginSpinBox->setValue( 0.0 ); QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), OriginGroup ); - myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 1.0, OriginGroup ); + myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, OriginGroup ); myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myZOriginSpinBox->setMinimumWidth( 100 ); myZOriginSpinBox->setValue( 0.0 ); @@ -89,7 +108,7 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c OriginGroupLayout->addWidget( myZOriginSpinBox, 0, 5 ); // Direction - QGroupBox* DirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), SegmentationCursorBox, "DirectionGroup" ); + QGroupBox* DirectionGroup = new QGroupBox( tr( "DIRECTION_TITLE" ), mySegmentationCursorBox, "DirectionGroup" ); DirectionGroup->setColumnLayout( 0, Qt::Vertical ); DirectionGroup->layout()->setSpacing( 0 ); DirectionGroup->layout()->setMargin( 0 ); @@ -125,7 +144,7 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c DirectionGroupLayout->addWidget( myDZDirectionSpinBox, 0, 5 ); // Depth - QGroupBox* DepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), SegmentationCursorBox, "DepthGroup" ); + QGroupBox* DepthGroup = new QGroupBox( tr( "DEPTH_TITLE" ), mySegmentationCursorBox, "DepthGroup" ); DepthGroup->setColumnLayout( 0, Qt::Vertical ); DepthGroup->layout()->setSpacing( 0 ); DepthGroup->layout()->setMargin( 0 ); @@ -136,7 +155,7 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c DepthGroupLayout->setMargin(11); QLabel* DepthLabel = new QLabel( tr( "DEPTH" ), DepthGroup ); - myDepthSpinBox = new QtxDblSpinBox( 0.0, 100.0, 1.0, DepthGroup ); + myDepthSpinBox = new QtxDblSpinBox( 0.0, 100.0, 0.1, DepthGroup ); myDepthSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myDepthSpinBox->setMinimumWidth( 100 ); myDepthSpinBox->setValue( 10.0 ); @@ -145,7 +164,127 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c DepthGroupLayout->addWidget( myDepthSpinBox, 0, 1 ); - TabBox->addTab( SegmentationCursorBox, tr("SEGMENTATION_CURSOR_TAB") ); + myTabBox->addTab( mySegmentationCursorBox, tr("SEGMENTATION_CURSOR_TAB") ); + + + // Outside cursor pane + myOutsideCursorBox = new QVBox( this ); + myOutsideCursorBox->setMargin(11); + myOutsideCursorBox->setSpacing(6); + + // Primitive + QGroupBox* PrimitiveGroup = new QGroupBox( tr( "PRIMITIVE_TITLE" ), myOutsideCursorBox, "PrimitiveGroup" ); + PrimitiveGroup->setColumnLayout(0, Qt::Vertical ); + PrimitiveGroup->layout()->setSpacing( 0 ); + PrimitiveGroup->layout()->setMargin( 0 ); + + QGridLayout* PrimitiveGroupLayout = new QGridLayout (PrimitiveGroup->layout()); + PrimitiveGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + PrimitiveGroupLayout->setSpacing(6); + PrimitiveGroupLayout->setMargin(11); + + // Primitive Type + QButtonGroup* PrimitiveTypeGroup = new QButtonGroup( 3, Qt::Horizontal, PrimitiveGroup, "PrimitiveTypeGroup" ); + PrimitiveTypeGroup->setRadioButtonExclusive( true ); + PrimitiveTypeGroup->setFrameStyle( QFrame::NoFrame ); + PrimitiveTypeGroup->layout()->setMargin( 0 ); + + QRadioButton* PointSpriteButton = new QRadioButton( tr( "POINT_SPRITE" ), PrimitiveTypeGroup ); + PointSpriteButton->setChecked( true ); + + QRadioButton* OpenGLPointButton = new QRadioButton( tr( "OPENGL_POINT" ), PrimitiveTypeGroup ); + OpenGLPointButton->setEnabled( false ); + + QRadioButton* GeometricalSphereButton = new QRadioButton( tr( "GEOMETRICAL_SPHERE" ), PrimitiveTypeGroup ); + GeometricalSphereButton->setEnabled( false ); + + PrimitiveGroupLayout->addMultiCellWidget( PrimitiveTypeGroup, 0, 0, 0, 2 ); + + // Clamp + QLabel* ClampLabel = new QLabel( tr( "MAXIMUM_SIZE" ), PrimitiveGroup ); + myClampSpinBox = new QtxDblSpinBox( 1.0, 512.0, 1.0, PrimitiveGroup ); + myClampSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + PrimitiveGroupLayout->addWidget( ClampLabel, 1, 0 ); + PrimitiveGroupLayout->addMultiCellWidget( myClampSpinBox, 1, 1, 1, 2 ); + + // Main Texture + QLabel* MainTextureLabel = new QLabel( tr( "MAIN_TEXTURE" ), PrimitiveGroup ); + myMainTextureLineEdit = new QLineEdit( PrimitiveGroup ); + QPushButton* MainTextureButton = new QPushButton( PrimitiveGroup ); + MainTextureButton->setAutoDefault( false ); + MainTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( MainTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseMainTexture() ) ); + + PrimitiveGroupLayout->addWidget( MainTextureLabel, 2, 0 ); + PrimitiveGroupLayout->addWidget( myMainTextureLineEdit, 2, 1 ); + PrimitiveGroupLayout->addWidget( MainTextureButton, 2, 2 ); + + // Alpha Texture + QLabel* AlphaTextureLabel = new QLabel( tr( "ALPHA_TEXTURE" ), PrimitiveGroup ); + myAlphaTextureLineEdit = new QLineEdit( PrimitiveGroup ); + QPushButton* AlphaTextureButton = new QPushButton( PrimitiveGroup ); + AlphaTextureButton->setAutoDefault( false ); + AlphaTextureButton->setPixmap( aResourceMgr->loadPixmap( "VISU", tr( "ICON_LOAD_TEXTURE" ) ) ); + connect( AlphaTextureButton, SIGNAL( clicked() ), this, SLOT( onBrowseAlphaTexture() ) ); + + PrimitiveGroupLayout->addWidget( AlphaTextureLabel, 3, 0 ); + PrimitiveGroupLayout->addWidget( myAlphaTextureLineEdit, 3, 1 ); + PrimitiveGroupLayout->addWidget( AlphaTextureButton, 3, 2 ); + + // Alpha Threshold + QLabel* AlphaThresholdLabel = new QLabel( tr( "ALPHA_THRESHOLD" ), PrimitiveGroup ); + myAlphaThresholdSpinBox = new QtxDblSpinBox( 0.0, 1.0, 0.1, PrimitiveGroup ); + myAlphaThresholdSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + PrimitiveGroupLayout->addWidget( AlphaThresholdLabel, 4, 0 ); + PrimitiveGroupLayout->addMultiCellWidget( myAlphaThresholdSpinBox, 4, 4, 1, 2 ); + + // Size + QGroupBox* SizeGroup = new QGroupBox ( tr( "SIZE_TITLE" ), myOutsideCursorBox, "SizeGroup" ); + SizeGroup->setColumnLayout(0, Qt::Vertical ); + SizeGroup->layout()->setSpacing( 0 ); + SizeGroup->layout()->setMargin( 0 ); + + QGridLayout* SizeGroupLayout = new QGridLayout (SizeGroup->layout()); + SizeGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter); + SizeGroupLayout->setSpacing(6); + SizeGroupLayout->setMargin(11); + + // Geometry Size + mySizeLabel = new QLabel( tr( "SIZE" ), SizeGroup ); + mySizeSpinBox = new QtxDblSpinBox( 0, 100, 1, SizeGroup ); + mySizeSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + + SizeGroupLayout->addWidget( mySizeLabel, 0, 0 ); + SizeGroupLayout->addWidget( mySizeSpinBox, 0, 1 ); + + // Color + QGroupBox* ColorGroup = new QGroupBox ( tr( "COLOR_TITLE" ), myOutsideCursorBox, "ColorGroup" ); + ColorGroup->setColumnLayout(0, Qt::Vertical ); + ColorGroup->layout()->setSpacing( 0 ); + ColorGroup->layout()->setMargin( 0 ); + + QGridLayout* ColorGroupLayout = new QGridLayout (ColorGroup->layout()); + ColorGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft); + ColorGroupLayout->setSpacing(6); + ColorGroupLayout->setMargin(11); + + myColorLabel = new QLabel( tr( "COLOR" ), ColorGroup ); + myColorButton = new QPushButton( ColorGroup ); + myColorButton->setPaletteBackgroundColor( Qt::blue ); + myColorButton->setPaletteForegroundColor( Qt::blue ); + + ColorGroupLayout->addWidget( myColorLabel, 0, 0 ); + ColorGroupLayout->addWidget( myColorButton, 0, 1 ); + + connect( myColorButton, SIGNAL( clicked() ), this, SLOT( onColorButtonPressed() ) ); + + + myTabBox->addTab( myOutsideCursorBox, tr("OUTSIDE_CURSOR_TAB") ); + myTabBox->showPage( myOutsideCursorBox ); + + // Common buttons =========================================================== QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); @@ -167,7 +306,7 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c buttonClose->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonClose, 0, 2 ); - TopLayout->addWidget( TabBox ); + TopLayout->addWidget( myTabBox ); TopLayout->addWidget( GroupButtons ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); @@ -178,6 +317,18 @@ VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg() { } +void VVTK_SegmentationCursorDlg::AddActor( VISU_GaussPtsAct* theActor ) +{ + myActorCollection->AddItem( theActor ); + + theActor->SetOutsideCursorSettings( myOutsideCursorSettings.GetPointer() ); +} + +void VVTK_SegmentationCursorDlg::RemoveActor( VISU_GaussPtsAct* theActor ) +{ + myActorCollection->RemoveItem( theActor ); +} + void VVTK_SegmentationCursorDlg::SetWidget( VISU_ImplicitFunctionWidget* theWidget ) { myWidget = theWidget; @@ -196,17 +347,12 @@ void VVTK_SegmentationCursorDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject), switch(theEvent){ case vtkCommand::EndInteractionEvent: - self->OnEndInteractionEvent(); + self->UpdateSegmentation(); break; } } -void VVTK_SegmentationCursorDlg::OnEndInteractionEvent() -{ - Update(); -} - -void VVTK_SegmentationCursorDlg::Update() +void VVTK_SegmentationCursorDlg::UpdateSegmentation() { float origin[3]; myWidget->GetOrigin( origin ); @@ -223,7 +369,126 @@ void VVTK_SegmentationCursorDlg::Update() myDepthSpinBox->setValue( myWidget->Distance() ); } +void VVTK_SegmentationCursorDlg::onBrowseMainTexture() +{ + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + + if( aFileName.isNull() ) + return; + + myMainTexture = aFileName; + myMainTextureLineEdit->setText( aFileName.section( '/', -1 ) ); +} + +void VVTK_SegmentationCursorDlg::onBrowseAlphaTexture() +{ + QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/"; + QString aFileName = QFileDialog::getOpenFileName( aRootDir, "Bitmap (*.bmp *.jpg *.png)", this ); + + if( aFileName.isNull() ) + return; + + myAlphaTexture = aFileName; + myAlphaTextureLineEdit->setText( aFileName.section( '/', -1 ) ); +} + +void VVTK_SegmentationCursorDlg::onColorButtonPressed() +{ + QColor aColor = QColorDialog::getColor( myColorButton->paletteBackgroundColor(), this ); + if( aColor.isValid() ) + myColorButton->setPaletteBackgroundColor( aColor ); +} + +void VVTK_SegmentationCursorDlg::UpdateOutsideCursor() +{ + float aClamp = 200.0; + QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; + QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; + float anAlphaThreshold = 0.1; + float aSize = 0.25; + QColor aColor = Qt::blue; + + if( !myOutsideCursorSettings->GetInitial() ) + { + myClampSpinBox->setValue( myOutsideCursorSettings->GetClamp() ); + myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) ); + myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) ); + myAlphaThresholdSpinBox->setValue( myOutsideCursorSettings->GetAlphaThreshold() ); + mySizeSpinBox->setValue( myOutsideCursorSettings->GetSize() * 100.0 ); + + float* aColor = myOutsideCursorSettings->GetColor(); + myColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ), + ( int )( aColor[1] * 255.0 ), + ( int )( aColor[2] * 255.0 ) ) ); + + return; + } + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + + aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", aClamp ); + myClampSpinBox->setValue( aClamp ); + + myMainTexture = aResourceMgr->stringValue( "VISU", "point_sprite_main_texture", aMainTexture ); + myMainTextureLineEdit->setText( myMainTexture.section( '/', -1 ) ); + + myAlphaTexture = aResourceMgr->stringValue( "VISU", "point_sprite_alpha_texture", anAlphaTexture ); + myAlphaTextureLineEdit->setText( myAlphaTexture.section( '/', -1 ) ); + + anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", anAlphaThreshold ); + myAlphaThresholdSpinBox->setValue( anAlphaThreshold ); + + aSize = aResourceMgr->doubleValue( "VISU", "point_sprite_size", aSize ); + mySizeSpinBox->setValue( aSize * 100.0 ); + + aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", aColor ); + myColorButton->setPaletteBackgroundColor( aColor ); + + ApplyOutsideCursor(); +} + +vtkImageData* VVTK_SegmentationCursorDlg::MakeImageData( const QString& theMainTexture, + const QString& theAlphaTexture ) +{ + //bool updateMainTexture = myMainTexture != theMainTexture; + //bool updateAlphaTexture = myAlphaTexture != theAlphaTexture; + //if( !updateMainTexture && !updateAlphaTexture ) + // return 0; + + //myMainTexture = theMainTexture; + //myAlphaTexture = theAlphaTexture; + + QString mainTextureFormat = theMainTexture.section( '.', -1 ); + QString mainTextureVTI = theMainTexture.section( '.', 0, -2 ) + ".vti"; + QString command1 = QString( "VISU_img2vti " ) + mainTextureFormat + + " " + theMainTexture + " " + mainTextureVTI; + //cout << command1.latin1() << endl; + bool convertMainTexture = system( command1.latin1() ) == 0; + + QString alphaTextureFormat = theAlphaTexture.section( '.', -1 ); + QString alphaTextureVTI = theAlphaTexture.section( '.', 0, -2 ) + ".vti"; + QString command2 = QString( "VISU_img2vti " ) + alphaTextureFormat + + " " + theAlphaTexture + " " + alphaTextureVTI; + //cout << command2.latin1() << endl; + bool convertAlphaTexture = system( command2.latin1() ) == 0; + + if( !convertMainTexture || !convertAlphaTexture ) + return 0; + + return VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), + alphaTextureVTI.latin1()); +} + void VVTK_SegmentationCursorDlg::onClickApply() +{ + if( myTabBox->currentPage() == mySegmentationCursorBox ) + ApplySegmentationCursor(); + else + ApplyOutsideCursor(); +} + +void VVTK_SegmentationCursorDlg::ApplySegmentationCursor() { float origin[3]; origin[0] = myXOriginSpinBox->value(); @@ -239,14 +504,44 @@ void VVTK_SegmentationCursorDlg::onClickApply() myWidget->SetDistance( myDepthSpinBox->value() ); - myWidget->UpdatePlacement(); - + myWidget->InvokeEvent(vtkCommand::EndInteractionEvent,NULL); myWidget->GetInteractor()->Render(); } +void VVTK_SegmentationCursorDlg::ApplyOutsideCursor() +{ + vtkImageData* aTexture = this->MakeImageData( myMainTexture, myAlphaTexture ); + + myOutsideCursorSettings->SetInitial( false ); + myOutsideCursorSettings->SetClamp( myClampSpinBox->value() ); + myOutsideCursorSettings->SetTexture( aTexture ); + myOutsideCursorSettings->SetAlphaThreshold( myAlphaThresholdSpinBox->value() ); + myOutsideCursorSettings->SetSize( mySizeSpinBox->value() / 100.0 ); + + QColor aButtonColor = myColorButton->paletteBackgroundColor(); + float aColor[3]; + aColor[0] = aButtonColor.red() / 255.0; + aColor[1] = aButtonColor.green() / 255.0; + aColor[2] = aButtonColor.blue() / 255.0; + myOutsideCursorSettings->SetColor( aColor ); + + vtkActor* anActor; + for( myActorCollection->InitTraversal(); ( anActor = myActorCollection->GetNextActor() ) != 0; ) + { + VISU_GaussPtsAct* aGPActor = dynamic_cast( anActor ); + if( aGPActor ) + aGPActor->UpdateOutsideCursorSettings(); + } +} + void VVTK_SegmentationCursorDlg::onClickClose() { + myAction->setOn( false ); + reject(); +} +void VVTK_SegmentationCursorDlg::closeEvent( QCloseEvent* ) +{ myAction->setOn( false ); } diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index d0740d98..6694a38d 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -13,14 +13,25 @@ #include -#include -#include +#include #include +class vtkActorCollection; +class vtkCallbackCommand; +class vtkImageData; + +class QLabel; +class QLineEdit; +class QPushButton; +class QRadioButton; +class QTabWidget; +class QVBox; + class QtxAction; class QtxDblSpinBox; -class QPushButton; +class VISU_GaussPtsAct; +class VISU_OutsideCursorSettings; class VISU_ImplicitFunctionWidget; class VVTK_SegmentationCursorDlg : public QDialog @@ -31,14 +42,25 @@ public: VVTK_SegmentationCursorDlg( QWidget* parent = 0, const char* name = 0 ); ~VVTK_SegmentationCursorDlg(); + void AddActor( VISU_GaussPtsAct* ); + void RemoveActor( VISU_GaussPtsAct* ); + void SetWidget( VISU_ImplicitFunctionWidget* ); void SetAction( QtxAction* theAction ) { myAction = theAction; } - void InitFromWidget(); + void UpdateSegmentation(); + + void UpdateOutsideCursor(); - void Update(); +protected: + void ApplySegmentationCursor(); + void ApplyOutsideCursor(); - void OnEndInteractionEvent(); + vtkImageData* MakeImageData( const QString& theMainTexture, + const QString& theAlphaTexture ); + +protected: + virtual void closeEvent( QCloseEvent* ); private: static void ProcessEvents(vtkObject* theObject, @@ -50,12 +72,15 @@ private slots: void onClickApply(); void onClickClose(); + void onBrowseMainTexture(); + void onBrowseAlphaTexture(); + void onColorButtonPressed(); + private: - float myPriority; - vtkSmartPointer myEventCallbackCommand; + QTabWidget* myTabBox; - VISU_ImplicitFunctionWidget* myWidget; - QtxAction* myAction; + // Segmentation cursor + QVBox* mySegmentationCursorBox; QtxDblSpinBox* myXOriginSpinBox; QtxDblSpinBox* myYOriginSpinBox; @@ -67,6 +92,32 @@ private: QtxDblSpinBox* myDepthSpinBox; + float myPriority; + vtkSmartPointer myEventCallbackCommand; + + VISU_ImplicitFunctionWidget* myWidget; + QtxAction* myAction; + + // Outside cursor + QVBox* myOutsideCursorBox; + + QtxDblSpinBox* myClampSpinBox; + + QLineEdit* myMainTextureLineEdit; + QLineEdit* myAlphaTextureLineEdit; + QtxDblSpinBox* myAlphaThresholdSpinBox; + + QLabel* mySizeLabel; + QtxDblSpinBox* mySizeSpinBox; + + QLabel* myColorLabel; + QPushButton* myColorButton; + + QString myMainTexture; + QString myAlphaTexture; + + vtkSmartPointer myActorCollection; + vtkSmartPointer myOutsideCursorSettings; }; #endif