From 54bb3fba5f59ca71cb82d87043e21354dd85e7aa Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 18 Oct 2010 08:35:01 +0000 Subject: [PATCH] *** empty log message *** --- CMakeLists.txt | 18 +- bbtk/CMakeLists.txt | 1 + .../bbcreaMaracasVisuColorLayerImageView.cxx | 65 +++++++ .../bbcreaMaracasVisuColorLayerImageView.h | 49 +++++ lib/maracasVisuLib/CMakeLists.txt | 6 - .../ColorLayerImageViewPanel.cxx | 170 ++++++++++-------- .../ColorLayerImageViewPanel.h | 19 +- .../ThresholdImageView/LayerImageBase.cxx | 33 ++-- .../ThresholdImageView/LayerImageBase.h | 11 +- 9 files changed, 252 insertions(+), 120 deletions(-) create mode 100644 bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx create mode 100644 bbtk/src/bbcreaMaracasVisuColorLayerImageView.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7a8b9d0..858c157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,23 +44,7 @@ MARK_AS_ADVANCED( LIBRARY_OUTPUT_PATH ) -IF (WIN32) - SET(CREAMARACASVISU_LIB_PATH bin) -ELSE (WIN32) - if( NOT APPLE ) - # check 64 bit - if( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 ) - set( HAVE_64_BIT 0 ) - SET(CREAMARACASVISU_LIB_PATH lib) - else( ${CMAKE_SIZEOF_VOID_P}EQUAL 4 ) - set( HAVE_64_BIT 1 ) - SET(CREAMARACASVISU_LIB_PATH lib64) - endif( ${CMAKE_SIZEOF_VOID_P} EQUAL 4 ) - endif( NOT APPLE ) -ENDIF(WIN32) - - - +SET(CREAMARACASVISU_LIB_PATH ${CMAKE_CREA_LIB_PATH} ) SUBDIRS(install) #SUBDIRS(appli) diff --git a/bbtk/CMakeLists.txt b/bbtk/CMakeLists.txt index 8ef6dbc..e88276a 100644 --- a/bbtk/CMakeLists.txt +++ b/bbtk/CMakeLists.txt @@ -132,6 +132,7 @@ SET(${BBTK_PACKAGE_NAME}_INCLUDE_DIRS ../lib/maracasVisuLib/src/interface/wxWindows/widgets ../lib/maracasVisuLib/src/interface/wxWindows/widgets/pPlotter ../lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour + ../lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView ../lib/maracasVisuLib/src/CutModule/interface ../lib/maracasVisuLib/src/CutModule/kernel diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx new file mode 100644 index 0000000..4885cbd --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.cxx @@ -0,0 +1,65 @@ +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +#include "bbcreaMaracasVisuColorLayerImageView.h" +#include "bbcreaMaracasVisuPackage.h" + +#include "ColorLayerImageViewPanel.h" + +namespace bbcreaMaracasVisu +{ + +BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ColorLayerImageView) +BBTK_BLACK_BOX_IMPLEMENTATION(ColorLayerImageView,bbtk::WxBlackBox); +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +void ColorLayerImageView::Process() +{ + + ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget(); + clivp->GetColorLayerImageView()->SetwxVtkBaseView( bbGetInputWxVtkBaseView() ); + +// std::string msg; +// if (bbGetInputTitle()!="") +// { +// msg = bbGetInputTitle()+": " + bbGetInputIn(); +// }else{ +// msg = bbGetInputIn(); +// } +// ((wxStaticText*)bbGetOutputWidget())->SetLabel( bbtk::std2wx( msg ) ); + +} +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +void ColorLayerImageView::CreateWidget(wxWindow* parent) +{ + ColorLayerImageViewPanel *clivp = new ColorLayerImageViewPanel(parent, 0, 100, 1); + bbSetOutputWidget( clivp ); +} +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +void ColorLayerImageView::bbUserSetDefaultValues() +{ + +} +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +void ColorLayerImageView::bbUserInitializeProcessing() +{ + +} +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +void ColorLayerImageView::bbUserFinalizeProcessing() +{ + +} +} +// EO namespace bbcreaMaracasVisu + + diff --git a/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h new file mode 100644 index 0000000..89c9b2d --- /dev/null +++ b/bbtk/src/bbcreaMaracasVisuColorLayerImageView.h @@ -0,0 +1,49 @@ +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +#ifdef _USE_WXWIDGETS_ +#ifndef __bbcreaMaracasVisuColorLayerImageView_h_INCLUDED__ +#define __bbcreaMaracasVisuColorLayerImageView_h_INCLUDED__ +#include "bbcreaMaracasVisu_EXPORT.h" +#include "bbtkWxBlackBox.h" + +#include "wxVtkBaseView.h" + +namespace bbcreaMaracasVisu +{ + +class bbcreaMaracasVisu_EXPORT ColorLayerImageView + : + public bbtk::WxBlackBox +{ + BBTK_BLACK_BOX_INTERFACE(ColorLayerImageView,bbtk::WxBlackBox); +//===== +// Don't edit this file. This file is generated from xml description.. +//===== + BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *); + BBTK_PROCESS(Process); + void Process(); + BBTK_CREATE_WIDGET(CreateWidget); + void CreateWidget(wxWindow*); + +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +}; + +BBTK_BEGIN_DESCRIBE_BLACK_BOX(ColorLayerImageView,bbtk::WxBlackBox); +BBTK_NAME("ColorLayerImageView"); +BBTK_AUTHOR("Eduardo DAVILA (Creatis)"); +BBTK_DESCRIPTION("Color Laye rImage View"); +BBTK_CATEGORY("__CategoryBlackBox__"); +BBTK_INPUT(ColorLayerImageView,WxVtkBaseView,"creaMaracasVisuViewer viewer",wxVtkBaseView*,""); +BBTK_END_DESCRIBE_BLACK_BOX(ColorLayerImageView); +//===== +// Don't edit this file. This file is generated from xml description.. +//===== +} +// EO namespace bbcreaMaracasVisu + +#endif // __bbcreaMaracasVisuColorLayerImageView_h_INCLUDED__ +#endif // _USE_WXWIDGETS_ + diff --git a/lib/maracasVisuLib/CMakeLists.txt b/lib/maracasVisuLib/CMakeLists.txt index 21bd898..fcfdf41 100644 --- a/lib/maracasVisuLib/CMakeLists.txt +++ b/lib/maracasVisuLib/CMakeLists.txt @@ -189,12 +189,6 @@ ENDIF ( ${PROJECT_BINARY_DIR} STREQUAL ${EXECUTABLE_OUTPUT_PATH} ) IF(UNIX) SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS ${CILFC_EXECUTABLE_OUTPUT_REL_PATH}) -message("EED cmakelist creamaracasvisu -------------------------------") -message("EED cmakelist creamaracasvisu -------------------------------") -message("EED cmakelist creamaracasvisu -------------------------------") -message("EED cmakelist creamaracasvisu -------------------------------") -message("EED cmakelist creamaracasvisu -------------------------------") -message("EED cmakelist creamaracasvisu ${CREAMARACASVISU_LIB_PATH} -------------------------------") SET(${LIBRARY_NAME}_INSTALL_TREE_RELATIVE_LIBRARY_PATHS ${CREAMARACASVISU_LIB_PATH} ) ELSE(UNIX) SET(${LIBRARY_NAME}_BUILD_TREE_RELATIVE_LIBRARY_PATHS diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx index d574e30..0d68842 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.cxx @@ -1,8 +1,8 @@ - + /** - * \file - * \brief ClassThresholdImageViewPanel . + * \file + * \brief ClassThresholdImageViewPanel . */ @@ -24,26 +24,26 @@ void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *paren wxDialog* dial = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190)); wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL); wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL); - + wxString lstOptOperation[3]; lstOptOperation[0]=_T("By Dimension"); lstOptOperation[1]=_T("By Spacing"); lstOptOperation[2]=_T("By Pixel"); - wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation, 3, wxRA_SPECIFY_COLS); - + wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation, 3, wxRA_SPECIFY_COLS); + dialSizer->Add( new wxStaticText(dial,-1,message) , 0, wxGROW ); - // dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW ); - dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW ); + // dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW ); + dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW ); dialSizer->Add(radioOpts,0,wxGROW); - dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW ); + dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW ); dialSizer->Add(buttonsSizer,0,wxGROW); dial->SetSizer(dialSizer, true); dial->Layout(); dial->ShowModal(); - + typeOfTransformation = -1; dlgWxOK = false; - + if (dial->GetReturnCode() == wxID_OK) { typeOfTransformation = radioOpts->GetSelection(); @@ -77,20 +77,20 @@ ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, in _sl_SliceImage->Enable(false); _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") ); - _interpolationCheckBox->SetValue(true); + _interpolationCheckBox->SetValue(true); _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator); - + if (type==0) { } - + if (type==1) { } - - - Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage ); - Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow ); + + + Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage ); + Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow ); Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation ); Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity ); Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic ); @@ -137,13 +137,20 @@ void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* color _colorLayerImageView = colorLayerImageView; } +//---------------------------------------------------------------------------- +ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView() +{ + return _colorLayerImageView; +} + + // This is the new spacing of the background image (1,1,1) void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3]) { _spcBase[0] = spc[0]; _spcBase[1] = spc[1]; _spcBase[2] = spc[2]; - + _spcBase[0] = 1; _spcBase[1] = 1; _spcBase[2] = 1; @@ -169,8 +176,8 @@ void ColorLayerImageViewPanel::SetBaseDimension(int dim[3]) void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event) { // EED ??? -// creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB"); -// w.ShowModal(); +// creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB"); +// w.ShowModal(); printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n"); creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog(); @@ -178,7 +185,7 @@ void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event) double spc[3]; diag.getImageData()->GetSpacing(spc); - + int dim[3]; int ext[6]; diag.getImageData()->GetWholeExtent(ext); @@ -186,121 +193,142 @@ void ColorLayerImageViewPanel::onReadImage(wxCommandEvent& event) dim[1] = ext[3]-ext[2]; dim[2] = ext[5]-ext[4]; _sl_SliceImage->SetRange( 0 , dim[2] ); - - if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) || - (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) + + if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) || + (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ) { - + bool transformOkDlg; int typeOfTransformation; wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? "); wxDlgTransformByDimensionBySpacingByPixel dlg; dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg); - + printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n"); - - if (typeOfTransformation==0) // make dimensions equals + + if (typeOfTransformation==0) // make dimensions equals { printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n"); spc[0]=_spcBase[0]*_dimBase[0]/dim[0]; spc[1]=_spcBase[1]*_dimBase[1]/dim[1]; spc[2] = 1; } - + if (typeOfTransformation==1) // make spacing equals { spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0]; spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1]; spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2]; } - + if (typeOfTransformation==2) // make spacing = 1 { spc[0] = 1; spc[1] = 1; spc[2] = 1; } - + diag.getImageData()->SetSpacing(spc); } // spc !_spcBase dim!__dimBase - - _colorLayerImageView->onThreshold(); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); + + if (_colorLayerImageView!=NULL) + { + _colorLayerImageView->onThreshold(); + _colorLayerImageView->Refresh(); + } } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event) { - if (_thresholdGo) + if (_colorLayerImageView!=NULL) { - _colorLayerImageView->onThresholdChange(); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); - //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; - } + if (_thresholdGo) + { + _colorLayerImageView->onThresholdChange(); + _colorLayerImageView->Refresh(); + //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl; + } // _threshold + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event) { - _thresholdGo = _cb_ShowHide->GetValue(); - if (_thresholdGo) + if (_colorLayerImageView!=NULL) { - _colorLayerImageView->onThreshold(); - } - else - { - _colorLayerImageView->onThresholdRemove( ); - } - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); + _thresholdGo = _cb_ShowHide->GetValue(); + if (_thresholdGo) + { + _colorLayerImageView->onThreshold(); + }else{ + _colorLayerImageView->onThresholdRemove( ); + } + _colorLayerImageView->Refresh(); + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onThresholdStop() { - if (_thresholdGo) - { - _colorLayerImageView->onThresholdRemove( ); - _thresholdGo=false; - } + if (_colorLayerImageView!=NULL) + { + if (_thresholdGo) + { + _colorLayerImageView->onThresholdRemove( ); + _thresholdGo=false; + } + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event) { - _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue()); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); - + if (_colorLayerImageView!=NULL) + { + _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue()); + _colorLayerImageView->Refresh(); + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event) { - bool fixdin = _cb_SliceFixDinamic->GetValue(); - _colorLayerImageView->SetSliceFixDinamic( fixdin ); - if (fixdin==false) + if (_colorLayerImageView!=NULL) { - _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() ); - } - _sl_SliceImage->Enable(!fixdin); - _colorLayerImageView->onThreshold(); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); + bool fixdin = _cb_SliceFixDinamic->GetValue(); + _colorLayerImageView->SetSliceFixDinamic( fixdin ); + if (fixdin==false) + { + _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() ); + } + _sl_SliceImage->Enable(!fixdin); + _colorLayerImageView->onThreshold(); + _colorLayerImageView->Refresh(); + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event) { - _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() ); - _colorLayerImageView->onThreshold(); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); + if (_colorLayerImageView!=NULL) + { + _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() ); + _colorLayerImageView->onThreshold(); + _colorLayerImageView->Refresh(); + }//_colorLayerImageView } //---------------------------------------------------------------------------- void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event) { - int opacity = _opacity->GetValue(); - _colorLayerImageView->onThresholdChangeOpacity(opacity); - _colorLayerImageView->GetwxVtkBaseView()->Refresh(); + if (_colorLayerImageView!=NULL) + { + int opacity = _opacity->GetValue(); + _colorLayerImageView->onThresholdChangeOpacity(opacity); + _colorLayerImageView->Refresh(); + }//_colorLayerImageView } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h index 3b19119..03cff54 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/ColorLayerImageViewPanel.h @@ -1,15 +1,15 @@ /** - * \file - * \brief Class ThresholdImageViewPanel . + * \file + * \brief Class ThresholdImageViewPanel . */ /** * \class ThresholdImageViewPanel - * \brief + * \brief */ - + #ifndef __ColorLayerImageViewPanel_h__ #define __ColorLayerImageViewPanel_h__ @@ -18,7 +18,7 @@ #include #include "ColorLayerImageView.h" - + //EED 21-08-2010 class wxDlgTransformByDimensionBySpacingByPixel { @@ -34,15 +34,16 @@ class wxDlgTransformByDimensionBySpacingByPixel : public wxPanel { public: - ColorLayerImageViewPanel(wxWindow * parent, int min, int max, int type); + ColorLayerImageViewPanel(wxWindow * parent, int min, int max, int type); ~ColorLayerImageViewPanel(); void onThresholdStop(); + ColorLayerImageView* GetColorLayerImageView(); void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView); bool IsVisible(); void SetBaseSpacing(double spc[3]); void SetBaseDimension(int dim[3]); void SetOriginalSpacing(double spc[3]); - + private: int _dimBase[3]; double _spcBase[3]; @@ -52,12 +53,12 @@ class wxDlgTransformByDimensionBySpacingByPixel ColorLayerImageView *_colorLayerImageView; wxButton *_btn_ReadImage; wxSlider *_opacity; - wxCheckBox *_interpolationCheckBox; + wxCheckBox *_interpolationCheckBox; wxCheckBox *_cb_ShowHide; wxCheckBox *_cb_SliceFixDinamic; wxSlider *_sl_SliceImage; void onReadImage(wxCommandEvent& event); - void onThresholdChange(wxCommandEvent& event); + void onThresholdChange(wxCommandEvent& event); void onThresholdShow(wxCommandEvent& event); void onThresholdInterpolation(wxCommandEvent& event); void onChangeOpacity(wxScrollEvent& event); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx index c079604..beb17ea 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.cxx @@ -1,7 +1,7 @@ /** - * \file - * \brief Class bbtk::ThresholdImageView . + * \file + * \brief Class bbtk::ThresholdImageView . */ #include "LayerImageBase.h" @@ -14,6 +14,7 @@ LayerImageBase::LayerImageBase() _thresholdMapper = NULL; _thresholdActor = NULL; _image = NULL; + _baseView = NULL; _imageReslicer = vtkImageReslice::New(); } @@ -67,6 +68,14 @@ wxVtkBaseView *LayerImageBase::GetwxVtkBaseView() return _baseView; } +//---------------------------------------------------------------------------- +void LayerImageBase::Refresh() +{ + if (_baseView!=NULL) + { + _baseView->Refresh(); + } +} //---------------------------------------------------------------------------- @@ -77,7 +86,7 @@ vtkLookupTable* LayerImageBase::GetThresholdTable() //---------------------------------------------------------------------------- int LayerImageBase::CleanZ(int z) -{ +{ int ext[6]; _image->GetWholeExtent(ext); @@ -98,37 +107,37 @@ int LayerImageBase::CleanZ(int z) void LayerImageBase::onThreshold() { - if (_image!=NULL) + if ((_image!=NULL) && (_baseView!=NULL)) { int z=CleanZ( GetZ() ); if (!GetActorPresent()) - { + { if (_thresholdTable==NULL) { //Lookup Table _thresholdTable = vtkLookupTable::New(); } // _thresholdTable - + if (_thresholdMapper==NULL) { _thresholdMapper = vtkImageMapToColors::New( ); } - + if (_thresholdActor==NULL) { _thresholdActor = vtkImageActor::New( ); _thresholdActor->SetOpacity( 0.6 ); _thresholdActor->InterpolateOn( ); _thresholdActor->SetPosition( 0,0, 900-1 ); - } // _thresholdActor + } // _thresholdActor _baseView->GetRenderer()->AddActor( _thresholdActor ); - _actorPresent = true; + _actorPresent = true; } // !GetActorPresent() ConfigLookupTable(); // virtual method _imageReslicer->SetInput( GetImage() ); - _imageReslicer->SetInformationInput( GetImage() ); + _imageReslicer->SetInformationInput( GetImage() ); _imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1); _imageReslicer->SetOutputDimensionality(2); _imageReslicer->SetInterpolationModeToLinear(); @@ -167,7 +176,7 @@ void LayerImageBase::onThresholdInterpolation(bool interpolate) else { _thresholdActor->InterpolateOff( ); - } + } } } @@ -188,7 +197,7 @@ void LayerImageBase::onThresholdRemove() wxVtkBaseView * baseView = _baseView; baseView->GetRenderer()->RemoveActor( _thresholdActor ); _actorPresent = false; - } + } } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h index d7c6cbc..29c8940 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/ThresholdImageView/LayerImageBase.h @@ -2,15 +2,15 @@ /** - * \file - * \brief Class ThresholdImageView . + * \file + * \brief Class ThresholdImageView . */ /** * \class ThresholdImageView - * \brief + * \brief */ - + #ifndef __LayerImageBase_h__ #define __LayerImageBase_h__ @@ -23,7 +23,7 @@ class LayerImageBase { - public: + public: LayerImageBase(); virtual ~LayerImageBase(); void SetZ(int z); @@ -36,6 +36,7 @@ class LayerImageBase void onThresholdChangeOpacity (int opacity); void onThresholdRemove(); wxVtkBaseView *GetwxVtkBaseView(); + void Refresh(); private: int _Z; -- 2.45.1