void ColorLayerImageView::Process()
{
ColorLayerImageViewPanel *clivp = (ColorLayerImageViewPanel*)bbGetOutputWidget();
- clivp->GetColorLayerImageView()->SetwxVtkBaseView( bbGetInputWxVtkBaseView() );
+ clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 0 , bbGetInputWxVtkBaseView() );
+ clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 1 , bbGetInputWxVtkBaseView1() );
+ clivp->GetColorLayerImageViewManager()->SetwxVtkBaseView( 2 , bbGetInputWxVtkBaseView2() );
+
std::vector<double> base_color = bbGetInputlstBaseColor();
- clivp->GetColorLayerImageView()->SetBaseColors( base_color );
+ clivp->GetColorLayerImageViewManager()->SetBaseColors( base_color );
std::vector<double> grey_level_boundaries = bbGetInputlstGreyLevelBoundaries();
- clivp->GetColorLayerImageView()->SetGreyLevelBoundaries( grey_level_boundaries );
+ clivp->GetColorLayerImageViewManager()->SetGreyLevelBoundaries( grey_level_boundaries );
- clivp->GetColorLayerImageView()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
+ clivp->GetColorLayerImageViewManager()->SetPlainOrGradientColor( bbGetInputPlainOrGradientColor() );
clivp->SetFittingMode( bbGetInputFittingMode() );
clivp->SetImage( bbGetInputIn() );
{
bbSetInputIn(NULL);
bbSetInputWxVtkBaseView(NULL);
+ bbSetInputWxVtkBaseView1(NULL);
+ bbSetInputWxVtkBaseView2(NULL);
}
//=====
// Don't edit this file. This file is generated from xml description..
// Don't edit this file. This file is generated from xml description..
//=====
BBTK_DECLARE_INPUT(WxVtkBaseView,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(WxVtkBaseView1,wxVtkBaseView *);
+ BBTK_DECLARE_INPUT(WxVtkBaseView2,wxVtkBaseView *);
BBTK_DECLARE_INPUT(In,vtkImageData*);
BBTK_DECLARE_INPUT(lstBaseColor,std::vector<double>);
BBTK_DECLARE_INPUT(lstGreyLevelBoundaries,std::vector<double>);
BBTK_AUTHOR("Eduardo DAVILA (Creatis)");
BBTK_DESCRIPTION("Color Layer Image View");
BBTK_CATEGORY("__CategoryBlackBox__");
-BBTK_INPUT(ColorLayerImageView,WxVtkBaseView,"creaMaracasVisuViewer viewer",wxVtkBaseView*,"");
+BBTK_INPUT(ColorLayerImageView,WxVtkBaseView," 0 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
+BBTK_INPUT(ColorLayerImageView,WxVtkBaseView1," 1 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
+BBTK_INPUT(ColorLayerImageView,WxVtkBaseView2," 2 creaMaracasVisuViewer viewer XY,YZ ou XZ",wxVtkBaseView*,"");
BBTK_INPUT(ColorLayerImageView,In,"Input Image",vtkImageData*,"");
BBTK_INPUT(ColorLayerImageView,lstBaseColor,"List of Base Colors in RGB format to define the color map. Requirement: must be of a size being a multiple of 3, with values between 0 and 1. For example, for 2 colors: \"1 0 0 0 0 1\". If not provided as required, the histogram is equally split into three areas, blue, yellow and red.",std::vector<double>,"");
BBTK_INPUT(ColorLayerImageView,lstGreyLevelBoundaries,"List of the Grey Level Boundaries to define the color map (grey level outside the color boundaries will not be disayed). Requirement: Must have one more element than the number of colours. For example, for 2 colors: \"50 150 250\". If not provided as required, the histogram is equally split into areas, which number corresponds to the number of colors provided (3 by default).",std::vector<double>,"");
_fix_dynamic = fix_dynamic;
}
+//----------------------------------------------------------------------------
+void ColorLayerImageView::SetX2(int x2)
+{
+ _x2 = x2;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageView::SetY2(int y2)
+{
+ _y2 = y2;
+}
+
+
//----------------------------------------------------------------------------
void ColorLayerImageView::SetZ2(int z2)
{
_z2 = z2;
}
+
+
+//----------------------------------------------------------------------------
+int ColorLayerImageView::GetX() // virtual
+{
+ int result=0;
+ if (_fix_dynamic==false)
+ {
+ result = _x2;
+ }
+ else
+ {
+ result = LayerImageBase::GetX();
+ }
+
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int ColorLayerImageView::GetY() // virtual
+{
+ int result=0;
+ if (_fix_dynamic==false)
+ {
+ result = _y2;
+ }
+ else
+ {
+ result = LayerImageBase::GetY();
+ }
+
+ return result;
+}
+
//----------------------------------------------------------------------------
int ColorLayerImageView::GetZ() // virtual
{
ColorLayerImageView( );
~ColorLayerImageView( );
void SetSliceFixDynamic(bool fix_dynamic);
+ void SetX2(int x2);
+ void SetY2(int y2);
void SetZ2(int z2);
+ virtual int GetX();
+ virtual int GetY();
virtual int GetZ();
/**
private:
- int _z2;
+ int _x2, _y2, _z2;
bool _fix_dynamic;
void SetDefaultGreyLevelBoundary();
void SetDefaultBaseColorAndGreyLevelBoundary();
--- /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
+ * \author Eduardo Davila and Claire Mouton.
+ * \brief Class bbtk::ThresholdImageView.
+ * \date September 2012
+ */
+
+#include "ColorLayerImageViewManager.h"
+
+
+
+//=========================================================================
+//=========================================================================
+//=========================================================================
+//=========================================================================
+ColorLayerImageViewManager::ColorLayerImageViewManager( )
+{
+ _colorLayerImageViewLst.push_back(NULL); // 0
+ _colorLayerImageViewLst.push_back(NULL); // 1
+ _colorLayerImageViewLst.push_back(NULL); // 2
+}
+
+//=========================================================================
+ColorLayerImageViewManager::~ColorLayerImageViewManager()
+{
+}
+//=========================================================================
+
+
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetwxVtkBaseView(int id, wxVtkBaseView *baseview)
+{
+ if (baseview!=NULL)
+ {
+ int size =_colorLayerImageViewLst.size();
+ if ( (id>=0) && (id<=size) )
+ {
+ if (_colorLayerImageViewLst[id]==NULL)
+ {
+ _colorLayerImageViewLst[id] = new ColorLayerImageView();
+ }
+ _colorLayerImageViewLst[id]->SetwxVtkBaseView(baseview);
+
+ } // if id
+ } // baseview
+}
+
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetX2(int x2)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetX2( x2 );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetY2(int y2)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetY2( y2 );
+ } // if
+ } // for
+
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetZ2(int z2)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetZ2( z2 );
+ } // if
+ } // for
+
+}
+
+
+
+//----------------------------------------------------------------------------
+int ColorLayerImageViewManager::GetX()
+{
+ int result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetX();
+ } // if
+ } // for
+ return result;
+}
+
+//----------------------------------------------------------------------------
+int ColorLayerImageViewManager::GetY()
+{
+ int result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetY();
+ } // if
+ } // for
+ return result;
+}
+
+
+
+//----------------------------------------------------------------------------
+int ColorLayerImageViewManager::GetZ() // virtual
+{
+ int result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetZ();
+ } // if
+ } // for
+ return result;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetBaseColors(std::vector<double> & base_color)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetBaseColors( base_color );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+double ColorLayerImageViewManager::GetBaseColors(unsigned int index)
+{
+ double result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetBaseColors( index );
+ } // if
+ } // for
+ return result;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetGreyLevelBoundaries( grey_level_boundary );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+double ColorLayerImageViewManager::GetGreyLevelBoundaries(unsigned int index)
+{
+ double result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetGreyLevelBoundaries( index );
+ } // if
+ } // for
+ return result;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetPlainOrGradientColor(bool color_type)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetPlainOrGradientColor( color_type );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+int ColorLayerImageViewManager::GetBaseColorNb()
+{
+ int result;
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ result = _colorLayerImageViewLst[i]->GetBaseColorNb();
+ } // if
+ } // for
+ return result;
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::Refresh()
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->Refresh();
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::onThreshold()
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->onThreshold();
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::onThresholdChange()
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->onThresholdChange();
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::onThresholdRemove()
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->onThresholdRemove();
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::onThresholdInterpolation(bool interpolation)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->onThresholdInterpolation( interpolation );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetSliceFixDynamic( bool fixdyn )
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetSliceFixDynamic( fixdyn );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::onThresholdChangeOpacity( int opacity)
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->onThresholdChangeOpacity( opacity );
+ } // if
+ } // for
+}
+
+//----------------------------------------------------------------------------
+void ColorLayerImageViewManager::SetImage( vtkImageData* img )
+{
+ int i, size=_colorLayerImageViewLst.size();
+ for (i=0;i<size;i++)
+ {
+ if (_colorLayerImageViewLst[i]!=NULL)
+ {
+ _colorLayerImageViewLst[i]->SetImage( img );
+ } // if
+ } // for
+}
+
+// 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 ThresholdImageView .
+ */
+
+/**
+ * \class ThresholdImageView
+ * \brief
+ */
+
+#ifndef __ColorLayerImageViewManager_h__
+#define __ColorLayerImageViewManager_h__
+
+#include "ColorLayerImageView.h"
+
+
+class ColorLayerImageViewManager
+ {
+ public:
+ ColorLayerImageViewManager( );
+ ~ColorLayerImageViewManager( );
+ void SetX2(int x2);
+ void SetY2(int y2);
+ void SetZ2(int z2);
+ virtual int GetX();
+ virtual int GetY();
+ virtual int GetZ();
+ void SetwxVtkBaseView(int id, wxVtkBaseView *baseview);
+ void SetBaseColors(std::vector<double> & base_color);
+ double GetBaseColors(unsigned int index);
+ void SetGreyLevelBoundaries(std::vector<double> & grey_level_boundary);
+ double GetGreyLevelBoundaries(unsigned int index);
+ void SetPlainOrGradientColor(bool color_type);
+ int GetBaseColorNb();
+ void Refresh();
+ void onThreshold();
+ void onThresholdRemove();
+ void onThresholdChange();
+ void onThresholdInterpolation(bool interpolation);
+ void SetSliceFixDynamic( bool fixdin );
+ void onThresholdChangeOpacity( int opacity);
+ void SetImage( vtkImageData* img );
+ private:
+
+ std::vector< ColorLayerImageView* > _colorLayerImageViewLst;
+
+ protected:
+ };
+
+#endif
+
_spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
_dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
- _colorLayerImageView = new ColorLayerImageView();
+//EED01 _colorLayerImageView = new ColorLayerImageView();
+ _colorLayerImageViewManager = new ColorLayerImageViewManager();
+
_btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
_thresholdGo = true;
_cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide Layer") );
_cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
_cb_SliceFixDinamic->SetValue(true);
- _sl_SliceImage = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
- _sl_SliceImage->Enable(false);
+ _sl_SliceImageX = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _sl_SliceImageY = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _sl_SliceImageZ = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ _sl_SliceImageX->Enable(false);
+ _sl_SliceImageY->Enable(false);
+ _sl_SliceImageZ->Enable(false);
_interpolationCheckBox = new wxCheckBox(this, -1, _T("Image Interpolation") );
_interpolationCheckBox->SetValue(true);
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 );
- Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_THUMBTRACK , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
- Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+
+ 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_PAGEUP , (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_PAGEUP , (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_PAGEUP , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+ Connect( _sl_SliceImageZ->GetId(), wxEVT_SCROLL_PAGEDOWN , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
+
wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
sizer -> Add( new wxStaticText(this,-1,_T(" ")) , 1, wxGROW );
sizer -> Add( new wxStaticText(this,-1,_T("Slice ")) , 1, wxGROW );
- sizer -> Add( _sl_SliceImage, 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 );
this->SetSizer( sizer );
}
-//----------------------------------------------------------------------------
-void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
-{
- _colorLayerImageView = colorLayerImageView;
-}
+//EED01
+//EED01 //----------------------------------------------------------------------------
+//EED01 void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
+//EED01 {
+//EED01 _colorLayerImageView = colorLayerImageView;
+//EED01 }
+//EED01
+//EED01 //----------------------------------------------------------------------------
+//EED01 ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
+//EED01 {
+//EED01 return _colorLayerImageView;
+//EED01 }
-//----------------------------------------------------------------------------
-ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
+
+ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
{
- return _colorLayerImageView;
+ return _colorLayerImageViewManager;
}
{
if (img!=NULL)
{
- _colorLayerImageView->SetImage( img );
+ _colorLayerImageViewManager->SetImage( img );
double spc[3];
img->GetSpacing(spc);
dim[0] = ext[1]-ext[0];
dim[1] = ext[3]-ext[2];
dim[2] = ext[5]-ext[4];
- _sl_SliceImage->SetRange( 0 , dim[2] );
+ _sl_SliceImageX->SetRange( 0 , dim[0] );
+ _sl_SliceImageY->SetRange( 0 , dim[1] );
+ _sl_SliceImageZ->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])
img->SetSpacing(spc);
} // spc !_spcBase dim!__dimBase
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
+//EED01 _colorLayerImageView->onThreshold();
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
+//EED01 }
}
}
+
+void ColorLayerImageViewPanel::RefreshView()
+{
+//EED01 _colorLayerImageView->Refresh();
+ _colorLayerImageViewManager->Refresh();
+}
+
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::SetFittingMode(int fitting_mode)
{
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdChange(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- if (_thresholdGo)
- {
- _colorLayerImageView->onThresholdChange();
- _colorLayerImageView->Refresh();
- //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
- } // _threshold
- }//_colorLayerImageView
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
+ if (_thresholdGo)
+ {
+//EED01 _colorLayerImageView->onThresholdChange();
+ _colorLayerImageViewManager->onThresholdChange();
+ RefreshView();
+ //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
+ } // _thresholdGo
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
_thresholdGo = _cb_ShowHide->GetValue();
if (_thresholdGo)
{
- _colorLayerImageView->onThreshold();
+//EED01 _colorLayerImageView->onThreshold();
+ _colorLayerImageViewManager->onThreshold();
}else{
- _colorLayerImageView->onThresholdRemove( );
+//EED01 _colorLayerImageView->onThresholdRemove( );
+ _colorLayerImageViewManager->onThresholdRemove( );
}
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ RefreshView();
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdStop()
{
- if (_colorLayerImageView!=NULL)
- {
- if (_thresholdGo)
- {
- _colorLayerImageView->onThresholdRemove( );
- _thresholdGo=false;
- }
- }//_colorLayerImageView
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
+ if (_thresholdGo)
+ {
+//EED01 _colorLayerImageView->onThresholdRemove( );
+ _colorLayerImageViewManager->onThresholdRemove( );
+ _thresholdGo=false;
+ }
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
+//EED01 _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+ _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+ RefreshView();
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
bool fixdin = _cb_SliceFixDinamic->GetValue();
- _colorLayerImageView->SetSliceFixDynamic( fixdin );
+//EED01 _colorLayerImageView->SetSliceFixDynamic( fixdin );
+ _colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
if (fixdin==false)
{
- _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+//EED01 _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+ _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
+ _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
+ _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
}
- _sl_SliceImage->Enable(!fixdin);
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ _sl_SliceImageX->Enable(!fixdin);
+ _sl_SliceImageY->Enable(!fixdin);
+ _sl_SliceImageZ->Enable(!fixdin);
+//EED01 _colorLayerImageView->onThreshold();
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
+//EED01 _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
+//EED01 _colorLayerImageView->onThreshold();
+//EED01 RefreshView();
+ _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
+ _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
+ _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
+//EED01 }//_colorLayerImageView
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
+//EED01 if (_colorLayerImageView!=NULL)
+//EED01 {
int opacity = _opacity->GetValue();
- _colorLayerImageView->onThresholdChangeOpacity(opacity);
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+//EED01 _colorLayerImageView->onThresholdChangeOpacity(opacity);
+ _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+ RefreshView();
+//EED01 }//_colorLayerImageView
}
#include <wx/wx.h>
#include <wx/button.h>
-#include "ColorLayerImageView.h"
+#include "ColorLayerImageViewManager.h"
ColorLayerImageViewPanel(wxWindow * parent, int min, int max, int type);
~ColorLayerImageViewPanel();
void onThresholdStop();
- ColorLayerImageView* GetColorLayerImageView();
- void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView);
+ ColorLayerImageViewManager* GetColorLayerImageViewManager();
+//EED01 ColorLayerImageView* GetColorLayerImageView();
+//EED01 void SetColorLayerImageView(ColorLayerImageView* colorLayerImageView);
bool IsVisible();
void SetBaseSpacing(double spc[3]);
void SetBaseDimension(int dim[3]);
double _spcOrg[3];
bool _thresholdGo;
- ColorLayerImageView *_colorLayerImageView;
+ ColorLayerImageViewManager *_colorLayerImageViewManager;
+// ColorLayerImageView *_colorLayerImageView;
wxButton *_btn_ReadImage;
wxSlider *_opacity;
wxCheckBox *_interpolationCheckBox;
wxCheckBox *_cb_ShowHide;
wxCheckBox *_cb_SliceFixDinamic;
- wxSlider *_sl_SliceImage;
+ wxSlider *_sl_SliceImageX;
+ wxSlider *_sl_SliceImageY;
+ wxSlider *_sl_SliceImageZ;
void onReadImage(wxCommandEvent& event);
void onThresholdChange(wxCommandEvent& event);
void onThresholdShow(wxCommandEvent& event);
void onSliceFixDinamic(wxCommandEvent& event);
void onSliceImage(wxScrollEvent& event);
+ void RefreshView();
+
+
};
#endif
// _manualPaintControler->PaintImage((int) X, (int) Y, (int) Z);
+ _layerImageBase->SetX( (int)X );
+ _layerImageBase->SetY( (int)Y );
_layerImageBase->SetZ( (int)Z );
_layerImageBase->onThreshold();
// _layerImageBase->Refresh();
LayerImageBase::LayerImageBase()
{
_actorPresent = false;
+ _X = 0;
+ _Y = 0;
_Z = 0;
_thresholdTable = NULL;
_thresholdMapper = NULL;
{
}
+//----------------------------------------------------------------------------
+void LayerImageBase::SetX(int x)
+{
+ _X = x;
+}
+
+//----------------------------------------------------------------------------
+void LayerImageBase::SetY(int y)
+{
+ _Y = y;
+}
+
//----------------------------------------------------------------------------
void LayerImageBase::SetZ(int z)
{
_Z = z;
}
+//----------------------------------------------------------------------------
+int LayerImageBase::GetX() // virtual
+{
+ return _X;
+}
+
+//----------------------------------------------------------------------------
+int LayerImageBase::GetY() // virtual
+{
+ return _Y;
+}
//----------------------------------------------------------------------------
int LayerImageBase::GetZ() // virtual
{
return _Z;
}
+
//----------------------------------------------------------------------------
vtkImageData* LayerImageBase::GetImage()
{
void LayerImageBase::SetwxVtkBaseView(wxVtkBaseView *baseview)
{
printf("EED LayerImageBase::SetwxVtkBaseView start baseview:%p \n", baseview);
-
- _baseView = baseview;
-
- vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
- isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
-
+ if (_baseView==NULL)
+ {
+ _baseView = baseview;
+ vtkInteractorStyleBaseView *isbv = (vtkInteractorStyleBaseView*)(_baseView->GetInteractorStyleBaseView());
+ isbv->AddInteractorStyleMaracas( new ColorLayerImageBasevtkInteractor(this) );
+ } // if _baseView
printf("EED LayerImageBase::SetwxVtkBaseView end \n");
}
}
//----------------------------------------------------------------------------
-int LayerImageBase::CleanZ(int z)
+void LayerImageBase::CleanXYZ(double &x, double &y, double &z)
{
int ext[6];
_image->GetWholeExtent(ext);
+ if (x<0)
+ {
+ x=0;
+ }
+
+ if (y<0)
+ {
+ y=0;
+ }
+
if (z<0)
{
z=0;
}
+ if ( x > (ext[1]-ext[0]) )
+ {
+ z=ext[1]-ext[0];
+ }
+
+ if ( y > (ext[3]-ext[2]) )
+ {
+ z=ext[3]-ext[2];
+ }
+
if ( z > (ext[5]-ext[4]) )
{
z=ext[5]-ext[4];
}
- return z;
+
}
//----------------------------------------------------------------------------
{
double spc[3];
GetImage()-> GetSpacing(spc);
- double z = CleanZ( GetZ() );
- z = z*spc[2];
+ double x=GetX();
+ double y=GetY();
+ double z=GetZ();
+ CleanXYZ(x,y,z);
+
+ x = x*spc[0];
+ y = y*spc[1];
+ z = z*spc[2];
+
printf("EED LayerImageBase::onThreshold z = %d spcZ%f\n" , z, spc[2]);
+ vtkCamera *camera = _baseView->GetRenderer()->GetActiveCamera();
+ int directionViewer=0;
+ if (camera->GetParallelProjection()==1)
+ {
+ wxVtk2DBaseView *wxvtk2dbasevie = (wxVtk2DBaseView *)_baseView;
+ directionViewer = wxvtk2dbasevie->GetDirection();
+ } // ParallelProjection
+
+printf("EED LayerImageBase::onThreshold projection = %d\n" , camera->GetParallelProjection() );
+printf("EED LayerImageBase::onThreshold direction = %d\n" , directionViewer );
+
if (!GetActorPresent())
{
_thresholdActor = vtkImageActor::New( );
_thresholdActor->SetOpacity( 0.6 );
_thresholdActor->InterpolateOn( );
- _thresholdActor->SetPosition( 0,0, -900-1 );
+ if (directionViewer==0)
+ {
+ _thresholdActor->SetPosition( 900-1,0,0 );
+ _thresholdActor->RotateY( -90 );
+ }
+ if (directionViewer==1)
+ {
+ _thresholdActor->SetPosition( 0,-900-1, 0 );
+ _thresholdActor->RotateX( 90 );
+ }
+ if (directionViewer==2)
+ {
+ _thresholdActor->SetPosition( 0,0, -900-1 );
+ }
} // _thresholdActor
_baseView->GetRenderer()->AddActor( _thresholdActor );
_actorPresent = true;
ConfigLookupTable(); // virtual method
_imageReslicer->SetInput( GetImage() );
_imageReslicer->SetInformationInput( GetImage() );
- _imageReslicer->SetResliceAxesDirectionCosines(1,0,0, 0,1,0 ,0,0,1);
+
+ if (directionViewer==0)
+ {
+ _imageReslicer->SetResliceAxesDirectionCosines( 0,0,1, 0,1,0, -1,0,0 );
+ _imageReslicer->SetResliceAxesOrigin(x,0,0);
+ }
+
+ if (directionViewer==1)
+ {
+ _imageReslicer->SetResliceAxesDirectionCosines( 1,0,0 ,0,0,1, 0,-1,0 );
+ _imageReslicer->SetResliceAxesOrigin(0,y,0);
+ }
+
+ if (directionViewer==2)
+ {
+ _imageReslicer->SetResliceAxesDirectionCosines( 1,0,0, 0,1,0 ,0,0,1 );
+ _imageReslicer->SetResliceAxesOrigin(0,0,z);
+ }
+
+
_imageReslicer->SetOutputDimensionality(2);
// _imageReslicer->SetInterpolationModeToLinear();
_imageReslicer->SetInterpolationModeToNearestNeighbor();
- _imageReslicer->SetResliceAxesOrigin(0,0,z);
vtkImageData *img = _imageReslicer->GetOutput();
// img->Update();
public:
LayerImageBase();
virtual ~LayerImageBase();
+ void SetX(int x);
+ void SetY(int y);
void SetZ(int z);
void SetImage(vtkImageData* image);
void SetwxVtkBaseView(wxVtkBaseView *baseview);
void Refresh();
vtkLookupTable *GetvtkLookupTable();
vtkImageReslice *GetvtkImageReslice();
+ virtual int GetX();
+ virtual int GetY();
virtual int GetZ();
private:
+ int _X;
+ int _Y;
int _Z;
bool _actorPresent;
vtkImageData *_image;
virtual void ConfigLookupTable() = 0;
bool GetActorPresent();
- int CleanZ(int z);
+ void CleanXYZ(double &x, double &y, double &z);
protected: