#include "bbcreaMaracasVisuPackage.h"
-
namespace bbcreaMaracasVisu
{
// Contorno 1
+
if ( bbGetInputwxVtkBaseView() != NULL )
{
if (_manContourControl_1==NULL)
// marImageData *marimagedata = new marImageData( bbGetInputIn() );
marImageData *marimagedata = new marImageData( reader->GetOutput() );
- wxManualTree_MPRWidget *window = new wxManualTree_MPRWidget( parent,marimagedata ,1);
+ wxManualTree_MPRWidget *window = new wxManualTree_MPRWidget( parent,marimagedata );
window->ConfigureVTK();
bbSetOutputWidget( window );
mbbViewerMPR = box;
- wxwidget = new wxMPRWidget2( panel, marimagedata , 1 );
+ wxwidget = new wxMPRWidget2( panel, marimagedata );
if(marimagedata != NULL){
wxwidget->ConfigureVTK();
panel -> Layout();
}
- void wxWidgetMPR::setImageData(vtkImageData* img){
- wxwidget->setImageData(img, 1);
+ void wxWidgetMPR::setImageData(vtkImageData* img)
+ {
+ wxwidget->setImageData(img);
}
- void wxWidgetMPR::ConfigureVTK(){
+
+ void wxWidgetMPR::ConfigureVTK()
+ {
wxwidget->ConfigureVTK();
- }
+ }
+
//--------------------------------------------------------------------------
wxWidgetMPR::~wxWidgetMPR()
{
_chargecontrolpointsY.push_back(y);
_chargecontrolpointsZ.push_back(z);
}
- _pathsize = _mContourModel->GetPathSize();
+
+// EED 2017-05-30
+// _pathsize = _mContourModel->GetPathSize( );
+ double spc[3];
+ spc[0]=1;
+ spc[1]=1;
+ spc[2]=1;
+ _pathsize = _mContourModel->GetPathSize( spc );
+
+
//printf("\nPATH SIZE = %f",_pathsize);
std::ofstream file1;
_sizePointsContour = size;
}
// ---------------------------------------------------------------------------
-double manualBaseModel::GetPathSize()
+double manualBaseModel::GetPathSize(double *spc)
{
return 0.0;
}
}
// ---------------------------------------------------------------------------
-double manualBaseModel::GetPathArea()
+double manualBaseModel::GetPathArea( double *spc )
{
return 0.0;
}
virtual int GetIdPoint(double x, double y, double z, int i_range,int type);
virtual manualPoint* GetManualPoint(int id);
virtual int GetSizeLstPoints();
- virtual double GetPathSize();
+ virtual double GetPathSize(double *spc);
virtual void Transform_Ax_Plus_B (double Ax, double Bx, double Ay, double By);
virtual void GetSpline_i_Point(int i, double *x, double *y, double *z);
virtual void GetSpline_t_Point(double t, double *x, double *y, double *z);
// @return std::vector<manualBaseModel*>
//
virtual std::vector<manualBaseModel*> ExploseModel( );
- virtual double GetPathArea();
+ virtual double GetPathArea(double *spc);
virtual void GetNearestPointAndNormal(double *p, double *rp, double *rn);
virtual void SetCloseContour(bool closeContour);
}
}*/
// ----------------------------------------------------------------------------
-double manualContourModel::GetPathSize()
+double manualContourModel::GetPathSize(double *spc)
{
double result = 0;
double x1,y1,z1;
if (_lstPoints.size()==2)
{
- x1=_lstPoints[0]->GetX();
- y1=_lstPoints[0]->GetY();
- z1=_lstPoints[0]->GetZ();
- x2=_lstPoints[1]->GetX();
- y2=_lstPoints[1]->GetY();
- z2=_lstPoints[1]->GetZ();
+ x1 = spc[0] * _lstPoints[0]->GetX();
+ y1 = spc[1] * _lstPoints[0]->GetY();
+ z1 = spc[2] * _lstPoints[0]->GetZ();
+ x2 = spc[0] * _lstPoints[1]->GetX();
+ y2 = spc[1] * _lstPoints[1]->GetY();
+ z2 = spc[2] * _lstPoints[1]->GetZ();
result = sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
}
if (_lstPoints.size()>2)
//GetSplinePoint(0,x1,y1,z1);
GetSpline_i_Point(0,&x1,&y1,&z1);
+ x1 = spc[0] * x1;
+ y1 = spc[1] * y1;
+ z1 = spc[2] * z1;
//for( i = 1; i < nps; i++ )
for( i = 1; i < GetNumberOfPointsSpline(); i++ )
{
//t = delta * (double)i;
//GetSplinePoint(t,x2,y2,z2);
GetSpline_i_Point(i,&x2,&y2,&z2);
+ x2 = spc[0] * x2;
+ y2 = spc[1] * y2;
+ z2 = spc[2] * z2;
//---------------------------------------------------------
result=result + sqrt( (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1) + (z2-z1)*(z2-z1) );
x1=x2;
return result;
}
+
+
// ----------------------------------------------------------------------------
-double manualContourModel::GetPathArea()
+double manualContourModel::GetPathArea(double *spc)
{
double result = 555;
if ((_lstPoints.size()>=3) && IfCloseContour()==true )
GetSpline_i_Point(i,&x1,&y1,&z1);
GetSpline_i_Point(j,&x2,&y2,&z2);
//----------------------------------------------------------------
+ x1=spc[0]*x1;
+ y1=spc[1]*y1;
+ z1=spc[2]*z1;
+ x2=spc[0]*x2;
+ y2=spc[1]*y2;
+ z2=spc[2]*z2;
area +=
(x1 * y2 ) -
( x2 * y1 );
rn[1]=rp[1]-y1;
rn[2]=rp[2]-z1;
}
- }
- else
- {
+ } else {
rp[0] = 0;
rp[1] = 0;
rp[2] = 0;
//void GetSplinePoint(double t, double &x, double &y, double &z); //Method Original
//void GetSplineiPoint(int i, double &x, double &y, double &z); //Method Original
//-------------------------------------------------------------------------------
- virtual double GetPathSize();
- virtual double GetPathArea();
+ virtual double GetPathSize(double *spc);
+ virtual double GetPathArea(double *spc);
void GetNearestPointAndNormal(double *p, double *rp, double *rn);
vtkTextProperty *tprop = _textActor->GetTextProperty();
tprop->SetFontSize(14);
tprop->SetFontFamilyToArial();
- tprop->SetColor(0, 0, 1);
+ tprop->SetColor(1, 1, 0);
// Text 2
vtkTextProperty *tprop2 = _textActor2->GetTextProperty();
tprop2->SetFontSize(14);
tprop2->SetFontFamilyToArial();
- tprop2->SetColor(0, 0, 1);
+ tprop2->SetColor(1, 1, 0);
}
manualViewContour::manualViewContour()
{
_id_viewPoint_for_text = 0;
- _mesureScale = 1;
_initialConoturModel = new manualContourModel();
_minX = 99999;
{
// Call to Fathers object
manualViewBaseContour::CopyAttributesTo(cloneObject);
-
- cloneObject->SetMesureScale(_mesureScale);
}
// ---------------------------------------------------------------------------
// ----------------------------------------------------------------------------
void manualViewContour::RefreshText() // virtual
{
+
if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
int size = GetNumberOfPoints();
char text[50];
strcpy(resultText, "000");
char resultText2[250];
strcpy(resultText2, "000");
+ double spcP[3];
+ spcP[0]=1;
+ spcP[1]=1;
+ spcP[2]=1;
//CMRU 19-08-09 ----------------------------------
std::string label;
label = _manContModel->GetLabel();
// ------------------------------------
-
+
if (size==2)
{
strcpy(resultText,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( spcP ), 5, text );
strcat(resultText,text);
strcat(resultText,"p");
strcat(resultText,label.c_str());
strcpy(resultText2,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
strcat(resultText2,text);
strcat(resultText2,"u");
if (_manContModel->IfCloseContour()==true)
{
strcpy(resultText,"P= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( spcP ), 5, text );
strcat(resultText,text);
strcat(resultText,"p");
- gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea(), 5, text );
+ gcvt ( this->_manContModel->GetPathArea( spcP ), 5, text );
strcat(resultText," A= ");
strcat(resultText,text);
strcat(resultText,"p^2 ");
strcpy(resultText2,"P= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
strcat(resultText2,text);
strcat(resultText2,"u");
- gcvt ( _mesureScale * _mesureScale * this->_manContModel->GetPathArea(), 5, text );
+ gcvt ( this->_manContModel->GetPathArea( _spc ), 5, text );
strcat(resultText2," A= ");
strcat(resultText2,text);
strcat(resultText2,"u^2 ");
} else {
strcpy(resultText,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( spcP ), 5, text );
strcat(resultText,text);
strcat(resultText,"p");
strcpy(resultText2,"L= ");
- gcvt ( _mesureScale * this->_manContModel->GetPathSize(), 5, text );
+ gcvt ( this->_manContModel->GetPathSize( _spc ), 5, text );
strcat(resultText2,text);
strcat(resultText2,"u");
manualViewBaseContour::DeletePoint( id );
}
-//-------------------------------------------------------------------
-void manualViewContour::SetMesureScale(double mesureScale)
-{
- _mesureScale = mesureScale;
-}
//-------------------------------------------------------------------
void manualViewContour::InitMove(int x, int y, int z)
{
this->_initialConoturModel->AddPoint( mp->GetX() - XX, mp->GetY() - YY, mp->GetZ() );
}
}
+
//-------------------------------------------------------------------
void manualViewContour::MoveContour(int x, int y, int z)
{
manualPoint *mpOrigin = NULL;
manualPoint *mpMoving = NULL;
- double XX=x;
- double YY=y;
- double ZZ=z;
+ double XX = x;
+ double YY = y;
+ double ZZ = z;
TransfromCoordViewWorld(XX,YY,ZZ);
}
UpdateViewPoints();
}
+
+//-------------------------------------------------------------------
void manualViewContour::MoveContour(int horizontalUnits, int verticalUnits )
{
manualPoint *mpOrigin = NULL;
virtual ~manualViewContour();
virtual manualViewContour * Clone();
void CopyAttributesTo( manualViewContour *cloneObject );
-
virtual int GetType();
virtual void Save(FILE *pFile);
virtual void Open(FILE *pFile);
-
-
virtual void RefreshContour();
virtual bool ifTouchContour(int x,int y, int z);
virtual void InitMove(int x, int y, int z);
virtual void MoveContour(int horizontalUnits, int verticalUnits );
virtual void DeletePoint(int id);
virtual void ClearPoint(int id);
- void SetMesureScale(double mesureScale);
private:
- double _mesureScale;
std::vector< std::vector<double> > _initialMovingPoints;
manualContourModel * _initialConoturModel;
virtual void RefreshText();
-
protected:
double _minX;
double _minY;
double _minZ;
double _maxX;
double _maxY;
- double _maxZ;
-
+ double _maxZ;
};
#endif // manualViewContour_h
//
// Point spacing (def=1)
//
- double _spc[3];
+ double _spc[3];
// Point normal color
- double _colorNormal_r;
- double _colorNormal_g;
- double _colorNormal_b;
+ double _colorNormal_r;
+ double _colorNormal_g;
+ double _colorNormal_b;
// Posible selected point color
- double _colorPosibleSelected_r;
- double _colorPosibleSelected_g;
- double _colorPosibleSelected_b;
+ double _colorPosibleSelected_r;
+ double _colorPosibleSelected_g;
+ double _colorPosibleSelected_b;
};
#endif // manualViewPoint_h
manualViewPoints::~manualViewPoints()
{
int i,size=_copyViewPoints.size();
- for (i=0;i<size; i++){
+ for (i=0;i<size; i++)
+ {
delete _copyViewPoints[i];
}
_copyViewPoints.clear();
int id = _manContModel->GetIdPoint(xx,yy,zz,_range,2);
- if(id!=-1){
+ if(id!=-1)
+ {
result = true;
}
int np = GetNumberOfPoints();
int copynp= _copyViewPoints.size();
- while(copynp!=np){
+ while(copynp!=np)
+ {
if(copynp<np)
{
wxMPRWidget::wxMPRWidget( wxWindow* parent,
- marImageData *marimageData , double voxelSize)
+ marImageData *marimageData )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
if(marimageData!=NULL){
_marImageData = marimageData;
- _voxelSize = voxelSize;
_vtkmprbasedata = new vtkMPRBaseData();
_vtkmprbasedata->SetMarImageData(_marImageData);
}
//----------------------------------------------------------------------------
-void wxMPRWidget::setImageData(vtkImageData * img, double voxelsize)
+void wxMPRWidget::setImageData(vtkImageData * img)
{
if(_marImageData!=NULL){
_marImageData = new marImageData(img);
}
- _voxelSize = voxelsize;
-
if(_vtkmprbasedata==NULL){
_vtkmprbasedata = new vtkMPRBaseData();
_vtkmprbasedata->SetMarImageData(_marImageData);
if (_vtkplane2Dview!=NULL){_vtkplane2Dview -> Configure();}
if (_widgetMesure!=NULL){_widgetMesure -> ConfigureA(_vtkplane2Dview);}
if (_widgetMesure!=NULL){_widgetMesure -> SetActiveLink(true);}
- if (_widgetMesure!=NULL){_widgetMesure -> SetMesureScale( _voxelSize );}
if (_wxsphereview!=NULL){_wxsphereview -> Configure();}
if (_wxvtk3Dbaseview_MPRClipping3D!=NULL){_wxvtk3Dbaseview_MPRClipping3D -> Configure();}
// imageData->GetSpacing(spc);
// _widgetMesure_B->SetMesureScale(spc[0]);
- if (_widgetMesure_B!=NULL) {_widgetMesure_B->SetMesureScale( _voxelSize );}
-
if (_wxsphereview_B!=NULL) {_wxsphereview_B -> Configure();}
class creaMaracasVisu_EXPORT wxMPRWidget : public wxPanel
{
public:
- wxMPRWidget(wxWindow* parent,marImageData *marimageData = NULL,double voxelSize = -1);
+ wxMPRWidget(wxWindow* parent,marImageData *marimageData = NULL);
~wxMPRWidget( );
void ConfigureVTK();
//returns the 2d view of the specific direction (0|1|2)
wxVtkMPR2DView *GetWxvtkMPR2Dview(int direction);
- void setImageData(vtkImageData * img, double voxelsize);
+ void setImageData(vtkImageData * img);
private:
- double _voxelSize;
marImageData *_marImageData;
vtkMPRBaseData *_vtkmprbasedata;
wxVtkMPR2DView *_vtkmpr2Dview[3];
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-wxMPRWidget2::wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize)
-: wxMPRWidget(parent,marimagedata,voxelSize)
+wxMPRWidget2::wxMPRWidget2(wxWindow* parent,marImageData *marimagedata)
+: wxMPRWidget(parent,marimagedata)
{
}
//----------------------------------------------------------------------------
class creaMaracasVisu_EXPORT wxMPRWidget2 : public wxMPRWidget
{
public:
- wxMPRWidget2(wxWindow* parent,marImageData *marimagedata,double voxelSize);
+ wxMPRWidget2(wxWindow* parent,marImageData *marimagedata);
~wxMPRWidget2();
virtual void OnRefreshView(wxCommandEvent & event);
private:
wxManualTree_MPRWidget::wxManualTree_MPRWidget( wxWindow* parent,
- marImageData *marimageData ,double voxelSize )
+ marImageData *marimageData )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
- _voxelSize = voxelSize;
_marimageData = marimageData;
_wxvtk3Dbaseview_Clipping3D_C = NULL;
wxSplitterWindow *pnlSplitter = new wxSplitterWindow( this , -1);
int ww,hh;
- _MPRWidget2 = new wxMPRWidget2(pnlSplitter,_marimageData,voxelSize);
+ _MPRWidget2 = new wxMPRWidget2(pnlSplitter,_marimageData);
wxPanel * contour3DView = Create3DViewContour( pnlSplitter , _MPRWidget2->GetVtkMPRBaseData());
this->GetSize(&ww,&hh);
_mViewContour_2->SetModel( _mContourModel_2 );
_mViewContour_2->SetWxVtkBaseView( wxvtkbaseview );
_mViewContour_2->SetRange( 1 );
- _mViewContour_2->SetMesureScale( _voxelSize );
//EED 3 oct 2006
_mViewContour_2->SetSpacing(spc);
_mViewContour_0->SetModel( _mContourModel_2 );
_mViewContour_0->SetWxVtkBaseView( wxvtkbaseview );
_mViewContour_0->SetRange( 1 );
- _mViewContour_0->SetMesureScale( _voxelSize );
//EED 3 oct 2006
_mViewContour_0->SetSpacing(spc);
_mViewContour_1->SetModel( _mContourModel_2 );
_mViewContour_1->SetWxVtkBaseView( wxvtkbaseview );
_mViewContour_1->SetRange( 1 );
- _mViewContour_1->SetMesureScale( _voxelSize );
//EED 3 oct 2006
_mViewContour_1->SetSpacing(spc);
_mViewContour_p -> SetModel( _mContourModel_2 );
_mViewContour_p -> SetWxVtkBaseView( wxvtkbaseview );
_mViewContour_p -> SetRange( 1 );
- _mViewContour_p->SetMesureScale( _voxelSize );
//EED 3 oct 2006
_mViewContour_p->SetSpacing(spc);
_mViewContour_3D->SetModel( _mContourModel_2 );
_mViewContour_3D->SetWxVtkBaseView( wxvtkbaseview );
_mViewContour_3D->SetRange( 1 );
- _mViewContour_3D->SetMesureScale(_voxelSize );
//EED 3 oct 2006
_mViewContour_3D->SetSpacing(spc);
class wxManualTree_MPRWidget : public wxPanel
{
public:
- wxManualTree_MPRWidget( wxWindow* parent , marImageData *marimageData , double voxelSize );
+ wxManualTree_MPRWidget( wxWindow* parent , marImageData *marimageData );
~wxManualTree_MPRWidget( );
void ConfigureVTK();
private:
- double _voxelSize;
marImageData *_marimageData;
wxMPRWidget2 *_MPRWidget2;
if ( mwidgetMesure !=NULL ) { mwidgetMesure->ConfigureA(mvtkplane2Dview); }
if ( mwidgetMesure !=NULL ) { mwidgetMesure->ConfigureA(mvtkplane2Dview); }
if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetActiveLink(true); }
- if ( mwidgetMesure !=NULL ) { mwidgetMesure->SetMesureScale( 1 ); }
if ( mwxsphereview !=NULL ) { mwxsphereview->Configure(); }
_wxvtk2Dbaseview->RefreshView();
}
//-------------------------------------------------------------------
-void wxWidgetMesure2D::SetMesureScale(double mesureScale)
-{
- _mViewContour_1->SetMesureScale(mesureScale);
-}
-//-------------------------------------------------------------------
manualContourModel* wxWidgetMesure2D::GetManualContourModel()
{
return _mContourModel_1;
void OnCloseContour(wxCommandEvent& event);
void OnVisibleInformation(wxCommandEvent& event);
- void SetMesureScale(double mesureScale);
-
manualContourModel* GetManualContourModel();
virtual void ConfigureA(wxVtk2DBaseView *wxvtk2Dbaseview);
void CircleLine();
protected:
- virtual wxWindow *CreateWin1a(wxWindow *parent);
+ virtual wxWindow *CreateWin1a(wxWindow *parent);
private:
- wxCheckBox *_cb_line;
- wxCheckBox *_cb_circle;
+ wxCheckBox *_cb_line;
+ wxCheckBox *_cb_circle;
// Circle 1
vtkPoints *_ptsCircle1;
wxMaracasMPR::wxMaracasMPR( wxWindow* parent,
- marImageData* marimagedata , double voxelSize)
+ marImageData* marimagedata )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
_MPR=NULL;
wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
- _MPR = new wxMPRWidget( this, marimagedata , voxelSize);
+ _MPR = new wxMPRWidget( this, marimagedata);
szTop->Add( _MPR, 1 , wxGROW | wxALL , 0 );
this->SetAutoLayout( true );
this->SetSizer( szTop );
_MPR->RefreshView();
}
-void wxMaracasMPR::setImageData(vtkImageData *img, double voxelsize){
- _MPR->setImageData(img, voxelsize);
+void wxMaracasMPR::setImageData(vtkImageData *img, double voxelsize)
+{
+ _MPR->setImageData( img) ;
}
class creaMaracasVisu_EXPORT wxMaracasMPR : public wxPanel
{
public:
- wxMaracasMPR( wxWindow* parent, marImageData* marimagedata=NULL,double voxelSize=-1);
+ wxMaracasMPR( wxWindow* parent, marImageData* marimagedata=NULL);
~wxMaracasMPR( );
void ConfigureVTK();
vtkMPRBaseData *GetVtkMPRBaseData();
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
-wxMaracas_ManualTree_MPR::wxMaracas_ManualTree_MPR( wxWindow* parent, marImageData* marimagedata,double voxelSize )
+wxMaracas_ManualTree_MPR::wxMaracas_ManualTree_MPR( wxWindow* parent, marImageData* marimagedata )
: wxPanel( parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
// Create the main frame window
- _MPR = new wxManualTree_MPRWidget( this, marimagedata , voxelSize);
+ _MPR = new wxManualTree_MPRWidget( this, marimagedata );
wxBoxSizer* szTop = new wxBoxSizer( wxVERTICAL );
szTop->Add( _MPR, 1 , wxEXPAND | wxALL , 0 );
this->SetAutoLayout( true );
class wxMaracas_ManualTree_MPR : public wxPanel
{
public:
- wxMaracas_ManualTree_MPR( wxWindow* parent, marImageData* marimagedata,double voxelSize);
+ wxMaracas_ManualTree_MPR( wxWindow* parent, marImageData* marimagedata);
~wxMaracas_ManualTree_MPR( );
void ConfigureVTK();
vtkMPRBaseData *GetVtkMPRBaseData();