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);
wxRadioBox * radioOpts = new wxRadioBox(dial, -1, _T("Type of Transformation"), wxDefaultPosition, wxSize(270,45), 3 , lstOptOperation, 3, wxRA_SPECIFY_COLS);
dialSizer->Add( new wxStaticText(dial,-1,message) , 0, wxGROW );
- // dialSizer->Add( new wxStaticText(dial,-1,_T("selected Roi file. Do you want to tranform it?")) , 0, wxGROW );
dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
dialSizer->Add(radioOpts,0,wxGROW);
dialSizer->Add( new wxStaticText(dial,-1,_T(" ")) , 0, wxGROW );
** Begin of the threshold panel
**/
ColorLayerImageViewPanel::ColorLayerImageViewPanel(wxWindow* parent, int min, int max, int type)
-: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxBORDER_SUNKEN)
-{
- printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel start \n");
+//: wxPanel(parent, -1, wxDefaultPosition, wxSize(600,100), wxBORDER_SUNKEN)
- _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
- _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
+: wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
- _colorLayerImageView = new ColorLayerImageView();
- _btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
- _thresholdGo = true;
- _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide Layer") );
- _cb_ShowHide->SetValue(_thresholdGo);
- _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
- _cb_SliceFixDinamic->SetValue(true);
+{
+printf("EED ColorLayerImageViewPanel::ColorLayerImageViewPanel Start\n");
- _sl_SliceImage = new wxSlider(this, wxID_ANY, 0, 1000, 1000, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
- _sl_SliceImage->Enable(false);
+ _spcBase[0] = _spcBase[1] = _spcBase[2] = 0;
+ _dimBase[0] = _dimBase[1] = _dimBase[2] = 0;
- _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);
+ _cb_ShowHide = NULL;
+ _sl_SliceImageX = NULL;
+ _sl_SliceImageY = NULL;
+ _sl_SliceImageZ = NULL;
+ _histogram = NULL;
+ _histogramMinMaxLevel = NULL;
- if (type==0)
- {
- }
+ wxFlexGridSizer * sizer = new wxFlexGridSizer(1);
+ _colorLayerImageViewManager = new ColorLayerImageViewManager();
if (type==1)
{
- }
-
-
- Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
- Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
- Connect( _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 );
+ _btn_ReadImage = new wxButton(this, wxID_ANY, _T("Read Image") );
+ _thresholdGo = true;
+ _cb_ShowHide = new wxCheckBox(this, wxID_ANY, _T("Show/Hide Layer") );
+ _cb_ShowHide->SetValue(_thresholdGo);
+ _cb_SliceFixDinamic = new wxCheckBox(this, wxID_ANY, _T("Fixed/Dynamic Slice") );
+ _cb_SliceFixDinamic->SetValue(true);
+ _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);
+ _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 );
+
+ Connect( _btn_ReadImage->GetId(), wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onReadImage );
+ Connect( _cb_ShowHide->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED , (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdShow );
+ Connect( _interpolationCheckBox->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onThresholdInterpolation );
+ Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
+ Connect( _cb_SliceFixDinamic->GetId(), wxEVT_COMMAND_CHECKBOX_CLICKED, (wxObjectEventFunction) &ColorLayerImageViewPanel::onSliceFixDinamic );
+
+ 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 );
+
+ 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( _histogramMinMaxLevel->GetWindow() , 1, wxGROW );
+
+ } // type==1
+
+
+ if (type==2)
+ {
+ _opacity = new wxSlider(this, wxID_ANY, 6, 0, 10, wxDefaultPosition, wxSize(2,40), wxSL_HORIZONTAL|wxSL_LABELS, wxDefaultValidator);
+ Connect( _opacity->GetId(), wxEVT_SCROLL_THUMBTRACK, (wxObjectEventFunction) &ColorLayerImageViewPanel::onChangeOpacity );
+// sizer -> Add( new wxStaticText(this,-1,_T("Opacity Level")) , 1, wxEXPAND );
+ sizer -> Add( _opacity ,1,wxGROW );
+ sizer->AddGrowableCol(0);
+ } // type==2
- 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("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_SliceImage, 1, wxGROW );
- sizer -> Add( _cb_SliceFixDinamic, 1, wxGROW );
this->SetSizer( sizer );
- this->SetAutoLayout( true );
- this->Layout();
+// this->SetAutoLayout( true );
+// this->Layout();
//CM Sets the default fitting mode to Pixel mode.
_fitting_mode = 3;
- // EO CM
+ // EO CM EED
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-void ColorLayerImageViewPanel::SetColorLayerImageView(ColorLayerImageView* colorLayerImageView)
+ColorLayerImageViewManager* ColorLayerImageViewPanel::GetColorLayerImageViewManager()
{
- _colorLayerImageView = colorLayerImageView;
-}
-
-//----------------------------------------------------------------------------
-ColorLayerImageView* ColorLayerImageViewPanel::GetColorLayerImageView()
-{
- return _colorLayerImageView;
+ return _colorLayerImageViewManager;
}
+//----------------------------------------------------------------------------
// This is the new spacing of the background image (1,1,1)
void ColorLayerImageViewPanel::SetBaseSpacing(double spc[3])
{
_spcBase[2] = 1;
}
+//----------------------------------------------------------------------------
// This is the Original spacing of the background image
void ColorLayerImageViewPanel::SetOriginalSpacing(double spc[3])
{
_spcOrg[2] = spc[2];
}
+//----------------------------------------------------------------------------
// This is the size in pixels of the background image
void ColorLayerImageViewPanel::SetBaseDimension(int dim[3])
{
{
if (img!=NULL)
{
- _colorLayerImageView->SetImage( img );
+ if (_histogramMinMaxLevel!=NULL)
+ {
+ _histogramMinMaxLevel->Configure( 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] );
+
+
+ if (_sl_SliceImageX!=NULL)
+ {
+ _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])
else
typeOfTransformation = _fitting_mode;
//EO CM
-
- printf("EED ColorLayerImageViewPanel::onReadImage call dialog spc size,dim...???\n");
-
if (typeOfTransformation==1) // make dimensions equals
{
printf("EED ColorLayerImageViewPanel::onReadImage ...WARNNING.... dif size image spc*dim ofnew image ...???\n");
img->SetSpacing(spc);
} // spc !_spcBase dim!__dimBase
+ } // _firsttime_mode
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }
+ if (_active==true)
+ {
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
+ } // _ative
+}
- }
+
+void ColorLayerImageViewPanel::RefreshView()
+{
+//EED01 _colorLayerImageView->Refresh();
+ _colorLayerImageViewManager->Refresh();
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
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
+ if (_thresholdGo)
+ {
+ _colorLayerImageViewManager->onThresholdChange();
+ RefreshView();
+ //std::cout<< "Valor Min: " << minVal << " & Valor Max: " << maxVal << std::endl;
+ } // _thresholdGo
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdShow(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
_thresholdGo = _cb_ShowHide->GetValue();
+ _active = _thresholdGo;
if (_thresholdGo)
{
- _colorLayerImageView->onThreshold();
+ _colorLayerImageViewManager->onThreshold();
}else{
- _colorLayerImageView->onThresholdRemove( );
+ _colorLayerImageViewManager->onThresholdRemove( );
}
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ RefreshView();
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdStop()
{
- if (_colorLayerImageView!=NULL)
- {
- if (_thresholdGo)
- {
- _colorLayerImageView->onThresholdRemove( );
- _thresholdGo=false;
- }
- }//_colorLayerImageView
+ if (_thresholdGo)
+ {
+ _colorLayerImageViewManager->onThresholdRemove( );
+ _thresholdGo=false;
+ }
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onThresholdInterpolation(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->onThresholdInterpolation(_interpolationCheckBox->GetValue());
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ _colorLayerImageViewManager->onThresholdInterpolation(_interpolationCheckBox->GetValue());
+ RefreshView();
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onSliceFixDinamic(wxCommandEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
bool fixdin = _cb_SliceFixDinamic->GetValue();
- _colorLayerImageView->SetSliceFixDynamic( fixdin );
+ _colorLayerImageViewManager->SetSliceFixDynamic( fixdin );
if (fixdin==false)
{
- _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);
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onSliceImage(wxScrollEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- _colorLayerImageView->SetZ2( _sl_SliceImage->GetValue() );
- _colorLayerImageView->onThreshold();
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ _colorLayerImageViewManager->SetX2( _sl_SliceImageX->GetValue() );
+ _colorLayerImageViewManager->SetY2( _sl_SliceImageY->GetValue() );
+ _colorLayerImageViewManager->SetZ2( _sl_SliceImageZ->GetValue() );
+ _colorLayerImageViewManager->onThreshold();
+ RefreshView();
}
//----------------------------------------------------------------------------
void ColorLayerImageViewPanel::onChangeOpacity(wxScrollEvent& event)
{
- if (_colorLayerImageView!=NULL)
- {
- int opacity = _opacity->GetValue();
- _colorLayerImageView->onThresholdChangeOpacity(opacity);
- _colorLayerImageView->Refresh();
- }//_colorLayerImageView
+ int opacity = _opacity->GetValue();
+ _colorLayerImageViewManager->onThresholdChangeOpacity(opacity);
+ RefreshView();
}
return _thresholdGo;
}
+//----------------------------------------------------------------------------
+void ColorLayerImageViewPanel::SetActive(bool active)
+{
+ _active=active;
+ if (_cb_ShowHide!=NULL)
+ {
+ _cb_ShowHide->SetValue( _active );
+ }
+}
// EOF