}
}
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+//AD: 02-09
+
+manualContourModelLine::manualContourModelLine()
+: manualContourModel()
+{
+ SetNumberOfPointsSpline(20);
+ this->SetCloseContour(false);
+}
+
+manualContourModelLine::~manualContourModelLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualContourModelLine * manualContourModelLine :: Clone() // virtual
+{
+ manualContourModelLine * clone = new manualContourModelLine();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualContourModelLine::CopyAttributesTo( manualContourModelLine * cloneObject)
+{
+ manualContourModel::CopyAttributesTo(cloneObject);
+}
+
+//----------------------------------------------------------------
+int manualContourModelLine::GetTypeModel() //virtual
+{
+ return 6;
+}
+
+
+//----------------------------------------------------------------
+/*
+void manualContourModelLine::GetSpline_i_Point(int i, double *x, double *y, double *z) // virtual
+{
+ int np = GetSizeLstPoints();
+ if (np==0)
+ {
+ *x = 0;
+ *y = 0;
+ *z = 0;
+ }
+ if (np==1)
+ {
+ manualPoint *mp;
+ mp = GetManualPoint(0);
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+ }
+ if (np==2)
+ {
+ manualPoint *mp;
+
+ if (i==0)
+ {
+ mp = GetManualPoint(0);
+ }
+ else if (i==1)
+ {
+ mp = GetManualPoint(1);
+ }
+
+ *x = mp->GetX();
+ *y = mp->GetY();
+ *z = mp->GetZ();
+ }
+
+}
+*/
+
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
*x = _ww*radio*angcos + _cx;
*y = _hh*radio*angsin + _cy;
- *z= -900;
+ *z= 900;
}
//----------------------------------------------------------------
}
_lstPoints.clear();
+ _cntSplineX->RemoveAllPoints();
+ _cntSplineY->RemoveAllPoints();
+ _cntSplineZ->RemoveAllPoints();
+
_cntSplineX->Delete();
_cntSplineY->Delete();
_cntSplineZ->Delete();
{
_delta_JSTG = (double) (np) / double (_sizePointsContour - 1); //Without the -1 the curve is not close
} else {
- _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
+// _delta_JSTG = (double) (np-1) / double (_sizePointsContour ); //Without the -1 the curve is not close
+ _delta_JSTG = (double) (np) / double (_sizePointsContour-1 ); //Without the -1 the curve is not close
}
//-----------------------------------------------------------------------------------------------------------
}
// 3 circle
// 4 BullEye
// 5 BullEyeSector
+ // 6 Line
return 1;
}
_pts = vtkPoints::New();
_pts->SetNumberOfPoints(8);
+
_pts->SetPoint(0, -1000 , -1000 , 0 );
- _pts->SetPoint(1, 1000 , -1000 , 0 );
+ _pts->SetPoint(1, 1000 , -1000 , 0 );
_pts->SetPoint(2, 1000 , 1000 , 0 );
_pts->SetPoint(3, -1000 , 1000 , 0 );
_pts->SetPoint(4, -1000 , 1000 , 0 );
_pts->SetPoint(5, -1000 , 1000 , 0 );
_pts->SetPoint(6, -1000 , 1000 , 0 );
_pts->SetPoint(7, -1000 , 1000 , 0 );
-
+
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell(17);
lines->InsertCellPoint(0);
_pd = vtkPolyData::New();
_pd->SetPoints( _pts );
_pd->SetLines( lines );
- lines->Delete(); //do not delete lines ??
+// lines->Delete(); //do not delete lines ??
_pointVtkActor = vtkActor::New();
_bboxMapper = vtkPolyDataMapper::New();
_bboxMapper->SetInput(_pd);
- _bboxMapper->ImmediateModeRenderingOn();
+// _bboxMapper->ImmediateModeRenderingOn();
_pointVtkActor->SetMapper(_bboxMapper);
- _pointVtkActor->GetProperty()->BackfaceCullingOn();
+// _pointVtkActor->GetProperty()->BackfaceCullingOn();
UpdateColorActor();
- _pd->ComputeBounds();
+// _pd->ComputeBounds();
return _pointVtkActor;
}
nps = _manContModel->GetNumberOfPointsSpline();
//delta=( double ) ( np ) / ( double ) ( nps-1 ); //JSTG 25-02-08
-//printf ("EED manualViewContour::RefreshContour>> %d %d \n", np,nps);
if ( _pts!=NULL )
{
// EED 27 sep 2006
// _pts->SetPoint(i, x,y,z );
_pts->SetPoint(i , x*_spc[0] , y*_spc[1] , z*_spc[2] );
-//if (i%15==0)
-//{
-// printf ("EED manualViewContour::RefreshContour>> %d : %f %f %f \n", i,x,y,z);
-//}
}// for
// ----------------------------------------------------------------------------
void manualViewContour::RefreshText() // virtual
{
-
if ((_textActor!=NULL) && ( _textActor->GetProperty()->GetOpacity()!=0 )){
int size = GetNumberOfPoints();
char text[50];
}
}
- _textActor -> SetInput(resultText);
-
+ _textActor->SetInput(resultText);
+
if (size>=1){
int i;
yy = yy * _spc[1];
zz = zz * _spc[2];
-
unsigned int i, nps,nps_t;
nps = _sizePointsContour;
+
if (this->_manContModel->IfCloseContour()==true)
{
nps_t = nps;
nps_t = nps-1;
}
- for( i = 0; i < nps_t; i++ ) {
+
+ for( i = 0; i < nps_t; i++ )
+ {
_pts->GetPoint(i%nps, ppA);
_pts->GetPoint((i+1)%nps, ppB);
d1= sqrt( (ppA[0]-xx)*(ppA[0]-xx) + (ppA[1]-yy)*(ppA[1]-yy) + (ppA[2]-zz)*(ppA[2]-zz));
d2= sqrt( (ppB[0]-xx)*(ppB[0]-xx) + (ppB[1]-yy)*(ppB[1]-yy) + (ppB[2]-zz)*(ppB[2]-zz));
d3= sqrt( (ppB[0]-ppA[0])*(ppB[0]-ppA[0]) + (ppB[1]-ppA[1])*(ppB[1]-ppA[1]) + (ppB[2]-ppA[2])*(ppB[2]-ppA[2]));
- if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) ) {
+
+
+ if ( ((d1+d2)>=d3) && ((d1+d2)<=d3*1.3) )
+ {
result=true;
i=nps;
}
}
+
return result;
}
{
unsigned int i,ii, np;
np = GetNumberOfPoints( );
+//EED01
if ( np > 0)
{
if (np>=2)
// ----------------------------------------------------------------------------
+
bool manualViewRoi::ifTouchContour(int x,int y, int z) // virtual
{
bool result=false;
- double px1=99999,py1=99999,px2=-9999,py2=-99999;
+ double px1=99999,py1=99999,px2=-99999,py2=-99999;
GetMinMax(px1,py1, px2, py2);
{
result=true;
}
-
+
return result;
}
-
// ----------------------------------------------------------------------------
void manualViewRoi::InitMove(int x, int y, int z) // virtual
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+manualViewLine::manualViewLine()
+{
+ _sizePointsContour=20;
+}
+// ----------------------------------------------------------------------------
+manualViewLine::~manualViewLine()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+manualViewLine * manualViewLine :: Clone()
+{
+ manualViewLine * clone = new manualViewLine();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+
+void manualViewLine::CopyAttributesTo( manualViewLine * cloneObject)
+{
+ // Fathers object
+ manualViewBaseContour::CopyAttributesTo(cloneObject);
+}
+
+// ----------------------------------------------------------------------------
+int manualViewLine::GetType() // virtual
+{
+ return 6;
+}
+
+
+// ----------------------------------------------------------------------------
+
+void manualViewLine::InitMove(int x, int y, int z) // virtual
+{
+ manualPoint *mp;
+ double XX=x;
+ double YY=y;
+ double ZZ=z;
+ TransfromeCoordViewWorld(XX,YY,ZZ);
+
+ if (_manContModel->GetSizeLstPoints()==2)
+ {
+ mp = _manContModel->GetManualPoint(0);
+ _dp0[0]= mp->GetX() - XX;
+ _dp0[1]= mp->GetY() - YY;
+ _dp0[2]= mp->GetZ();
+
+ mp = _manContModel->GetManualPoint(1);
+ _dp1[0]= mp->GetX() - XX;
+ _dp1[1]= mp->GetY() - YY;
+ _dp1[2]= mp->GetZ();
+
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+void manualViewLine::MoveContour(int x, int y, int z) // virtual
+{
+ manualPoint *mp;
+ double XX=x;
+ double YY=y;
+ double ZZ=z;
+ TransfromeCoordViewWorld(XX,YY,ZZ);
+
+ mp = _manContModel->GetManualPoint(0);
+ mp->SetPoint(_dp0[0]+XX,_dp0[1]+YY,_dp0[2]);
+ mp = _manContModel->GetManualPoint(1);
+ mp->SetPoint(_dp1[0]+XX,_dp1[1]+YY,_dp0[2]);
+
+
+ UpdateViewPoint(0);
+ UpdateViewPoint(1);
+}
// ----------------------------------------------------------------------------
//int manualViewRoi::GetType() 2;
//int manualViewCircle::GetType() 3;
//int manualViewStar::GetType() 4;
+//int manualViewLine::GetType() 6;
return 0;
SetIfViewControlPoints( false );
}
// ----------------------------------------------------------------------------
-void manualViewBaseContour :: AddControlPoints()
+void manualViewBaseContour::AddControlPoints()
{
vtkRenderer * theRenderer = _wxvtkbaseview->GetRenderer();
SetIfViewControlPoints( true );
_pts->SetPoint(i, 0 , 0 , 0 );
}
// This is for the boundaring inicialisation
- _pts->SetPoint(0, -1000 , -1000 , -1000 );
- _pts->SetPoint(1, 1000 , 1000 , 1000 );
+
+//EED 29Mars2009
+ _pts->SetPoint(0, 0 , 0 , -1000 );
+ _pts->SetPoint(1, 0 , 0 , 1000 );
+// _pts->SetPoint(0, -1000 , -1000 , -1000 );
+// _pts->SetPoint(1, 1000 , 1000 , 1000 );
+
vtkCellArray *lines = vtkCellArray::New();
lines->InsertNextCell( nps /* +1 */ );
// Text
_textActor = vtkTextActor::New();
// _textActor->SetDisplayPosition(200, 200);
- _textActor->SetInput("");
+ _textActor->SetInput("00");
// Set coordinates to match the old vtkScaledTextActor default value
// _textActor->GetPosition2Coordinate()->SetCoordinateSystemToNormalizedViewport();
// _textActor->GetPosition2Coordinate()->SetValue( 0.2 , 0.2 );
}
// ----------------------------------------------------------------------------
-void manualViewBaseContour :: UpdateViewPoints()
+void manualViewBaseContour::UpdateViewPoints()
{
int id, size = _lstViewPoints.size();
for( id=0; id<size; id++)
manualViewPoint->SetSpacing(_spc);
vtkActor *actor = manualViewPoint->CreateVtkPointActor();
- _wxvtkbaseview->GetRenderer()->AddActor( actor );
+ _wxvtkbaseview->GetRenderer()->AddActor( actor );
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::RefreshText() // virtual
{
if( _textActor!=NULL)
- _textActor -> SetInput(" ");
+ _textActor -> SetInput("00");
}
// ----------------------------------------------------------------------------
void manualViewBaseContour::SetColorNormalContour(double r, double g, double b)
{
opacity=1;
} else {
- opacity=0;
+ opacity=0.5;
}
-
vtkActor *actor;
int i,size=_lstViewPoints.size();
for (i=0;i<size;i++){
}
_contourVtkActor->GetProperty()->SetOpacity( opacity );
_textActor->GetProperty()->SetOpacity( opacity );
- _textActor->SetInput(" ");
+ _textActor->SetInput("00");
}
// ----------------------------------------------------------------------------
_show_text = ok;
if (_show_text==false)
{
- _textActor->SetInput(" ");
+ _textActor->SetInput("00");
}
}
// ----------------------------------------------------------------------------
_bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(7);
}
- }
- else
- {
+ }else{
SetPosibleToMove( true );
GetManualViewBaseContour()->SetSelected( GetManualViewBaseContour()->GetPosibleSelected() );
- }
+ } // IsEditable
+
if ( GetState() == 0 && GetManualViewBaseContour()->GetPosibleSelected() )
{
SetMoving( true );
if (!IsEditable())
{
GetManualViewBaseContour()->RemoveControlPoints();
- GetManualViewBaseContour()->RemoveTextActor();
+// GetManualViewBaseContour()->RemoveTextActor();
GetManualViewBaseContour()->Refresh();
this->_vtkInteractorStyleBaseView->SetRefresh_waiting();
}
}
// ----------------------------------------------------------------------------
+
void manualRoiControler::MouseClickLeft(int x, int y){
int z = GetZ();
- if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
- bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
- SetState(5);
- }
+
+ if( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ } // IsEditable
+
+ // Move contour
if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
}
+
+ // if the firs time create 4 control points and move one point
int size=GetManualViewBaseContour()->GetNumberOfPoints();
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(1);
+ }
+ }
+
+/*EED 21 Avril 2009
if (GetState()==0) {
if (size==0){
AddPoint(x,y,z);
bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
+
// ----------------------------------------------------------------------------
void manualRoiControler::MouseMove(int x, int y) // virtual
{
// this->_vtkInteractorStyleBaseView->
+
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- if (GetState()==5){
+
+ if ( (GetState()==5) || (GetState()==1) ){
SetPoint( bakIdPoint , x , y ,z);
if (bakIdPoint==0)
{
// ----------------------------------------------------------------------------
void manualCircleControler::MouseClickLeft(int x, int y){
int z = GetZ();
- if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
- bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
- SetState(5);
- }
+
+ if( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ }// IsEditable
+
+ // move contour
if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
GetManualViewBaseContour()->InitMove(x,y,z);
SetState(6);
}
+
+ // firstime create 2 control points and move one control point
int size=GetManualViewBaseContour()->GetNumberOfPoints();
if (GetState()==0) {
if (size==0){
AddPoint(x,y,z);
AddPoint(x,y,z);
-// AddPoint(x,y,z);
-// AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(1);
+ }
+ }
+
+/*EED 21 Avril 2009
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
} else {
SetPoint(0,x,y,z);
SetPoint(1,x,y,z);
-// SetPoint(2,x,y,z);
-// SetPoint(3,x,y,z);
}
bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
SetState(5);
}
+*/
+
GetManualViewBaseContour()->Refresh();
}
// ----------------------------------------------------------------------------
void manualCircleControler::MouseMove(int x, int y) // virtual
{
int z=GetZ();
-
// this->_vtkInteractorStyleBaseView->
GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
- if (GetState()==5){
- SetPoint( bakIdPoint , x , y ,z);
-/*
- if (bakIdPoint==0)
- {
- SetPointX( 1 , x );
- SetPointY( 3 , y );
- }
- if (bakIdPoint==1)
- {
- SetPointX( 0 , x );
- SetPointY( 2 , y );
- }
-
- if (bakIdPoint==2)
- {
- SetPointX( 3 , x );
- SetPointY( 1 , y );
- }
- if (bakIdPoint==3)
- {
- SetPointX( 2 , x );
- SetPointY( 0 , y );
- }
-*/
- }
+ if (GetState()==1){ SetPoint( bakIdPoint , x , y ,z); }
+ if (GetState()==5){ SetPoint( bakIdPoint , x , y ,z); }
+
if (GetState()==6){
GetManualViewBaseContour()->MoveContour(x,y,z);
}
*/
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+// ----------------------------------------------------------------------------
+
+// AD:02-09
+
+// _state = 0 // ..nothing..
+// _state = 5 // move point
+// _state = 6 // move all
+// _state = 7 // Empty mouse drag
+
+manualLineControler::manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler::~manualLineControler()
+{
+}
+// ----------------------------------------------------------------------------
+manualLineControler * manualLineControler :: Clone() // virtual
+{
+ manualLineControler * clone = new manualLineControler();
+ CopyAttributesTo(clone);
+ return clone;
+}
+
+// ---------------------------------------------------------------------------
+void manualLineControler::CopyAttributesTo( manualLineControler * cloneObject)
+{
+ // Fathers object
+ manualContourBaseControler::CopyAttributesTo(cloneObject);
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::MouseClickLeft(int x, int y){
+ int z = GetZ();
+
+ if( IsEditable() )
+ { // move control point
+ if ( (GetState()==0) && (GetManualViewBaseContour()->GetIdPoint(x,y,z)!=-1 ) ){
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+ } //IsEditable
+
+ // move contour
+ if ((GetState()==0) && (GetManualViewBaseContour()->GetPosibleSelected()==true)) {
+ GetManualViewBaseContour()->InitMove(x,y,z);
+ SetState(6);
+ }
+
+ // fist time create 2 control points and move a control point
+ int size=GetManualViewBaseContour()->GetNumberOfPoints();
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(1);
+ }
+ }
+
+
+/*EED 21 Avril 2009
+ if (GetState()==0) {
+ if (size==0){
+ AddPoint(x,y,z);
+ AddPoint(x,y,z);
+ } else {
+ SetPoint(0,x,y,z);
+ SetPoint(1,x,y,z);
+ }
+ bakIdPoint = GetManualViewBaseContour()->GetIdPoint(x,y,z);
+ SetState(5);
+ }
+*/
+
+ GetManualViewBaseContour()->Refresh();
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::MouseMove(int x, int y) // virtual
+{
+ int z=GetZ();
+
+ GetManualViewBaseContour()->SelectPosibleContour(x,y,z);
+ GetManualViewBaseContour()->SelectPosiblePoint(x,y,z);
+
+ if (GetState()==1) { SetPoint( bakIdPoint , x , y ,z); }
+ if (GetState()==5) { SetPoint( bakIdPoint , x , y ,z); }
+
+ if (GetState()==6)
+ {
+ GetManualViewBaseContour()->MoveContour(x,y,z);
+ }
+ GetManualViewBaseContour()->Refresh();
+}
+
+
+// ----------------------------------------------------------------------------
+void manualLineControler::DeleteActualMousePoint(int x, int y) // virtual
+{
+}
+// ----------------------------------------------------------------------------
+
+void manualLineControler::InitRoi(int ww, int hh, double porcentage)
+{
+ int zz;
+ manualPoint *mp;
+
+ if (GetManualContourModel()->GetSizeLstPoints() ==0)
+ {
+ zz = GetZ();
+ AddPoint(0,0,zz);
+ AddPoint(0,0,zz);
+ }
+
+ double pp1=porcentage;
+ double pp2=1-porcentage;
+
+ mp = GetManualContourModel()->GetManualPoint(0);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp2,zz);
+
+ mp = GetManualContourModel()->GetManualPoint(1);
+ zz=(int)mp->GetZ();
+ mp->SetPoint(ww*pp2,hh*pp1,zz);
+
+ GetManualViewBaseContour() ->UpdateViewPoint(0);
+ GetManualViewBaseContour() ->UpdateViewPoint(1);
+
+ SetState(0);
+ GetManualViewBaseContour()->Refresh();
+}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
_manViewBaseCont = NULL;
_manContModel = NULL;
_state = 0;
- _z = -900;
+ _z = 900;
_editable = true;
_posibleToMove = true;
_moving = false;
// ----------------------------------------------------------------------------
bool manualContourBaseControler::OnMouseMove()
{
+
if ( _vtkInteractorStyleBaseView!=NULL)
{
int X,Y;
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseClickRight(int x, int y)
{
- if (_state==1)
- {
- _state=0;
- }
+// if (_state==1)
+// {
+// _state=0;
+// }
SetEditable( false );
SetPosibleToMove( false );
- //_state = 0;
- _state=7;
+ _state = 0;
+
+//EED 24Avril2009 _state=7;
}
// ----------------------------------------------------------------------------
void manualContourBaseControler::MouseReleaseLeft(int x, int y)