AUTHOR:Author ??
COMPLEXBOX:FALSE
COMPLEXINPUTS:0
-BOXES:4
+BOXES:6
BOX
creaMaracasVisu:ColorLayerImageView:Box00
ISEXEC:FALSE
-9.331188:14.886552:-900.000000
-80.506188:4.886552:-900.000000
+7.671083:-44.550001:-900.000000
+78.846083:-54.550001:-900.000000
PORT
PlainOrGradientColor:"false"
PORT
-lstBaseColor:"0 1 0 1 1 0 1 0 0"
+lstBaseColor:"1 0 0 0 1 0 0 0 1"
PORT
-lstGreyLevelBoundaries:"500 1200 1600 3000"
+lstGreyLevelBoundaries:"500 1200 1600 4500"
FIN_BOX
BOX
vtk:LoadHola:Box01
ISEXEC:FALSE
-56.503805:75.675326:-900.000000
-102.078805:65.675326:-900.000000
+-3.363737:85.532200:-900.000000
+42.211263:75.532200:-900.000000
FIN_BOX
BOX
creaMaracasVisu:ViewerNV:Box02
ISEXEC:FALSE
--9.147294:53.441356:-900.000000
-51.492706:43.441356:-900.000000
+-67.858344:3.600307:-900.000000
+-7.218344:-6.399693:-900.000000
FIN_BOX
BOX
wx:LayoutSplit:Box03
ISEXEC:TRUE
--18.080640:-21.963529:-900.000000
-27.494360:-31.963529:-900.000000
+-71.344676:-67.998280:-900.000000
+-25.769676:-77.998280:-900.000000
PORT
Orientation:"H"
FIN_BOX
-CONNECTIONS:7
-CONNECTION
-Box01:Out:Box00:In
-NumberOfControlPoints:0
-CONNECTION
-Box01:Out:Box02:In
-NumberOfControlPoints:0
+BOX
+vtk:vtkImageDataPointerRelay:Box04
+ISEXEC:FALSE
+-18.752005:31.893173:-900.000000
+52.422995:21.893173:-900.000000
+FIN_BOX
+BOX
+vtk:RescaleSlopeIntercept:Box05
+ISEXEC:FALSE
+0.147654:67.034726:-900.000000
+71.322654:57.034726:-900.000000
+PORT
+A:"0"
+PORT
+B:"1"
+PORT
+OutputFormat:"VTK_FLOAT"
+PORT
+Type:"2"
+FIN_BOX
+CONNECTIONS:9
CONNECTION
Box02:wxVtkBaseView2:Box00:WxVtkBaseView
NumberOfControlPoints:0
CONNECTION
Box02:Widget:Box03:Widget2
NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box02:In
+NumberOfControlPoints:0
+CONNECTION
+Box04:Out:Box00:In
+NumberOfControlPoints:0
+CONNECTION
+Box01:Out:Box05:In
+NumberOfControlPoints:0
+CONNECTION
+Box05:Out:Box04:In
+NumberOfControlPoints:0
APP_END
new ColorLayerImageView Box00
set Box00.PlainOrGradientColor "false"
- set Box00.lstBaseColor "0 1 0 1 1 0 1 0 0"
- set Box00.lstGreyLevelBoundaries "500 1200 1600 3000"
+ set Box00.lstBaseColor "1 0 0 0 1 0 0 0 1"
+ set Box00.lstGreyLevelBoundaries "500 1200 1600 4500"
new LoadHola Box01
new LayoutSplit Box03
set Box03.Orientation "H"
+new vtkImageDataPointerRelay Box04
-connect Box01.Out Box00.In
+new RescaleSlopeIntercept Box05
+ set Box05.A "0"
+ set Box05.B "1"
+ set Box05.OutputFormat "VTK_FLOAT"
+ set Box05.Type "2"
-connect Box01.Out Box02.In
connect Box02.wxVtkBaseView2 Box00.WxVtkBaseView
connect Box02.Widget Box03.Widget2
+connect Box04.Out Box02.In
+
+connect Box04.Out Box00.In
+
+connect Box01.Out Box05.In
+
+connect Box05.Out Box04.In
+
# Complex input ports
void onEndChange_Bar(wxCommandEvent& event);
void onSelectionEnd(wxCommandEvent& event);
void onMovedBar(wxCommandEvent& event);
- void PushEventHandler();
+ void PushEventHandler();
private:
//=========================================================================
ColorLayerImageView::ColorLayerImageView( )
{
- _z2 = 0;
- _fix_dynamic = true;
- _color_type = false;
+ _z2 = 0;
+ _fix_dynamic = true;
+ _color_type = false;
}
//=========================================================================
// By default, the histogram is split into BaseColorNb areas of equal width.
double delta = (maxTot - minTot)/GetBaseColorNb();
for (int i = 1; i <= GetBaseColorNb() ; i ++)
- {
- _grey_level_boundary.push_back((double)minTot + i * delta);
- }
+ {
+ _grey_level_boundary.push_back((double)minTot + i * delta);
+ }
}
//----------------------------------------------------------------------------
// CM
// Grey level extrema retrieved from the image grey level extrema.
-/*
-printf("ERROR: EED ColorLayerImageView::ConfigLookupTable ------_range----------------\n");
- _range[0]=0;
- _range[1]=4000;
-*/
+
GetImage()->GetScalarRange(_range);
+
+
// ------------------ Setting Default Values
// Checks the size consistency of vectors _base_color and _grey_level_boundary.
// In case of inconsistency, an exception should be thrown. Instead, the default values are set.
thresholdTable->SetTableRange(thresholdTable_range);
thresholdTable->SetAlphaRange(0, 1);
thresholdTable->SetValueRange(0, 1);
+
+
thresholdTable->SetSaturationRange(0, 0);
thresholdTable->SetRampToLinear( );
}
}
} // End Of if (!_color_type)
+
+
+ thresholdTable->SetRange(_range[0], _range[1]); // image intensity range
+ thresholdTable->SetValueRange(0.0, 1.0); // from black to white
+
+
thresholdTable->Build( );
+
+
+
+/*
+// Create a greyscale lookup table
+ vtkLookupTable* thresholdTable = GetThresholdTable();
+ thresholdTable->SetRange(0.5, 0.75); // image intensity range
+ thresholdTable->SetValueRange(0.0, 1); // from black to white
+ thresholdTable->SetHueRange(0.0, 1.0); // from black to white
+ thresholdTable->SetSaturationRange(0.0, 1.0); // no color saturation
+ thresholdTable->SetRampToLinear();
+ thresholdTable->Build();
+*/
+
// ------------------ End Of Defining the Threshold Table
//EO CM
void wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(wxWindow *parent , wxString message,int &typeOfTransformation,bool &dlgWxOK)
{
- wxDialog* dial = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
+ wxDialog* dial = new wxDialog (parent,-1,_T("Tools"),wxDefaultPosition, wxSize(590,190));
wxSizer* buttonsSizer = dial->CreateSeparatedButtonSizer(wxOK|wxCANCEL);
wxBoxSizer *dialSizer = new wxBoxSizer(wxVERTICAL);
** Begin of the threshold panel
**/
ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
+: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
{
printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel start \n");
_sl_SliceImageX->Enable(false);
_sl_SliceImageY->Enable(false);
_sl_SliceImageZ->Enable(false);
-
_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);
+ _histogram = new Histogram( this , -1, wxPoint(0,0), wxSize(400,400), /*wxNO_BORDER*/ wxBORDER_DEFAULT );
+ _histogramMinMaxLevel = new HistogramMinMaxLevel( (HistogramBase*)_histogram );
+
if (type==0)
{
}
Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageX->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageY->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
-
-
+ Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
if (type==1)
{
- sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer")) , 1, wxGROW );
- sizer -> Add( _btn_ReadImage, 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer")) , 1, wxGROW );
+ sizer -> Add( _btn_ReadImage , 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( _cb_ShowHide, 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
- sizer -> Add( _interpolationCheckBox, 1, wxGROW );
-
- sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
- sizer -> Add( new wxStaticText(this,-1,_T("Slice ")) , 1, wxGROW );
- sizer -> Add( _sl_SliceImageX, 1, wxGROW );
- sizer -> Add( _sl_SliceImageY, 1, wxGROW );
- sizer -> Add( _sl_SliceImageZ, 1, wxGROW );
- sizer -> Add( _cb_SliceFixDinamic, 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( _cb_ShowHide , 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( _interpolationCheckBox , 1, wxGROW );
+
+ sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
+ sizer -> Add( new wxStaticText(this,-1,_T("Slice ")) , 1, wxGROW );
+ sizer -> Add( _sl_SliceImageX , 1, wxGROW );
+ sizer -> Add( _sl_SliceImageY , 1, wxGROW );
+ sizer -> Add( _sl_SliceImageZ , 1, wxGROW );
+ sizer -> Add( _cb_SliceFixDinamic , 1, wxGROW );
+ sizer -> Add( _histogramMinMaxLevel->GetWindow() , 1, wxGROW );
this->SetSizer( sizer );
this->SetAutoLayout( true );
{
if (img!=NULL)
{
+ _histogramMinMaxLevel->Configure( img );
_colorLayerImageViewManager->SetImage( img );
double spc[3];
if (_active==true)
{
_colorLayerImageViewManager->onThreshold();
- RefreshView();
+ RefreshView();
}
//EED01 }
//EED01 if (_colorLayerImageView!=NULL)
//EED01 {
//EED01 _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
- _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+ _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
RefreshView();
//EED01 }//_colorLayerImageView
}
#include <wx/wx.h>
#include <wx/button.h>
#include "ColorLayerImageViewManager.h"
+#include "Histogram.h"
+#include "HistogramBase.h"
-
+// Borrame
+// #include "mBarRange2.h"
//-----------------------------------------------------
void SetOriginalSpacing(double spc[3]);
void SetImage(vtkImageData *img);
void SetFittingMode(int fitting_mode);
- int GetFittingMode();
+ int GetFittingMode();
void SetActive(bool active);
private:
bool _active;
int _fitting_mode;
-
int _dimBase[3];
double _spcBase[3];
double _spcOrg[3];
-
bool _thresholdGo;
ColorLayerImageViewManager *_colorLayerImageViewManager;
-// ColorLayerImageView *_colorLayerImageView;
- wxButton *_btn_ReadImage;
- wxSlider *_opacity;
- wxCheckBox *_interpolationCheckBox;
- wxCheckBox *_cb_ShowHide;
- wxCheckBox *_cb_SliceFixDinamic;
- wxSlider *_sl_SliceImageX;
- wxSlider *_sl_SliceImageY;
- wxSlider *_sl_SliceImageZ;
+ wxButton *_btn_ReadImage;
+ wxSlider *_opacity;
+ wxCheckBox *_interpolationCheckBox;
+ wxCheckBox *_cb_ShowHide;
+ wxCheckBox *_cb_SliceFixDinamic;
+ wxSlider *_sl_SliceImageX;
+ wxSlider *_sl_SliceImageY;
+ wxSlider *_sl_SliceImageZ;
+
+//Borrame
+// mBarRange2 *_barrange2;
+ Histogram* _histogram;
+ HistogramMinMaxLevel* _histogramMinMaxLevel;
+
void onReadImage(wxCommandEvent& event);
void onThresholdChange(wxCommandEvent& event);
void onThresholdShow(wxCommandEvent& event);
void onChangeOpacity(wxScrollEvent& event);
void onSliceFixDinamic(wxCommandEvent& event);
void onSliceImage(wxScrollEvent& event);
-
void RefreshView();
-
-
};
#endif
void LayerImageBase::SetImage(vtkImageData* image)
{
_image = image;
+ double spc[3];
+ _image->GetSpacing(spc);
+ int ext[6];
+ _image->GetWholeExtent(ext);
+ int sx=ext[1]-ext[0]+1;
+ int sy=ext[3]-ext[2]+1;
+ int sz=ext[5]-ext[4]+1;
+ int ssx=(sx/2)*spc[0];
+ int ssy=(sy/2)*spc[1];
+ int ssz=(sz/2)*spc[2];
+ SetX( ssx );
+ SetY( ssy );
+ SetZ( ssz );
+ _image = image;
}
//----------------------------------------------------------------------------
if (_baseView==NULL)
{
_baseView = baseview;
-// Old EED 2014 11 13
-// vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
-// isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
-
ColorLayerObserver *colorlayerobserver = ColorLayerObserver::New();
_baseView->GetVtkBaseData()->AddObserver( 1, colorlayerobserver );
colorlayerobserver->SetLayerImageBase(this);
vtkScalarBarActor *_scalarbarActor;
- virtual void ConfigLookupTable() = 0;
- void CleanXYZ(double &x, double &y, double &z);
+ virtual void ConfigLookupTable() = 0;
+ void CleanXYZ(double &x, double &y, double &z);
protected:
- vtkLookupTable* GetThresholdTable();
- vtkImageData* GetImage();
+ vtkLookupTable *GetThresholdTable();
+ vtkImageData *GetImage();
};
}
- void Histogram::Configure(vtkImageData* imageData)
+ void Histogram::Configure(vtkImageData* imageData)
{
histogram= new pHistogram(imageData);
drawHistogram();
int scrX,scrY;
GetClientSize(&scrX,&scrY);
plotter->SetSize(scrX,scrY);
+
/*
pGraphicalFunction* actual=plotter->getFunction(idTransferenceFunction);
actual->setScreens(scrX,scrY);
return histogramSize;
}
+ wxWindow* Histogram::GetWindow()
+ {
+ return this;
+ }
+
+ pPlotterWindow* Histogram::GetPlotterWindow()
+ {
+ return plotter;
+ }
+
+
#include <wx/wx.h>
#endif
+#include "HistogramBase.h"
#include "marTypes.h"
#include "pPlotterWindow.h"
#include "pFunctionPoint.h"
-#include "vtkImageData.h"
+#include "vtkImageData.h"
#include "pHistogram.h"
#include "pPlotterScaleY.h"
#include "pPlotterScaleX.h"
#define NUM_POINTS 100
#define WINDOW_SIZE 10
-class creaMaracasVisu_EXPORT Histogram:public wxPanel
+class creaMaracasVisu_EXPORT Histogram:public wxPanel, HistogramBase
{
public:
//---------------------
*/
int getHistogramPoint(int gValue);
int getHistogramSize();
- void Configure(vtkImageData* imageData);
-
+ pPlotterWindow* GetPlotterWindow();
+ virtual void Configure(vtkImageData* imageData);
+ virtual wxWindow* GetWindow();
+
private:
pHistogram* histogram;
pPlotterWindow* plotter;
- int histogramSize;
- int idHistogram;
+ int histogramSize;
+ int idHistogram;
DECLARE_CLASS(Histogram);
--- /dev/null
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+
+#include "HistogramBase.h"
+
+// -- inluces for HistogramMinMaxLevel
+#include "pPlotterWindow.h"
+#include "Histogram.h"
+
+
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+ HistogramBase::HistogramBase()
+ {
+ }
+
+//-----------------------------------------------------------------------------
+ HistogramBase::~HistogramBase()
+ {
+ }
+
+//-----------------------------------------------------------------------------
+ HistogramBase* HistogramBase::GetConcretComponent()
+ {
+ return this;
+ }
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+ HistogramDecorator::HistogramDecorator()
+ {
+ }
+
+//-----------------------------------------------------------------------------
+ HistogramDecorator::~HistogramDecorator()
+ {
+ }
+
+//-----------------------------------------------------------------------------
+ HistogramBase* HistogramDecorator::GetConcretComponent()
+ {
+ return _histogrambase->GetConcretComponent();
+ }
+
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+ HistogramMinMaxLevel::HistogramMinMaxLevel(HistogramBase* histogrambase)
+ {
+ _histogrambase = histogrambase;
+ wxWindow *histogramebasePanel =_histogrambase->GetWindow();
+ wxPanel *panel = new wxPanel( histogramebasePanel->GetParent() , -1, wxDefaultPosition, wxSize(600,600) );
+ histogramebasePanel->Reparent(panel);
+ _barrange2 = new mBarRange2(panel, 30, 20);
+ _barrange2->PushEventHandler((wxEvtHandler*)this);
+ Connect(_barrange2->GetId(), wxEVT_BarRange2_Change ,
+ (wxObjectEventFunction) (wxCommandEventFunction) &HistogramMinMaxLevel::onBarRangeChange );
+ wxFlexGridSizer* sizer = new wxFlexGridSizer(1);
+ sizer->Add( histogramebasePanel , 1, wxGROW );
+ sizer->Add( _barrange2 , 1, wxGROW );
+ panel->SetSizer( sizer );
+ panel->SetAutoLayout( true );
+ panel->Layout();
+ _panel = panel;
+ }
+
+//-----------------------------------------------------------------------------
+ HistogramMinMaxLevel::~HistogramMinMaxLevel()
+ {
+ }
+
+//-----------------------------------------------------------------------------
+ wxWindow* HistogramMinMaxLevel::GetWindow()
+ {
+ return _panel;
+ }
+
+//-----------------------------------------------------------------------------
+ void HistogramMinMaxLevel::Configure(vtkImageData* img)
+ {
+ _histogrambase->Configure(img);
+ double range[2];
+ img->GetScalarRange(range);
+ _barrange2->SetScalarType( img->GetScalarType() );
+ _barrange2->SetMinMaxValue(range[0],range[1]);
+ }
+
+//-----------------------------------------------------------------------------
+void HistogramMinMaxLevel::onBarRangeChange(wxCommandEvent& event)
+{
+ printf ("EED HistogramMinMaxLevel::onBarrangeChange\n");
+ Histogram* histogram = (Histogram*)GetConcretComponent();
+ pPlotterWindow* plotterwindow = histogram->GetPlotterWindow();
+
+ plotterwindow->setLineGuidesCondition(true);
+ double startvalue = _barrange2->GetStartValue();
+ plotterwindow->setRealGuideX( startvalue*100 );
+ plotterwindow->setRealGuideY( startvalue*100 );
+
+ if (plotterwindow->drawGuideLines()==true)
+ {
+ printf ("YES \n");
+ } else {
+ printf ("NO \n");
+ }
+
+ plotterwindow->UpdateAll();
+
+}
+
+
+
+
--- /dev/null
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+#ifndef __HISTOGRAMBASE__
+#define __HISTOGRAMBASE__
+
+
+// ----------------------------------------------------------------------------
+// wx headers inclusion.
+// For compilers that support precompilation, includes <wx/wx.h>.
+// ----------------------------------------------------------------------------
+#include <wx/wxprec.h>
+#ifdef __BORLANDC__
+#pragma hdrstop
+#endif
+#ifndef WX_PRECOMP
+#include <wx/wx.h>
+#endif
+
+#include "marTypes.h"
+#include "vtkImageData.h"
+#include "mBarRange2.h"
+
+
+class creaMaracasVisu_EXPORT HistogramBase
+{
+public:
+ //---------------------
+ // Constructor
+ //----------------------
+ HistogramBase();
+ ~HistogramBase();
+ virtual wxWindow* GetWindow() = 0;
+ virtual void Configure(vtkImageData*) = 0;
+ virtual HistogramBase* GetConcretComponent();
+private:
+protected:
+};
+
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class creaMaracasVisu_EXPORT HistogramDecorator:public HistogramBase
+{
+public:
+ HistogramDecorator();
+ ~HistogramDecorator();
+ virtual wxWindow* GetWindow() = 0;
+ virtual void Configure(vtkImageData*) = 0;
+ virtual HistogramBase* GetConcretComponent();
+private:
+protected:
+ HistogramBase* _histogrambase;
+};
+
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+class creaMaracasVisu_EXPORT HistogramMinMaxLevel:public HistogramDecorator, wxEvtHandler
+{
+public:
+ //---------------------
+ // Constructor
+ //----------------------
+ HistogramMinMaxLevel(HistogramBase* histogrambase);
+ ~HistogramMinMaxLevel();
+ virtual wxWindow* GetWindow();
+ virtual void Configure(vtkImageData*);
+ void onBarRangeChange(wxCommandEvent& event);
+
+private:
+ wxPanel* _panel;
+ mBarRange2* _barrange2;
+protected:
+};
+
+
+#endif // __HISTOGRAMBASE__
+
+
plotter->setType(2);
//setting the popMenu
plotter->setPopUpMenu(true,true,true,true,true,true,false,false,false,false,false,false,false);
- histogramSize=0;
- idTransferenceFunction=-1;
- idHistogram=-1;
- transferenceFunctionHasColor=true;
- transferenceFunctionHasPoints=true;
+ histogramSize = 0;
+ idTransferenceFunction = -1;
+ idHistogram = -1;
+ transferenceFunctionHasColor = true;
+ transferenceFunctionHasPoints = true;
this->type=type;
this->SetAutoLayout(true);
//drawing
drawHistogram();
drawTransferenceFunction();
-
}
HistogramWidget::HistogramWidget( wxWindow *parent, wxWindowID id)
: wxPanel(parent,id){
-
SetBackgroundColour(wxColour(255,255,255));
histogram = NULL;
-
//plotter
plotter=new pPlotter(this, 400,350);
plotter->setType(2);
//setting the popMenu
plotter->setPopUpMenu(true,true,true,true,true,true,false,false,false,false,false,false,false);
- histogramSize=0;
- idTransferenceFunction=-1;
- idHistogram=-1;
- transferenceFunctionHasColor=true;
- transferenceFunctionHasPoints=true;
- this->type=type;;
+ histogramSize = 0;
+ idTransferenceFunction = -1;
+ idHistogram = -1;
+ transferenceFunctionHasColor = true;
+ transferenceFunctionHasPoints = true;
+ this->type = type;;
this->SetAutoLayout(true);
this->Refresh();
-
-
}
double xValues[5],yValues[5];
//xValues
int maxValueGrey=histogram->getMaximumLevelOfGrey();
- xValues[0]=0;
- xValues[1]=maxValueGrey/16;
- xValues[2]=maxValueGrey/8;
- xValues[3]=maxValueGrey/16+(maxValueGrey-maxValueGrey/2)/2;
- xValues[4]=maxValueGrey;
+ xValues[0] = 0;
+ xValues[1] = maxValueGrey/16;
+ xValues[2] = maxValueGrey/8;
+ xValues[3] = maxValueGrey/16+(maxValueGrey-maxValueGrey/2)/2;
+ xValues[4] = maxValueGrey;
//yValues
- yValues[0]=0;
- yValues[1]=25;
- yValues[2]=100;
- yValues[3]=25;
- yValues[4]=0;
+ yValues[0] = 0;
+ yValues[1] = 25;
+ yValues[2] = 100;
+ yValues[3] = 25;
+ yValues[4] = 0;
pGraphicalFunction * tf = plotter ->getFunctionForVectors( xValues, 5, yValues, 5 );
printf("EED %p HistogramWidget::drawTransferenceFunction %p\n", this , tf);
pGraphicalFunction* histogramFunction = plotter->getFunction(idHistogram);
int min = histogramFunction->getMinX();
float x = porcentageMaxX*(histogramFunction->getMaxX()-min);
- return min+ x;
+ return min + x;
}
/*
Returns the minimum value ot the histogram that is show to the user
pGraphicalFunction* histogramFunction = plotter->getFunction(idHistogram);
int min = histogramFunction->getMinX();
float x = porcentageMinX*(histogramFunction->getMaxX()-min);
- return min+ x;
+ return min + x;
}
/*
Returns the minimum value ot the histogram that is show to the user
private:
- pHistogram* histogram;
- pPlotter* plotter;
- int idTransferenceFunction;
- int histogramSize;
- int idHistogram;
+ pHistogram* histogram;
+ pPlotter* plotter;
+ int idTransferenceFunction;
+ int histogramSize;
+ int idHistogram;
/*
if the image has already a transference
function and color defines to that function
//----------------------------------------------------------------------------
BEGIN_DECLARE_EVENT_TYPES()
- DECLARE_EVENT_TYPE(wxEVT_TSBAR,-1)
-DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL,-1)
-//DECLARE_EXPORTED_EVENT_TYPE(MARACASVISULIB_EXPORTS,wxEVT_TSBAR_ACTUAL,-1)
-//extern creaMaracasVisu_EXPORT const wxEventType wxEVT_TSBAR_ACTUAL;
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_START,-1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_END,-1)
- DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED,-1)
- DECLARE_EVENT_TYPE(wxEVT_SELECTION_END,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_ACTUAL,-1)
+// DECLARE_EXPORTED_EVENT_TYPE(MARACASVISULIB_EXPORTS,wxEVT_TSBAR_ACTUAL,-1)
+// extern creaMaracasVisu_EXPORT const wxEventType wxEVT_TSBAR_ACTUAL;
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_START,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_END,-1)
+ DECLARE_EVENT_TYPE(wxEVT_TSBAR_MOVED,-1)
+ DECLARE_EVENT_TYPE(wxEVT_SELECTION_END,-1)
END_DECLARE_EVENT_TYPES()
--- /dev/null
+ /*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+/**
+ * \file
+ * \brief ClassThresholdImageViewPanel .
+ */
+
+#include "mBarRange2.h"
+
+
+DEFINE_EVENT_TYPE(wxEVT_BarRange2_Change)
+
+
+/**
+ ** Begin of the panel
+ **/
+mBarRange2::mBarRange2(wxWindow* parent,int width, int height)
+: wxPanel(parent, -1, wxDefaultPosition, wxSize(width,height), wxBORDER_SUNKEN)
+{
+ _minValue = 0;
+ _maxValue = 100;
+ _scalarType = 0;
+ _mBarRange = new mBarRange(this,width,height);
+ _mBarRange->SetOrientation( true );
+ _mBarRange->setActiveStateTo(true);
+ _mBarRange->setVisibleLabels( false );
+ _mBarRange->setDeviceEndMargin(10);
+ _mBarRange->setDeviceBlitStart(10,10);
+ _mBarRange->setIfWithActualDrawed( false );
+ _mBarRange->setRepresentedValues( 0, 100 );
+ _mBarRange->SetStart(0);
+ _mBarRange->SetEnd(100);
+ _textctrlStart = new wxTextCtrl( this, -1, _T(""),wxDefaultPosition, wxSize(60,20),wxTE_PROCESS_ENTER );
+ _textctrlEnd = new wxTextCtrl( this, -1, _T(""),wxDefaultPosition, wxSize(60,20),wxTE_PROCESS_ENTER );
+ Connect( _textctrlStart->GetId(), wxEVT_COMMAND_TEXT_ENTER , (wxObjectEventFunction) &mBarRange2::onTxtCtrl );
+ Connect( _textctrlEnd->GetId(), wxEVT_COMMAND_TEXT_ENTER , (wxObjectEventFunction) &mBarRange2::onTxtCtrl );
+ wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
+ wxFlexGridSizer * sizerTextCtrl = new wxFlexGridSizer(2);
+ sizerTextCtrl -> Add( _textctrlStart , 1, wxGROW );
+ sizerTextCtrl -> Add( _textctrlEnd , 1, wxGROW );
+ sizer -> Add( _mBarRange , 1, wxGROW );
+ sizer -> Add( sizerTextCtrl , 1, wxGROW );
+ this->SetSizer( sizer );
+ this->SetAutoLayout( true );
+ this->Layout();
+ RefreshTextCntrl();
+}
+
+//----------------------------------------------------------------------------
+mBarRange2::~mBarRange2()
+{
+}
+
+//----------------------------------------------------------------------------
+wxString mBarRange2::CleanNumberStr(wxString string)
+{
+ wxString tmpStr=string;
+ while (tmpStr[tmpStr.Length()-1]=='0')
+ {
+ tmpStr=tmpStr.SubString (0, tmpStr.Length()-1-1 );
+ } //
+
+ if (tmpStr[tmpStr.Length()-1]=='.')
+ {
+ tmpStr.Append(_T("0"));
+ }
+ return tmpStr;
+}
+
+
+//----------------------------------------------------------------------------
+double mBarRange2::GetStartValue()
+{
+ return _startValue;
+}
+
+//----------------------------------------------------------------------------
+double mBarRange2::GetEndValue()
+{
+ return _endValue;
+}
+
+//----------------------------------------------------------------------------
+void mBarRange2::RefreshTextCntrl()
+{
+ double startPorcentage = _mBarRange->GetStart();
+ double endPorcentage = _mBarRange->GetEnd();
+ _startValue = (_maxValue-_minValue)*(startPorcentage/100) + _minValue;
+ _endValue = (_maxValue-_minValue)*(endPorcentage/100) + _minValue;
+
+ wxString startValueStr;
+ wxString endValueStr;
+
+ if ( (_scalarType==10) || (_scalarType==11) ) // 10=VTK_FLOAT 11=VTK_DOUBLE
+ {
+ startValueStr.Printf(_T("%f"),_startValue);
+ startValueStr=CleanNumberStr( startValueStr );
+ endValueStr.Printf(_T("%f"),_endValue);
+ endValueStr=CleanNumberStr( endValueStr );
+ } else {
+ startValueStr.Printf(_T("%d"),(int)_startValue);
+ endValueStr.Printf(_T("%d"),(int)_endValue);
+ }
+
+ _textctrlStart->SetValue( startValueStr );
+ _textctrlEnd->SetValue( endValueStr );
+}
+
+
+//----------------------------------------------------------------------------
+void mBarRange2::createAndSendEvent(WXTYPE theEventType)
+{
+ wxCommandEvent cevent( theEventType, GetId() );
+ cevent.SetEventObject( this );
+ GetEventHandler()->ProcessEvent( cevent );
+}
+
+
+
+//----------------------------------------------------------------------------
+void mBarRange2::onBarRangeChange(wxCommandEvent& event)
+{
+ RefreshTextCntrl();
+ createAndSendEvent( wxEVT_BarRange2_Change );
+}
+
+//----------------------------------------------------------------------------
+void mBarRange2::onTxtCtrl(wxCommandEvent& event)
+{
+ double value;
+ double startPorcentage;
+ double endPorcentage;
+ if (_textctrlStart->GetValue().ToDouble(&value)==true)
+ {
+ startPorcentage = (value - _minValue)*100/(_maxValue-_minValue);
+ _mBarRange->SetStart( startPorcentage );
+ }
+
+ if (_textctrlEnd->GetValue().ToDouble(&value)==true)
+ {
+ endPorcentage = (value - _minValue)*100/(_maxValue-_minValue);
+ _mBarRange->SetEnd( endPorcentage );
+ }
+
+ RefreshTextCntrl();
+}
+
+//----------------------------------------------------------------------------
+void mBarRange2::SetMinMaxValue(double min, double max)
+{
+ _minValue = min;
+ _maxValue = max;
+ RefreshTextCntrl();
+}
+
+
+//----------------------------------------------------------------------------
+void mBarRange2::SetScalarType(int value)
+{
+ _scalarType = value;
+}
+
+
+
+//----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(mBarRange2, wxPanel)
+ EVT_COMMAND( wxID_ANY, wxEVT_TSBAR_START , mBarRange2::onBarRangeChange )
+ EVT_COMMAND( wxID_ANY, wxEVT_TSBAR_END , mBarRange2::onBarRangeChange )
+ EVT_COMMAND( wxID_ANY, wxEVT_TSBAR_MOVED , mBarRange2::onBarRangeChange )
+END_EVENT_TABLE()
+
+
+// EOF
+
--- /dev/null
+/*# ---------------------------------------------------------------------
+#
+# Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
+# pour la Sant�)
+# Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
+# Previous Authors : Laurent Guigues, Jean-Pierre Roux
+# CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
+#
+# This software is governed by the CeCILL-B license under French law and
+# abiding by the rules of distribution of free software. You can use,
+# modify and/ or redistribute the software under the terms of the CeCILL-B
+# license as circulated by CEA, CNRS and INRIA at the following URL
+# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
+# or in the file LICENSE.txt.
+#
+# As a counterpart to the access to the source code and rights to copy,
+# modify and redistribute granted by the license, users are provided only
+# with a limited warranty and the software's author, the holder of the
+# economic rights, and the successive licensors have only limited
+# liability.
+#
+# The fact that you are presently reading this means that you have had
+# knowledge of the CeCILL-B license and that you accept its terms.
+# ------------------------------------------------------------------------ */
+
+
+
+/**
+ * \file
+ * \brief Class ThresholdImageViewPanel .
+ */
+
+/**
+ * \class ThresholdImageViewPanel
+ * \brief
+ */
+
+#ifndef __ThresholdImageViewPanel_h__
+#define __ThresholdImageViewPanel_h__
+
+
+#include <wx/wx.h>
+#include <wx/textctrl.h>
+#include "mBarRange.h"
+
+
+BEGIN_DECLARE_EVENT_TYPES()
+ DECLARE_EVENT_TYPE(wxEVT_BarRange2_Change,-1)
+END_DECLARE_EVENT_TYPES()
+
+
+
+ class mBarRange2
+ : public wxPanel
+ {
+ public:
+ mBarRange2(wxWindow * parent,int width, int height);
+ ~mBarRange2();
+ void onTxtCtrl(wxCommandEvent& event);
+ void SetMinMaxValue(double,double);
+ void SetScalarType(int);
+ double GetStartValue();
+ double GetEndValue();
+ private:
+ double _minValue;
+ double _maxValue;
+ double _startValue;
+ double _endValue;
+ int _scalarType;
+ mBarRange *_mBarRange;
+ wxTextCtrl *_textctrlStart;
+ wxTextCtrl *_textctrlEnd;
+ void onBarRangeChange(wxCommandEvent& event);
+ wxString CleanNumberStr(wxString string);
+ void RefreshTextCntrl();
+ void createAndSendEvent(WXTYPE theEventType);
+ DECLARE_EVENT_TABLE()
+ };
+
+
+#endif
+
{
int cx, cy;
GetClientSize( &cx, &cy);
-
const int sx = (int)((m_maxX - m_minX) * GetScaleX()); // JPRx
const int sy = (int)((m_maxY - m_minY) * GetScaleY()); // JPRx
const int px = (int)((GetPosX() - m_minX) * GetScaleX() - (cx>>1)); // JPRx
const int py = (int)((GetPosY() - m_minY) * GetScaleY() - (cy>>1)); // JPRx
SetScrollbars( 1, 1, sx, sy, px, py);
}
-
FitInside();
Refresh( false );
}
bool hasPrevPoint = movingPointIndex > 0;
bool hasNextPoint = movingPointIndex < showedColorPoints.size()-1;
- pColorPoint * prevPoint = hasPrevPoint? showedColorPoints[movingPointIndex-1]: NULL;
+ pColorPoint * prevPoint = hasPrevPoint? showedColorPoints[movingPointIndex-1]: NULL;
pColorPoint * nextPoint = hasNextPoint ? showedColorPoints[movingPointIndex+1]: NULL;
if ( hasPrevPoint && prevPoint!=NULL )
*/
void pColorBar :: onDeleteColorPoint ( wxCommandEvent& anEvent )
{
- bool deletedPoint = false;
- double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY );
- deletedPoint = deleteColorPoint(real_x);
+ bool deletedPoint = false;
+ double real_x = getOrientation() ? convertToRealValue( clickedX ) : convertToRealValue( clickedY );
+ deletedPoint = deleteColorPoint(real_x);
// Inform deletedPoint event
if ( deletedPoint )
{
//RefreshForce();
createAndSendEvent( wxEVT_REMOVED_POINT );
- }
+ } //if
}
/**
{
//RefreshForce();
createAndSendEvent( wxEVT_CHANGED_POINT );
- }
+ } // if
}
+
+
/**
* Reacts to the cntID_TRIANGLES_UP wxCommandEvent and changes the assigned figure to -triangles up- for the color points of the color bar.
* param & anEvent The wxCommandEvent actioned event
Set the bars according to the actual function
*/
- void pPlotter::setAll()
+void pPlotter::setAll()
{
actualFunction = m_plot->getActualFunction();
-
if (actualFunction != NULL)
{
barrange -> setActiveStateTo(true);
color_bar -> setActiveStateTo(true);
-
text.Clear();
text = _T("minX=");
double realMin_X = actualFunction->getMinX();
text = text + _T(" maxX=");
double realMax_X = actualFunction->getMaxX();
text = text + realMax_X;
-
int minShowed = actualFunction->getMinXShowed();
int maxShowed = actualFunction->getMaxXShowed();
-
barrange -> setRepresentedValues (realMin_X, realMax_X);
barrange->SetStart( minShowed );
barrange->SetEnd( maxShowed );
-
-
std::vector<pColorPoint *> actualColorPoints;
- actualFunction -> getColorPoints(actualColorPoints);
+ actualFunction->getColorPoints(actualColorPoints);
if(actualColorPoints.empty())
- color_bar ->reinitiateColorBar (realMin_X, realMax_X);
- else
- color_bar ->reinitiateColorBarTo(actualColorPoints);
-
- color_bar -> setVisibleRange (minShowed, maxShowed);
-
+ {
+ color_bar->reinitiateColorBar (realMin_X, realMax_X);
+ } else {
+ color_bar->reinitiateColorBarTo(actualColorPoints);
+ }
+ color_bar->setVisibleRange (minShowed, maxShowed);
// Refresh
- color_bar -> RefreshForce();
- barrange -> RefreshForce();
-
+ color_bar->RefreshForce();
+ barrange->RefreshForce();
sendTMessage(text);
- }
+ } // if actualFunction
}
//-----------------------------------------------------------------------------------------------------
// Updating methods for occured events in the color bar
//-----------------------------------------------------------------------------------------------------
-void pPlotter :: onAdded_ColorPoint(wxCommandEvent& event)
+void pPlotter::onAdded_ColorPoint(wxCommandEvent& event)
{
text.Clear();
text = _T( "Last event was on color bar: Color point added, total#");
-
actualFunction = m_plot->getActualFunction();
if(actualFunction!=NULL)
{
color_bar ->getAddedColorsPointsList(actualColorPoints);
actualFunction -> setColorPoints(actualColorPoints);
text << actualColorPoints.size();
-
sendTMessage(text);
}
}
+
void pPlotter :: onRemoved_ColorPoint(wxCommandEvent& event)
{
text.Clear();
text = _T( "Last event on color bar: Color point removed total#");
-
actualFunction = m_plot->getActualFunction();
std::vector<pColorPoint *> actualColorPoints;
color_bar ->getAddedColorsPointsList(actualColorPoints);
actualFunction -> setColorPoints(actualColorPoints);
text << actualColorPoints.size();
-
sendTMessage(text);
}
+
void pPlotter :: onMoved_ColorPoint(wxCommandEvent& event)
{
text.Clear();
text = _T( "Last event was on color bar: Color point moved to: ");
int lastReal_X = (int)(color_bar->getLastMovedColorPoint())->getRealX();
text << lastReal_X;
-
barrange ->setRealX_vertical_line (lastReal_X);
barrange -> RefreshForce();
-
m_plot->setRealGuideX (lastReal_X);
m_plot->UpdateAll();
-
sendTMessage(text);
}
+
void pPlotter:: onChanged_ColorPoint(wxCommandEvent& event)
{
- text.Clear();
+ text.Clear();
sendTMessage(_T("Last event was on color bar: Color point changed color"));
}
barrange->SetEnd( maxShowed );
std::vector<pColorPoint *> actualColorPoints;
- actualFunction -> getColorPoints(actualColorPoints);
+ actualFunction->getColorPoints(actualColorPoints);
if(actualColorPoints.empty())
- color_bar ->reinitiateColorBar (realMin_X, realMax_X);
- else
- color_bar ->reinitiateColorBarTo(actualColorPoints);
-
- color_bar -> setVisibleRange ((int)realMin_X, maxShowed);
+ {
+ color_bar->reinitiateColorBar (realMin_X, realMax_X);
+ } else {
+ color_bar->reinitiateColorBarTo(actualColorPoints);
+ }
+ color_bar->setVisibleRange ((int)realMin_X, maxShowed);
// Refresh
- color_bar -> RefreshForce();
- barrange -> RefreshForce();
+ color_bar->RefreshForce();
+ barrange->RefreshForce();
sendTMessage(text);
- }
+ } // if actualFunction
}
color_bar ->setRealX_vertical_line (lastActual_X);
color_bar -> RefreshForce();
- m_plot->setRealGuideX (lastActual_X);
+ m_plot->setRealGuideX(lastActual_X);
m_plot->UpdateAll();
text.Clear();
//setting the plotter for draw the functions that
//it has to move.
- float startP=(float)barrange->getStartShowPorcentage();
- float endP=(float)barrange->getEndShowPorcentage();
+ float startP = (float)barrange->getStartShowPorcentage();
+ float endP = (float)barrange->getEndShowPorcentage();
m_plot->moveFunctions(startP,endP);
//Updating
{
text.Clear();
text += _T("Last event was on min-max bar: End triangle moved to: ");
- int realMax_X = barrange->GetEnd();
+ int realMax_X = barrange->GetEnd();
text += wxString::Format(_T("%d"),realMax_X);
- double realMin_X = m_plot->getMinScrX();
+ double realMin_X = m_plot->getMinScrX();
color_bar -> setVisibleRange ((int)realMin_X, realMax_X);
m_plot->actualizeViewRange((int)realMin_X,realMax_X);
-
- float startP=(float)barrange->getStartShowPorcentage();
- float endP=(float)barrange->getEndShowPorcentage();
+ float startP = (float)barrange->getStartShowPorcentage();
+ float endP = (float)barrange->getEndShowPorcentage();
m_plot->moveFunctions(startP,endP);
-
color_bar -> RefreshForce();
m_plot -> UpdateAll();
-
sendTMessage(text);
}
{
return barrange->getEndShowPorcentage();
}
+
float pPlotter::getMinShowedPorcentage()
{
return barrange->getStartShowPorcentage();
}
+
float pPlotter::getActualShowedPorcentage()
{
return barrange->getActualShowPorcentage();
**/
void pPlotter::GetValuesPointsFunction(std::vector<double>& greylevel,std::vector<double>& value, int histogramsize)
{
- if(actualFunction != NULL){
+ if(actualFunction != NULL)
+ {
double* xval = actualFunction->getX_RealValues();
double* yval = actualFunction->getY_RealValues();
-
actualFunction->getScaleY();
- for(int i = 0; i < actualFunction->getSizePoints();i++){
+ for(int i = 0; i < actualFunction->getSizePoints();i++)
+ {
greylevel.push_back(xval[i]);
value.push_back(yval[i]/histogramsize);
- }
- }
+ } // for
+ } // if
}
/**
std::vector<double>& green,
std::vector<double>& blue)
{
-
- if(color_bar != NULL){
-
+ if(color_bar != NULL)
+ {
std::vector<pColorPoint*> colors;
- color_bar->getAddedColorsPointsList(colors);
-
- for(int i = 0; i < colors.size();i++){
- pColorPoint* pcolor = colors[i];
-
+ color_bar->getAddedColorsPointsList(colors);
+ for(int i = 0; i < colors.size();i++)
+ {
+ pColorPoint* pcolor = colors[i];
greylevel.push_back(pcolor->getRealX());
- wxColour colour = pcolor->getColor();
-
- double _red = (double)(colour.Red())/255.0;
- double _green = (double)(colour.Green())/255.0;
- double _blue = (double)(colour.Blue())/255.0;
-
+ wxColour colour = pcolor->getColor();
+ double _red = (double)(colour.Red())/255.0;
+ double _green = (double)(colour.Green())/255.0;
+ double _blue = (double)(colour.Blue())/255.0;
red.push_back(_red);
green.push_back(_green);
blue.push_back(_blue);
- }
- }
+ } // for
+ } // if
}