-window_sizes 1396 856 329 1061 729 70
+window_sizes 1075 856 201 868 729 70
diagrams
active classdiagram_ref 128002 // wxVtkViewer class Diagram 1
- 1058 709 100 4 98 0
+ 864 709 100 4 150 0
classdiagram_ref 128130 // wxVtkViewer class Diagram 2
- 870 691 100 4 9 0
+ 870 691 100 4 255 0
end
show_stereotypes
-selected classdiagram_ref 128130 // wxVtkViewer class Diagram 2
+selected classdiagram_ref 128002 // wxVtkViewer class Diagram 1
open
classview_ref 128002 // wxVtkViewer
end
FILE(GLOB ${LIBRARY_NAME}_HEADERS_CONTOUR "src/interface/wxWindows/Contour/*.h")
FILE(GLOB ${LIBRARY_NAME}_SOURCES_CONTOUR src/interface/wxWindows/Contour/*.cxx src/interface/wxWindows/Contour/*.cpp src/interface/wxWindows/Contour/*.cc)
+
+ FILE(GLOB ${LIBRARY_NAME}_HEADERS_ThresholdImageView "src/interface/wxWindows/widgets/ThresholdImageView/*.h")
+ FILE(GLOB ${LIBRARY_NAME}_SOURCES_ThresholdImageView src/interface/wxWindows/widgets/ThresholdImageView/*.cxx src/interface/wxWindows/widgets/ThresholdImageView/*.cpp src/interface/wxWindows/widgets/ThresholdImageView/*.cc)
FILE(GLOB ${LIBRARY_NAME}_HEADERS_WIDGETS "src/interface/wxWindows/widgets/*.h")
FILE(GLOB ${LIBRARY_NAME}_SOURCES_WIDGETS src/interface/wxWindows/widgets/*.cxx src/interface/wxWindows/widgets/*.cpp src/interface/wxWindows/widgets/*.cc)
SET ( ${LIBRARY_NAME}_HEADERS
- #src/interface/wxWindows/manualContour.h
- #src/interface/wxWindows/wxMaracasMPR.h
- #src/interface/wxWindows/wxMaracas_ManualTree_MPR.h
${${LIBRARY_NAME}_HEADERS_WXWIN}
- #src/interface/wxWindows/Contour/AutoControlPoints.h
- #src/interface/wxWindows/Contour/ContourCrownWidget.h
- #src/interface/wxWindows/Contour/ContourExtractData.h
- #src/interface/wxWindows/Contour/ContourPropagation.h
- #src/interface/wxWindows/Contour/contoursIntersection.h
- #src/interface/wxWindows/Contour/ContourVOIWidget.h
- #src/interface/wxWindows/Contour/ExtractControlPoints2D.h
- #src/interface/wxWindows/Contour/Propagation.h
- #src/interface/wxWindows/Contour/vectorFunctions.h
- ${${LIBRARY_NAME}_HEADERS_CONTOUR}
-## src/interface/wxWindows/wxMaracasImageBrowser02.h
-## src/interface/wxWindows/widgets/wxReadingPriorityPanel.h
- #src/interface/wxWindows/widgets/ContourView.h
- #src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.h
- #src/interface/wxWindows/widgets/LineView.h
- #src/interface/wxWindows/widgets/PointView.h
- #src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.h
- #src/interface/wxWindows/widgets/vtkClosePolyData.h
- #src/interface/wxWindows/widgets/wxMaracasIRMView.h
- #src/interface/wxWindows/widgets/wxMaracasIRMViewManager.h
- #src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.h
- #src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.h
- #src/interface/wxWindows/widgets/wxManualTree_MPRWidget.h
- #src/interface/wxWindows/widgets/wxMPRBaseData.h
- #src/interface/wxWindows/widgets/wxMPRWidget.h
- #src/interface/wxWindows/widgets/wxSTLWidget_03.h
- #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.h
- #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.h
- #src/interface/wxWindows/widgets/wxVtkBaseView.h
- ${${LIBRARY_NAME}_HEADERS_WIDGETS}
- #src/interface/wxWindows/widgets/pPlotter/Histogram.h
- #src/interface/wxWindows/widgets/pPlotter/HistogramDialog.h
- #src/interface/wxWindows/widgets/pPlotter/HistogramWidget.h
- #src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.h
- #src/interface/wxWindows/widgets/pPlotter/mBarRange.h
- #src/interface/wxWindows/widgets/pPlotter/mathplot.h
- #src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.h
- #src/interface/wxWindows/widgets/pPlotter/pColorBar.h
- #src/interface/wxWindows/widgets/pPlotter/pColorPoint.h
- #src/interface/wxWindows/widgets/pPlotter/pFigure.h
- #src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.h
- #src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.h
- #src/interface/wxWindows/widgets/pPlotter/pHistogram.h
- #src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.h
- #src/interface/wxWindows/widgets/pPlotter/pPlotter.h
- #src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.h
- #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.h
- #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.h
- #src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.h
- ${${LIBRARY_NAME}_HEADERS_PPLOTTER}
- ${${LIBRARY_NAME}_HEADERS_MANUAL_CONTOUR}
-
- include/matrix.h
-
- #src/kernel/marImageData.h
- #src/kernel/marDicomBase.h
- #src/kernel/marObject.h
- #src/kernel/volume.hxx
- #src/kernel/marTypes.h
- #src/kernel/marParameters.h
- #src/kernel/marDynData.h
- #src/kernel/creaMaracasVisu_EXPORT.h
- #src/kernel/vtkSTLExtractor.h
+ ${${LIBRARY_NAME}_HEADERS_CONTOUR}
+ ${${LIBRARY_NAME}_HEADERS_ThresholdImageView}
+ ${${LIBRARY_NAME}_HEADERS_WIDGETS}
+ ${${LIBRARY_NAME}_HEADERS_PPLOTTER}
+ ${${LIBRARY_NAME}_HEADERS_MANUAL_CONTOUR}
+ include/matrix.h
${${LIBRARY_NAME}_HEADERS_KERNEL}
)
#----------------------------------------------------------------------------
# OR MANUALLY LIST YOUR FILES WITH NEXT COMMAND (WITHOUT EXTENSION)
SET ( ${LIBRARY_NAME}_SOURCES
- #src/interface/wxWindows/manualContour.cpp
- #src/interface/wxWindows/wxMaracasMPR.cxx
- #src/interface/wxWindows/wxMaracas_ManualTree_MPR.cxx
${${LIBRARY_NAME}_SOURCES_WXWIN}
- #src/interface/wxWindows/Contour/AutoControlPoints.cxx
- #src/interface/wxWindows/Contour/ContourCrownWidget.cxx
- #src/interface/wxWindows/Contour/ContourExtractData.cxx
- #src/interface/wxWindows/Contour/ContourPropagation.cxx
- #src/interface/wxWindows/Contour/contoursIntersection.cxx
- #src/interface/wxWindows/Contour/ContourVOIWidget.cxx
- #src/interface/wxWindows/Contour/ExtractControlPoints2D.cxx
- #src/interface/wxWindows/Contour/Propagation.cxx
- #src/interface/wxWindows/Contour/vectorFunctions.cxx
- ${${LIBRARY_NAME}_SOURCES_CONTOUR}
-# src/interface/wxWindows/wxMaracasImageBrowser02.cxx
-# src/interface/wxWindows/widgets/wxReadingPriorityPanel.cpp
- #src/interface/wxWindows/widgets/ContourView.cxx
- #src/interface/wxWindows/widgets/InterfaceVtkPanelWidgets.cxx
- #src/interface/wxWindows/widgets/LineView.cxx
- #src/interface/wxWindows/widgets/PointView.cxx
- #src/interface/wxWindows/widgets/UtilVtk3DGeometriSelection.cxx
- #src/interface/wxWindows/widgets/vtkClosePolyData.cxx
- #src/interface/wxWindows/widgets/wxManualTree_MPRWidget.cxx
- #src/interface/wxWindows/widgets/wxMaracas_ViewerWidget.cxx
- #src/interface/wxWindows/widgets/wxMaracas_N_ViewersWidget.cxx
- #src/interface/wxWindows/widgets/wxMaracasIRMView.cxx
- #src/interface/wxWindows/widgets/wxMaracasIRMViewManager.cxx
- #src/interface/wxWindows/widgets/wxMPRWidget.cxx
- #src/interface/wxWindows/widgets/wxMPRBaseData.cxx
- #src/interface/wxWindows/widgets/wxSTLWidget_03.cxx
- #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractor.cxx
- #src/interface/wxWindows/widgets/wxVTKRenderWindowInteractorEditContour.cxx
- #src/interface/wxWindows/widgets/wxVtkBaseView.cxx
- ${${LIBRARY_NAME}_SOURCES_WIDGETS}
- #src/interface/wxWindows/widgets/pPlotter/Histogram.cxx
- #src/interface/wxWindows/widgets/pPlotter/HistogramDialog.cxx
- #src/interface/wxWindows/widgets/pPlotter/HistogramWidget.cxx
- #src/interface/wxWindows/widgets/pPlotter/LogicalColorBar.cxx
- #src/interface/wxWindows/widgets/pPlotter/mBarRange.cxx
- #src/interface/wxWindows/widgets/pPlotter/mathplot.cxx
- #src/interface/wxWindows/widgets/pPlotter/MaximumsDialog.cxx
- #src/interface/wxWindows/widgets/pPlotter/pColorBar.cxx
- #src/interface/wxWindows/widgets/pPlotter/pColorPoint.cxx
- #src/interface/wxWindows/widgets/pPlotter/pFigure.cxx
- #src/interface/wxWindows/widgets/pPlotter/pFunctionPoint.cxx
- #src/interface/wxWindows/widgets/pPlotter/pGraphicalFunction.cxx
- #src/interface/wxWindows/widgets/pPlotter/pHistogram.cxx
- #src/interface/wxWindows/widgets/pPlotter/pLogicalFunction.cxx
- #src/interface/wxWindows/widgets/pPlotter/pPlotter.cxx
- #src/interface/wxWindows/widgets/pPlotter/pPlotterLayer.cxx
- #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleX.cxx
- #src/interface/wxWindows/widgets/pPlotter/pPlotterScaleY.cxx
- #src/interface/wxWindows/widgets/pPlotter/pPlotterWindow.cxx
- ${${LIBRARY_NAME}_SOURCES_PPLOTTER}
- ${${LIBRARY_NAME}_SOURCES_MANUAL_CONTOUR}
-
-###
- #src/kernel/marImageData.cpp
- #src/kernel/marDicomBase.cpp
-# src/kernel/marGdcmDicom.cpp
- #src/kernel/marObject.cpp
- #src/kernel/volume.cxx
- #src/kernel/marParameters.cpp
- #src/kernel/marDynData.cpp
- #src/kernel/vtkSTLExtractor.cpp
+ ${${LIBRARY_NAME}_SOURCES_CONTOUR}
+ ${${LIBRARY_NAME}_SOURCES_ThresholdImageView}
+ ${${LIBRARY_NAME}_SOURCES_WIDGETS}
+ ${${LIBRARY_NAME}_SOURCES_PPLOTTER}
+ ${${LIBRARY_NAME}_SOURCES_MANUAL_CONTOUR}
${${LIBRARY_NAME}_SOURCES_KERNEL}
)
#----------------------------------------------------------------------------
}
+//------------------------------------------------------------------------
+void ContourExtractData::InitVolumeStatistics()
+{
+ vol_rCountRange = 0;
+ vol_rsize = 0;
+ vol_minValue = 9999999;
+ vol_maxValue =-9999999;
+ vol_acum_average = 0;
+ vol_acum_standardeviation = 0;
+}
+
+//------------------------------------------------------------------------
+void ContourExtractData::SetVolumeStatistics(int rCountRange,
+ int rsize,
+ double minValue,
+ double maxValue,
+ double acum_average,
+ double acum_standardeviation)
+{
+ vol_rCountRange = vol_rCountRange + rCountRange;
+ vol_rsize = vol_rsize + rsize;
+
+ if (minValue<vol_minValue){ vol_minValue = minValue; }
+ if (maxValue>vol_maxValue){ vol_maxValue = maxValue; }
+
+ vol_acum_average = vol_acum_average + acum_average;
+ vol_acum_standardeviation = vol_acum_standardeviation + acum_standardeviation;
+}
+
+//------------------------------------------------------------------------
+void ContourExtractData::GetVolumeStatistics(int *vol_rCountRange,
+ int *vol_rsize,
+ double *vol_minValue,
+ double *vol_maxValue,
+ double *vol_average,
+ double *vol_standardeviation)
+{
+ *vol_rCountRange = this->vol_rCountRange;
+ *vol_rsize = this->vol_rsize;
+ *vol_minValue = this->vol_minValue;
+ *vol_maxValue = this->vol_maxValue;
+ *vol_average = this->vol_acum_average / this->vol_rsize;
+ *vol_standardeviation = sqrt(this->vol_acum_standardeviation / this->vol_rsize);
+}
+
//------------------------------------------------------------------------
void ContourExtractData::Statistics( std::vector<double> *inputLstValue,
double *rmin,
double *rmax,
double *raverage,
- double *rstandardeviation)
+ double *rstandardeviation
+ )
{
- double min = 0;
- double max = 0;
- double average = 0;
- double standardeviation = 0;
- double acum = 0;
- int size = 0;
- int countRange = 0;
+ double min = 0;
+ double max = 0;
+ double average = 0;
+ double standardeviation = 0;
+ double acum_average = 0;
+ double acum_standardeviation = 0;
+ int size = 0;
+ int countRange = 0;
double ng;
if (inputLstValue!=NULL)
for ( i=0; i<size; i++ )
{
ng=(*inputLstValue)[i];
- acum = acum + ng;
+ acum_average = acum_average + ng;
if (max<ng) max=ng; // Max
if (min>ng) min=ng; // Min
if ((ng>=grayRangeMin) && (ng<=grayRangeMax)) countRange++; // countRange
- }
- average = acum / size;
+ } // for average
+ average = acum_average / size;
// Standar Deviation
- acum=0;
+ acum_standardeviation=0;
double tmp;
for ( i=0; i<size; i++ )
{
tmp = (*inputLstValue)[i] - average;
- acum = acum + tmp*tmp;
- }
- standardeviation = sqrt(acum/size);
-
- }
- }
+ acum_standardeviation = acum_standardeviation + tmp*tmp;
+ } // for standar deviation
+ standardeviation = sqrt(acum_standardeviation/size);
+ SetVolumeStatistics(countRange, size,
+ min,max,
+ acum_average,acum_standardeviation);
+ } // if size
+ } // if NULL
// OUTPUT
*rsize = size;
double *rstandardeviation);
void SetTypeOperation(int type);
+ //--Volume Statistics--
+ void InitVolumeStatistics();
+ void GetVolumeStatistics(int *vol_rCountRange, int *vol_rsize,
+ double *vol_minValue, double *vol_maxValue,
+ double *vol_average, double *vol_standardeviation);
+
+
+
private:
bool okImagesResults;
std::vector<manualContourModel*> lstManConMod;
void InitVtkImagesResult();
+ //--Volume Statistics--
+ int vol_rCountRange;
+ int vol_rsize;
+ double vol_minValue;
+ double vol_maxValue;
+ double vol_acum_average;
+ double vol_acum_standardeviation;
+ void SetVolumeStatistics(int rCountRange, int rsize,
+ double minValue,double maxValue,
+ double acum_average, double acum_standardeviation);
+
};
--- /dev/null
+
+/**
+ * \file
+ * \brief Class bbtk::ThresholdImageView .
+ */
+
+
+#include "ThresholdImageView.h"
+
+
+
+ //=========================================================================
+ ThresholdImageView::ThresholdImageView( )
+ {
+ _actorPresent = false;
+ }
+
+ //=========================================================================
+ ThresholdImageView::~ThresholdImageView()
+ {
+ }
+ //=========================================================================
+
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::SetImage(vtkImageData* image)
+{
+ _image = image;
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::SetwxVtkBaseView(wxVtkBaseView *baseview)
+{
+ _baseView = baseview;
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::SetZ(int z)
+{
+ _Z = z;
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::SetminMax(int min, int max)
+{
+ _min = min;
+ _max = max;
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::onThreshold()
+{
+ int z = _Z;
+ double range[2];
+
+ vtkImageData *img = _image;
+ img->GetScalarRange(range);
+
+ int minTot = floor (range[0]);
+ int maxTot = ceil (range[1]);
+
+//EED _pannew->onThresholdInstantChange(minMax);
+
+ int minVal = floor (_min);
+ int maxVal = floor (_max);
+
+ if (!_actorPresent)
+ {
+ if (_imageReslicer==NULL)
+ {
+ _imageReslicer = vtkImageReslice::New();
+ _imageReslicer->SetInput( img );
+ _imageReslicer->SetInformationInput(img);
+ _imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
+ _imageReslicer->SetOutputDimensionality(2);
+ _imageReslicer->SetInterpolationModeToLinear();
+ }
+
+ _imageReslicer->SetResliceAxesOrigin(0,0,z);
+
+ img = _imageReslicer->GetOutput();
+ img->Update();
+ img->UpdateInformation();
+
+ wxVtkBaseView *baseView = _baseView;
+
+ if (_thresholdTable==NULL)
+ {
+ //Lookup Table
+ _thresholdTable = vtkLookupTable::New();
+ _thresholdTable->SetNumberOfTableValues(maxTot+1);
+ _thresholdTable->SetTableRange(range);
+ _thresholdTable->SetAlphaRange(0, 1);
+ _thresholdTable->SetValueRange(0, 1);
+ _thresholdTable->SetSaturationRange(0, 0);
+ _thresholdTable->SetRampToLinear( );
+ }
+
+ //Assign a fake color for the upper image, and set the white as transparent
+ int i;
+ for(i = minTot; i <= maxTot; i++)
+ {
+ if( i >= minVal && i <= maxVal )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 0.0, 0.0, 1);
+ }
+ else if( i >= minTot && i < minVal )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ else if( i > maxVal && i < maxTot )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ else
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ }
+ _thresholdTable->Build( );
+
+ if (_thresholdMapper==NULL)
+ {
+ _thresholdMapper = vtkImageMapToColors::New( );
+ }
+
+ _thresholdMapper->SetLookupTable( _thresholdTable );
+ _thresholdMapper->SetInput( img );
+
+ if (_thresholdActor==NULL)
+ {
+ _thresholdActor = vtkImageActor::New( );
+ _thresholdActor->SetOpacity( 0.6 );
+ _thresholdActor->InterpolateOn( );
+ _thresholdActor->SetPosition( 0,0, 900-1 );
+ }
+
+ _thresholdActor->SetInput( _thresholdMapper->GetOutput() );
+
+ baseView->GetRenderer()->AddActor( _thresholdActor );
+ _actorPresent = true;
+ }
+
+ else
+ {
+ _imageReslicer->SetResliceAxesOrigin(0,0,z);
+ img = _imageReslicer->GetOutput();
+ img->Update();
+ img->UpdateInformation();
+
+ //Assign a fake color for the upper image, and set the white as transparent
+ int i;
+ for(i = minTot; i <= maxTot; i++)
+ {
+ if( i >= minVal && i <= maxVal )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 0.0, 0.0, 1);
+ }
+ else if( i >= minTot && i < minVal )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ else if( i > maxVal && i < maxTot )
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ else
+ {
+ _thresholdTable->SetTableValue(i, 1.0, 1.0, 1.0, 0); //transparent
+ }
+ }
+
+ _thresholdTable->Build( );
+ _thresholdMapper->SetLookupTable( _thresholdTable );
+ _thresholdMapper->SetInput( img );
+ _thresholdActor->SetInput( _thresholdMapper->GetOutput() );
+ }
+ /*
+ vtkImageViewer2* viewer = vtkImageViewer2::New();
+ viewer->SetInput( upperImageActor->GetInput() );
+ viewer->SetColorLevel((range[1]-range[0])/2);
+ viewer->SetColorWindow(range[1]);
+ viewer->GetRenderer()->AddActor( upperImageActor );
+ viewer->Render();
+ */
+//EED _theViewPanel->RefreshInterface();
+}
+
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::onThresholdChange()
+{
+ if (_actorPresent)
+ {
+ onThreshold();
+ }
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::onThresholdInterpolation(bool interpolate)
+{
+ if (_thresholdActor!=NULL)
+ {
+ if (interpolate)
+ {
+ _thresholdActor->InterpolateOn( );
+ }
+
+ else
+ {
+ _thresholdActor->InterpolateOff( );
+ }
+
+//EED _theViewPanel->RefreshInterface();
+ }
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::onThresholdChangeOpacity (int opacity)
+{
+ if (_actorPresent)
+ {
+ _thresholdActor->SetOpacity(opacity*0.1);
+ }
+
+//EED _theViewPanel->RefreshInterface();
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageView::onThresholdRemove()
+{
+ if (_actorPresent)
+ {
+ wxVtkBaseView * baseView = _baseView;
+ baseView->GetRenderer()->RemoveActor( _thresholdActor );
+ _actorPresent = false;
+ }
+
+//EED _theViewPanel->RefreshInterface();
+}
+
+
+
+
+// EOF
+
--- /dev/null
+
+
+
+/**
+ * \file
+ * \brief Class ThresholdImageView .
+ */
+
+/**
+ * \class ThresholdImageView
+ * \brief
+ */
+
+#ifndef __ThresholdImageView_h__
+#define __ThresholdImageView_h__
+
+#include <vtkImageReslice.h>
+#include <vtkLookupTable.h>
+#include <vtkImageMapToColors.h>
+#include <vtkImageActor.h>
+#include <vtkImageData.h>
+#include "wxVtkBaseView.h"
+
+
+
+class ThresholdImageView
+ {
+ public:
+ ThresholdImageView( );
+ ~ThresholdImageView();
+ void onThreshold();
+ void onThresholdChange();
+ void onThresholdInterpolation(bool interpolate);
+ void onThresholdChangeOpacity (int opacity);
+ void onThresholdRemove();
+
+ void SetImage(vtkImageData* image);
+ void SetwxVtkBaseView(wxVtkBaseView *baseview);
+
+ void SetZ(int z);
+ void SetminMax(int min, int max);
+
+ private:
+ int _Z;
+ double _min;
+ double _max;
+ bool _actorPresent;
+ vtkImageData *_image;
+ vtkImageReslice *_imageReslicer;
+ vtkLookupTable *_thresholdTable;
+ vtkImageMapToColors *_thresholdMapper;
+ vtkImageActor *_thresholdActor;
+ wxVtkBaseView *_baseView;
+ protected:
+ };
+
+#endif
+
--- /dev/null
+
+
+/**
+ * \file
+ * \brief ClassThresholdImageViewPanel .
+ */
+
+
+#include "ThresholdImageViewPanel.h"
+
+
+
+/**
+ ** Begin of the threshold panel
+ **/
+ThresholdImageViewPanel::ThresholdImageViewPanel(wxWindow* parent)
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+{
+ _thresholdImageView = new ThresholdImageView();
+
+ wxButton *thresholdGoBtn = new wxButton(this,wxID_ANY,_T("Show/Hide Color"), wxDefaultPosition, wxSize(200,30) );
+ _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
+ _interpolationCheckBox->SetValue(true);
+ _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _thresholdGo = false;
+
+ double range[2];
+// interfMainPanel::getInstance()->getImageRange(range);
+
+ int min = (int)floor (range[0]);
+ int max = (int)ceil (range[1]);
+
+ _mBarThreshold = new mBarRange(this,70,65);
+ _mBarThreshold->SetMin(0);
+ _mBarThreshold->SetStart(0);
+ _mBarThreshold-> SetOrientation( true );
+ _mBarThreshold-> setActiveStateTo(true);
+ _mBarThreshold-> setVisibleLabels( true );
+ _mBarThreshold-> setDeviceEndMargin(10);
+ _mBarThreshold-> setRepresentedValues( min , max );
+ _mBarThreshold-> setDeviceBlitStart(10,10);
+ _mBarThreshold-> setIfWithActualDrawed( false );
+ _mBarThreshold-> SetStart( min );
+ _mBarThreshold-> SetEnd( max );
+
+ Connect( thresholdGoBtn->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ThresholdImageViewPanel::onThresholdGo );
+ Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ThresholdImageViewPanel::onThresholdInterpolation );
+
+ wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
+ sizer -> Add( new wxStaticText(this,-1,_T("Image Threshold")) , 1, wxGROW );
+ sizer -> Add( _mBarThreshold, 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxGROW );
+ sizer -> Add( _opacity, 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( thresholdGoBtn, 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( _interpolationCheckBox, 1, wxGROW );
+
+ this->SetSizer( sizer );
+ this->SetAutoLayout( true );
+ this->Layout();
+}
+
+//----------------------------------------------------------------------------
+ThresholdImageViewPanel::~ThresholdImageViewPanel(){
+}
+
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::SetThresholdImageView(ThresholdImageView* thresholdImageView)
+{
+ _thresholdImageView = thresholdImageView;
+}
+
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onThresholdChange(wxCommandEvent& event)
+{
+ if (_thresholdGo)
+ {
+ _thresholdImageView->onThresholdChange();
+
+ //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
+ }
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onThresholdGo(wxCommandEvent& event)
+{
+ if (!_thresholdGo)
+ {
+ _thresholdImageView->onThreshold();
+ _thresholdGo=true;
+ }
+ else
+ {
+ _thresholdImageView->onThresholdRemove( );
+ _thresholdGo=false;
+ }
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onThresholdStop()
+{
+ if (_thresholdGo)
+ {
+ _thresholdImageView->onThresholdRemove( );
+ _thresholdGo=false;
+ }
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onThresholdInstantChange(double range[])
+{
+ range[0] = _mBarThreshold->GetStart();
+ range[1] = _mBarThreshold->GetEnd();
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
+{
+ _thresholdImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+}
+
+//----------------------------------------------------------------------------
+void ThresholdImageViewPanel::onChangeOpacity(wxScrollEvent& event)
+{
+ int opacity = _opacity->GetValue();
+ _thresholdImageView->onThresholdChangeOpacity(opacity);
+}
+
+
+
+BEGIN_EVENT_TABLE(ThresholdImageViewPanel, wxPanel)
+ EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_START, ThresholdImageViewPanel::onThresholdChange)
+ EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_END, ThresholdImageViewPanel::onThresholdChange)
+ EVT_COMMAND(wxID_ANY, wxEVT_TSBAR_MOVED, ThresholdImageViewPanel::onThresholdChange)
+ EVT_SCROLL(ThresholdImageViewPanel::onChangeOpacity)
+END_EVENT_TABLE()
+
+
+
+// EOF
+
--- /dev/null
+
+
+/**
+ * \file
+ * \brief Class ThresholdImageViewPanel .
+ */
+
+/**
+ * \class ThresholdImageViewPanel
+ * \brief
+ */
+
+#ifndef __ThresholdImageViewPanel_h__
+#define __ThresholdImageViewPanel_h__
+
+
+#include <wx/wx.h>
+#include "mBarRange.h"
+#include "ThresholdImageView.h"
+
+
+ class ThresholdImageViewPanel
+ : public wxPanel
+ {
+ public:
+ ThresholdImageViewPanel(wxWindow * parent);
+ ~ThresholdImageViewPanel();
+ void onThresholdStop();
+ void onThresholdInstantChange(double range[]);
+ void SetThresholdImageView(ThresholdImageView* thresholdImageView);
+
+ private:
+
+ bool _thresholdGo;
+ ThresholdImageView *_thresholdImageView;
+ mBarRange *_mBarThreshold;
+ wxSlider *_opacity;
+ wxCheckBox *_interpolationCheckBox;
+
+ void onThresholdChange(wxCommandEvent& event);
+ void onThresholdGo(wxCommandEvent& event);
+ void onThresholdInterpolation(wxCommandEvent& event);
+ void onChangeOpacity(wxScrollEvent& event);
+
+ DECLARE_EVENT_TABLE()
+ };
+
+
+
+
+#endif
+