ColorLayerImageViewPanel Class Reference

#include <ColorLayerImageViewPanel.h>

Collaboration diagram for ColorLayerImageViewPanel:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ColorLayerImageViewPanel (wxWindow *parent, int min, int max, int type)
 ~ColorLayerImageViewPanel ()
void onThresholdStop ()
ColorLayerImageViewGetColorLayerImageView ()
void SetColorLayerImageView (ColorLayerImageView *colorLayerImageView)
bool IsVisible ()
void SetBaseSpacing (double spc[3])
void SetBaseDimension (int dim[3])
void SetOriginalSpacing (double spc[3])

Private Member Functions

void onReadImage (wxCommandEvent &event)
void onThresholdChange (wxCommandEvent &event)
void onThresholdShow (wxCommandEvent &event)
void onThresholdInterpolation (wxCommandEvent &event)
void onChangeOpacity (wxScrollEvent &event)
void onSliceFixDinamic (wxCommandEvent &event)
void onSliceImage (wxScrollEvent &event)

Private Attributes

int _dimBase [3]
double _spcBase [3]
double _spcOrg [3]
bool _thresholdGo
ColorLayerImageView_colorLayerImageView
wxButton * _btn_ReadImage
wxSlider * _opacity
wxCheckBox * _interpolationCheckBox
wxCheckBox * _cb_ShowHide
wxCheckBox * _cb_SliceFixDinamic
wxSlider * _sl_SliceImage

Detailed Description

Definition at line 33 of file ColorLayerImageViewPanel.h.


Constructor & Destructor Documentation

ColorLayerImageViewPanel::ColorLayerImageViewPanel ( wxWindow *  parent,
int  min,
int  max,
int  type 
)

Begin of the threshold panel

Definition at line 61 of file ColorLayerImageViewPanel.cxx.

References _btn_ReadImage, _cb_ShowHide, _cb_SliceFixDinamic, _colorLayerImageView, _dimBase, _interpolationCheckBox, _opacity, _sl_SliceImage, _spcBase, _thresholdGo, onChangeOpacity(), onReadImage(), onSliceFixDinamic(), onSliceImage(), onThresholdInterpolation(), and onThresholdShow().

00062 : wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
00063 {
00064         _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
00065         _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
00066 
00067         _colorLayerImageView    = new ColorLayerImageView();
00068         _btn_ReadImage                  = new wxButton(this, wxID_ANY, _T("Read Image") );
00069         _thresholdGo                    = true;
00070         _cb_ShowHide                    = new wxCheckBox(this, wxID_ANY, _T("Show/Hide layer") );
00071         _cb_ShowHide->SetValue(_thresholdGo);
00072 
00073         _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Slice Fix/Dinamic") );
00074         _cb_SliceFixDinamic->SetValue(true);
00075 
00076         _sl_SliceImage = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
00077         _sl_SliceImage->Enable(false);
00078 
00079         _interpolationCheckBox = new wxCheckBox(this, -1, _T("Image interpolation") );
00080         _interpolationCheckBox->SetValue(true);
00081         _opacity = new wxSlider(this, wxID_ANY, 6, 1, 10, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
00082 
00083         if (type==0)
00084         {
00085         }
00086 
00087         if (type==1)
00088         {
00089         }
00090 
00091 
00092         Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED  , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
00093         Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
00094         Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
00095         Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
00096         Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic );
00097         Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_THUMBTRACK       , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
00098         Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEUP           , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
00099         Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_LINEDOWN         , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
00100         Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEUP           , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
00101         Connect( _sl_SliceImage->GetId(), wxEVT_SCROLL_PAGEDOWN         , (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceImage );
00102 
00103 
00104         wxFlexGridSizer * sizer         = new wxFlexGridSizer(1);
00105         if (type==1)
00106         {
00107                 sizer -> Add( new wxStaticText(this,-1,_T("Color Image Layer"))  , 1, wxGROW );
00108                 sizer -> Add( _btn_ReadImage, 1, wxGROW );
00109                 sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
00110         }
00111         sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level"))  , 1, wxGROW );
00112         sizer -> Add( _opacity, 1, wxGROW );
00113         sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
00114         sizer -> Add( _cb_ShowHide, 1, wxGROW );
00115         sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
00116         sizer -> Add( _interpolationCheckBox, 1, wxGROW );
00117 
00118         sizer -> Add( new wxStaticText(this,-1,_T(" "))  , 1, wxGROW );
00119         sizer -> Add( new wxStaticText(this,-1,_T("Slice "))  , 1, wxGROW );
00120         sizer -> Add( _sl_SliceImage, 1, wxGROW );
00121         sizer -> Add( _cb_SliceFixDinamic, 1, wxGROW );
00122 
00123         this->SetSizer( sizer );
00124         this->SetAutoLayout( true );
00125         this->Layout();
00126 }

Here is the call graph for this function:

ColorLayerImageViewPanel::~ColorLayerImageViewPanel (  ) 

Definition at line 129 of file ColorLayerImageViewPanel.cxx.

00130 {
00131 }


Member Function Documentation

ColorLayerImageView * ColorLayerImageViewPanel::GetColorLayerImageView (  ) 

Definition at line 141 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView.

00142 {
00143         return _colorLayerImageView;
00144 }

bool ColorLayerImageViewPanel::IsVisible (  ) 

Definition at line 336 of file ColorLayerImageViewPanel.cxx.

References _thresholdGo.

00337 {
00338         return _thresholdGo;
00339 }

void ColorLayerImageViewPanel::onChangeOpacity ( wxScrollEvent &  event  )  [private]

Definition at line 324 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _opacity, LayerImageBase::onThresholdChangeOpacity(), and LayerImageBase::Refresh().

Referenced by ColorLayerImageViewPanel().

00325 {
00326         if (_colorLayerImageView!=NULL)
00327         {
00328         int opacity = _opacity->GetValue();
00329         _colorLayerImageView->onThresholdChangeOpacity(opacity);
00330         _colorLayerImageView->Refresh();
00331         }//_colorLayerImageView
00332 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onReadImage ( wxCommandEvent &  event  )  [private]

Definition at line 176 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _dimBase, _sl_SliceImage, _spcBase, _spcOrg, creaMaracasVisuKernel::OpenImageDialog::getImageData(), wxDlgTransformByDimensionBySpacingByPixel::GetTransformType(), LayerImageBase::onThreshold(), LayerImageBase::Refresh(), and LayerImageBase::SetImage().

Referenced by ColorLayerImageViewPanel().

00177 {
00178 // EED ???
00179 //      creaImageIO::WxSimpleDlg w(0,_T("Select your image"),"creaContours_Descriptor.dscp","creatisContours DB");
00180 //      w.ShowModal();
00181         printf("EED ColorLayerImageViewPanel::onReadImage ....WARNING... Read dlg. all images creaImageIO ... ???\n");
00182 
00183         creaMaracasVisuKernel::OpenImageDialog diag = creaMaracasVisuKernel::OpenImageDialog();
00184         _colorLayerImageView->SetImage( diag.getImageData() );
00185 
00186         double spc[3];
00187         diag.getImageData()->GetSpacing(spc);
00188 
00189         int dim[3];
00190         int ext[6];
00191         diag.getImageData()->GetWholeExtent(ext);
00192         dim[0] = ext[1]-ext[0];
00193         dim[1] = ext[3]-ext[2];
00194         dim[2] = ext[5]-ext[4];
00195         _sl_SliceImage->SetRange( 0 , dim[2] );
00196 
00197         if ( (spc[0]!=_spcBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2]) ||
00198                  (dim[0]!=_dimBase[0]) || (spc[1]!=_spcBase[1]) || (spc[2]!=_spcBase[2])
00199                 )
00200         {
00201 
00202                 bool transformOkDlg;
00203                 int typeOfTransformation;
00204                 wxString msg = _T("The image resolution of both images are not compatible. Do you want to tranform it? ");
00205             wxDlgTransformByDimensionBySpacingByPixel dlg;
00206                 dlg.GetTransformType(this,msg,typeOfTransformation,transformOkDlg);
00207 
00208 printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
00209 
00210                 if (typeOfTransformation==0)  // make dimensions equals
00211                 {
00212                         printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
00213                         spc[0]=_spcBase[0]*_dimBase[0]/dim[0];
00214                         spc[1]=_spcBase[1]*_dimBase[1]/dim[1];
00215                         spc[2] = 1;
00216                 }
00217 
00218                 if (typeOfTransformation==1)  // make spacing equals
00219                 {
00220                         spc[0] = ( _spcBase[0]/spc[0] ) * _spcOrg[0];
00221                         spc[1] = ( _spcBase[1]/spc[1] ) * _spcOrg[1];
00222                         spc[2] = ( _spcBase[2]/spc[2] ) * _spcOrg[2];
00223                 }
00224 
00225                 if (typeOfTransformation==2)  // make spacing = 1
00226                 {
00227                         spc[0] = 1;
00228                         spc[1] = 1;
00229                         spc[2] = 1;
00230                 }
00231 
00232                 diag.getImageData()->SetSpacing(spc);
00233         } // spc !_spcBase   dim!__dimBase
00234 
00235         if (_colorLayerImageView!=NULL)
00236         {
00237         _colorLayerImageView->onThreshold();
00238         _colorLayerImageView->Refresh();
00239         }
00240 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onSliceFixDinamic ( wxCommandEvent &  event  )  [private]

Definition at line 296 of file ColorLayerImageViewPanel.cxx.

References _cb_SliceFixDinamic, _colorLayerImageView, _sl_SliceImage, LayerImageBase::onThreshold(), LayerImageBase::Refresh(), ColorLayerImageView::SetSliceFixDinamic(), and ColorLayerImageView::SetZ2().

Referenced by ColorLayerImageViewPanel().

00297 {
00298         if (_colorLayerImageView!=NULL)
00299         {
00300         bool fixdin = _cb_SliceFixDinamic->GetValue();
00301         _colorLayerImageView->SetSliceFixDinamic( fixdin );
00302         if (fixdin==false)
00303         {
00304             _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
00305         }
00306         _sl_SliceImage->Enable(!fixdin);
00307         _colorLayerImageView->onThreshold();
00308         _colorLayerImageView->Refresh();
00309         }//_colorLayerImageView
00310 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onSliceImage ( wxScrollEvent &  event  )  [private]

Definition at line 313 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _sl_SliceImage, LayerImageBase::onThreshold(), LayerImageBase::Refresh(), and ColorLayerImageView::SetZ2().

Referenced by ColorLayerImageViewPanel().

00314 {
00315         if (_colorLayerImageView!=NULL)
00316         {
00317         _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
00318         _colorLayerImageView->onThreshold();
00319         _colorLayerImageView->Refresh();
00320         }//_colorLayerImageView
00321 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onThresholdChange ( wxCommandEvent &  event  )  [private]

Definition at line 243 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _thresholdGo, LayerImageBase::onThresholdChange(), and LayerImageBase::Refresh().

00244 {
00245         if (_colorLayerImageView!=NULL)
00246         {
00247         if (_thresholdGo)
00248         {
00249             _colorLayerImageView->onThresholdChange();
00250             _colorLayerImageView->Refresh();
00251             //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal  << std::endl;
00252         } // _threshold
00253         }//_colorLayerImageView
00254 }

Here is the call graph for this function:

void ColorLayerImageViewPanel::onThresholdInterpolation ( wxCommandEvent &  event  )  [private]

Definition at line 286 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _interpolationCheckBox, LayerImageBase::onThresholdInterpolation(), and LayerImageBase::Refresh().

Referenced by ColorLayerImageViewPanel().

00287 {
00288         if (_colorLayerImageView!=NULL)
00289         {
00290         _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
00291         _colorLayerImageView->Refresh();
00292         }//_colorLayerImageView
00293 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onThresholdShow ( wxCommandEvent &  event  )  [private]

Definition at line 257 of file ColorLayerImageViewPanel.cxx.

References _cb_ShowHide, _colorLayerImageView, _thresholdGo, LayerImageBase::onThreshold(), LayerImageBase::onThresholdRemove(), and LayerImageBase::Refresh().

Referenced by ColorLayerImageViewPanel().

00258 {
00259         if (_colorLayerImageView!=NULL)
00260         {
00261         _thresholdGo = _cb_ShowHide->GetValue();
00262         if (_thresholdGo)
00263         {
00264             _colorLayerImageView->onThreshold();
00265         }else{
00266             _colorLayerImageView->onThresholdRemove( );
00267         }
00268         _colorLayerImageView->Refresh();
00269         }//_colorLayerImageView
00270 }

Here is the call graph for this function:

Here is the caller graph for this function:

void ColorLayerImageViewPanel::onThresholdStop (  ) 

Definition at line 273 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView, _thresholdGo, and LayerImageBase::onThresholdRemove().

00274 {
00275         if (_colorLayerImageView!=NULL)
00276         {
00277         if (_thresholdGo)
00278         {
00279             _colorLayerImageView->onThresholdRemove( );
00280             _thresholdGo=false;
00281         }
00282         }//_colorLayerImageView
00283 }

Here is the call graph for this function:

void ColorLayerImageViewPanel::SetBaseDimension ( int  dim[3]  ) 

Definition at line 168 of file ColorLayerImageViewPanel.cxx.

References _dimBase.

00169 {
00170         _dimBase[0] = dim[0];
00171         _dimBase[1] = dim[1];
00172         _dimBase[2] = dim[2];
00173 }

void ColorLayerImageViewPanel::SetBaseSpacing ( double  spc[3]  ) 

Definition at line 148 of file ColorLayerImageViewPanel.cxx.

References _spcBase.

00149 {
00150         _spcBase[0] = spc[0];
00151         _spcBase[1] = spc[1];
00152         _spcBase[2] = spc[2];
00153 
00154         _spcBase[0] = 1;
00155         _spcBase[1] = 1;
00156         _spcBase[2] = 1;
00157 }

void ColorLayerImageViewPanel::SetColorLayerImageView ( ColorLayerImageView colorLayerImageView  ) 

Definition at line 135 of file ColorLayerImageViewPanel.cxx.

References _colorLayerImageView.

00136 {
00137         _colorLayerImageView = colorLayerImageView;
00138 }

void ColorLayerImageViewPanel::SetOriginalSpacing ( double  spc[3]  ) 

Definition at line 160 of file ColorLayerImageViewPanel.cxx.

References _spcOrg.

00161 {
00162         _spcOrg[0] = spc[0];
00163         _spcOrg[1] = spc[1];
00164         _spcOrg[2] = spc[2];
00165 }


Member Data Documentation

Definition at line 54 of file ColorLayerImageViewPanel.h.

Referenced by ColorLayerImageViewPanel().

Definition at line 57 of file ColorLayerImageViewPanel.h.

Referenced by ColorLayerImageViewPanel(), and onThresholdShow().

Definition at line 58 of file ColorLayerImageViewPanel.h.

Referenced by ColorLayerImageViewPanel(), and onSliceFixDinamic().

Definition at line 55 of file ColorLayerImageViewPanel.h.

Referenced by ColorLayerImageViewPanel(), and onChangeOpacity().

double ColorLayerImageViewPanel::_spcOrg[3] [private]

Definition at line 50 of file ColorLayerImageViewPanel.h.

Referenced by onReadImage(), and SetOriginalSpacing().


The documentation for this class was generated from the following files:

Generated on 20 Oct 2010 for creaMaracasVisu_lib by  doxygen 1.6.1