+/*# ---------------------------------------------------------------------
+#
+# 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 "bbmaracasvisuShowNPoints.h"
#include "bbcreaMaracasVisuPackage.h"
#include "vtkPolyDataMapper.h"
#include "vtkRenderWindow.h"
#include "vtkTextActor3D.h"
+#include <vtkTextProperty.h>
namespace bbcreaMaracasVisu
{
// Widget interface
wxButton *btnSetPositionPoint = new wxButton( panel, -1, _T("Set nearest point"));
txtNrPoints = new wxStaticText(panel,-1, _T(" "));
-
+
//NTU: Sliders for opacity and radio change
wxStaticText* txOpacity = new wxStaticText(this, -1, wxString(_T(" Points Opacity ")));
sdrOpacity = new wxSlider(this, -1, 0, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
Connect(btnSetPositionPoint->GetId() , wxEVT_COMMAND_BUTTON_CLICKED , (wxObjectEventFunction) &WidgetShowNPoints::OnSetPoint);
Connect(sdrOpacity->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
Connect(sdrRadio->GetId() , wxEVT_COMMAND_SLIDER_UPDATED , (wxObjectEventFunction) &WidgetShowNPoints::UpdatePoints);
-
+
sizer1->Add(btnSetPositionPoint);
sizer1->Add(txtNrPoints);
sizer1->Add(txOpacity);
sizer1->Add(sdrRadio,1,wxGROW );
sizer = sizer1;
}
-
+
+ if (mbbShowNPoints->bbGetInputType() == 2) {
+ askPointLabel = new wxStaticText(panel, -1, _T("\nPOINT CONTROLS:")); // JPR
+
+ wxButton *btnAddPoint = new wxButton(panel, -1, _T(" Add Point "));
+ wxButton *btnDeleteAllPoints = new wxButton(panel, -1, _T(" Delete All "));
+ wxStaticText* spacer = new wxStaticText(panel, -1, _T("\n")); // JPR
+ textCtrl = new wxTextCtrl(panel, -1);
+
+ wxFlexGridSizer *sizer1 = new wxFlexGridSizer(1);
+
+ Connect(btnAddPoint->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnAddPoint);
+ Connect(btnDeleteAllPoints->GetId(), wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction) & WidgetShowNPoints::OnDeleteAllPoints);
+
+ sizer1->Add(askPointLabel);
+ sizer1->Add(btnAddPoint);
+ sizer1->Add(btnDeleteAllPoints);
+ sizer1->Add(spacer);
+ sizer1->Add(textCtrl);
+
+ sdrOpacity = new wxSlider();
+ sdrRadio = new wxSlider();
+
+ txtNrPoints = new wxStaticText(panel, -1, _T("\n\n\n"));
+
+ sizer = sizer1;
+ }
if (sizer!=NULL)
{
panel->SetSizer(sizer);
{
}
+//------------------------------------------------------------------------
void WidgetShowNPoints::SetRadio(double radio)
{
this->mradio=radio;
{
this->mopacity=opacity;
//NTU: For Slider
- sdrOpacity->SetValue(this->mopacity/100.0);
+ sdrOpacity->SetValue(this->mopacity*100.0);
}
//------------------------------------------------------------------------
vtkActor *sphereActor = vtkActor::New();
sphereActor->SetMapper(sphereMapper);
sphereActor->SetOrigin(0, 0, 0);
-
-
+
/*EED Borrame
double spc[3];
if(mimage==NULL){
sphereActor->GetProperty()->SetColor( mcolour[0] , mcolour[1] , mcolour[2] );
sphereActor->GetProperty()->SetOpacity( mopacity );
*/
-
+
lstActorsSphere.push_back(sphereActor);
if(renderer==NULL){
wxMessageDialog dialog(this, _T("Renderer Not Set"),_T("Renderer Not Set"),wxICON_ERROR);
lstActorsText.push_back(textActor);
RefreshPoint(lstPointsX.size()-1);
- SetOutputBox();
}
//------------------------------------------------------------------------
if (this->renderer!=NULL){
if (mpoint.size()==3){
AddPoint(mpoint[0],mpoint[1],mpoint[2], (const char*) ( textCtrl->GetValue().mb_str() ) );
+ SetOutputBox();
} else {//mpoint.size
printf("creaMaracasVisu::ShowNPoints (not match point) \n");
}
//EED
int result_FD = FD->ShowModal();
-
+ std::string tmpLabel;
+
// This line is need it by windows //EED
FD->SetReturnCode( result_FD );
y=lstPointsY[i];
z=lstPointsZ[i];
value= mimage->GetScalarComponentAsDouble(x,y,z,0);
- fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , lstLabels[i].c_str());
+ if (lstLabels[i]!="")
+ {
+ tmpLabel=lstLabels[i];
+ } else{
+ tmpLabel="<_VOID_>";
+ }
+ fprintf(ff,"%d\t%d\t%d\t%f\t%s\n", x , y , z , value , tmpLabel.c_str());
} // for
fclose(ff);
} else { // else ff
for (i=0; i<size; i++)
{
fscanf(ff,"%d%d%d%f%s",&x,&y,&z,&value,chartmp ); // x,y,z,value,label
+ if (strcmp(chartmp,"<_VOID_>")==0) { strcpy(chartmp,""); }
AddPoint(x,y,z, chartmp );
}
+ SetOutputBox();
fclose(ff);
} else { // else ff
printf("WidgetShowNPoints::OnLoadPoints ...Error... reading file");
{
id=0;
AddPoint(0,0,0,"");
+ SetOutputBox();
}
}
}
-
//------------------------------------------------------------------------
void WidgetShowNPoints::OnRenamePoint(wxCommandEvent& event)
{
{
this->lstSourceSphere[i]->SetRadius(mradio);
this->lstActorsSphere[i]->GetProperty()->SetOpacity(mopacity);
+ this->lstActorsText[i]->GetTextProperty()->SetOpacity(mopacity);
this->lstActorsText[i]->SetPosition(this->lstActorsText[i]->GetPosition()[0]+difradio,this->lstActorsText[i]->GetPosition()[1], this->lstActorsText[i]->GetPosition()[2]);
}
//NTU: For updating
- SetOutputBox();
+//EED SetOutputBox();
+ renderer->GetRenderWindow()->Render();
+
}
BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ShowNPoints)
BBTK_BLACK_BOX_IMPLEMENTATION(ShowNPoints,bbtk::WxBlackBox);
+//-----------------------------------------------------------------
void ShowNPoints::Process()
{
if (mwxwidget!=NULL)
bbSetOutputlstPointsY( mwxwidget->GetLstPointsY() );
bbSetOutputlstPointsZ( mwxwidget->GetLstPointsZ() );
bbSetOutputlstLabels( mwxwidget->GetLstLabels() );
+
} // mwxwidget
}
+//-----------------------------------------------------------------
void ShowNPoints::CreateWidget(wxWindow* parent)
{
mwxwidget = new WidgetShowNPoints( parent, this);
- bbSetOutputWidget( mwxwidget );
+ bbSetOutputWidget( mwxwidget );
}
+//-----------------------------------------------------------------
void ShowNPoints::bbUserSetDefaultValues()
{
- mwxwidget = NULL;
+ mwxwidget = NULL;
- bbSetInputRadio(1);
+ bbSetInputRadio(10);
bbSetInputOpacity(1);
std::vector<double> colour;