1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "manualView3DContour.h"
28 // ----------------------------------------------------------------------------
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 manualView3DContour::manualView3DContour()
34 // ----------------------------------------------------------------------------
35 manualView3DContour::~manualView3DContour()
39 // ----------------------------------------------------------------------------
40 manualView3DContour * manualView3DContour :: Clone()
42 manualView3DContour * clone = new manualView3DContour();
43 CopyAttributesTo(clone);
47 // ---------------------------------------------------------------------------
48 void manualView3DContour::CopyAttributesTo( manualView3DContour * cloneObject)
51 manualViewContour::CopyAttributesTo(cloneObject);
53 cloneObject->SetDimensions ( _w , _h , _d );
55 // ----------------------------------------------------------------------------
56 void manualView3DContour::SetDimensions(int w, int h, int d)
62 // ----------------------------------------------------------------------------
63 void manualView3DContour::TransfromCoordViewWorld(double &X, double &Y, double &Z, int type)
65 X = _vtkmprbasedata->GetX();
66 Y = _vtkmprbasedata->GetY();
67 Z = _vtkmprbasedata->GetZ();
69 // ----------------------------------------------------------------------------
70 void manualView3DContour::SetVtkMPRBaseData(vtkMPRBaseData *vtkmprbasedata)
72 _vtkmprbasedata = vtkmprbasedata;
74 // ----------------------------------------------------------------------------
75 int manualView3DContour::GetIdPoint2(int x, int y)
78 double p[3],pA[3],pB[3];
80 double pickPoint[ 3 ], cameraPos[ 3 ];
81 vtkPointPicker* picker = vtkPointPicker::New( );
82 vtkRenderer *pRenderer = this->GetWxVtkBaseView()->GetRenderer();
83 picker->Pick( x, y, 0.0, pRenderer );
84 pRenderer->GetActiveCamera( )->GetPosition( cameraPos );
85 picker->GetPickPosition( pickPoint );
88 UtilVtk3DGeometriSelection utilVtk3Dgeometriselection;
89 utilVtk3Dgeometriselection.SetDimentions(_w,_h,_d);
91 if( utilVtk3Dgeometriselection.FindCubePointsFromPoints( pA, pB, pickPoint, cameraPos ) )
93 double dist,distMin=999999999;
94 int i,size=this->_manContModel->GetSizeLstPoints();
97 manualPoint *mp = this->_manContModel->GetManualPoint(i);
101 dist=utilVtk3Dgeometriselection.DistanceMinPointToLine(p,pA,pB);
102 if ( (dist<=2*GetRange()) && (dist<distMin) )
111 // ----------------------------------------------------------------------------
112 int manualView3DContour::SelectPosiblePoint ( int x, int y, int z )// virtual
114 SelectAllPossibleSelected(false);
115 int id=GetIdPoint2(x,y);
118 SetPointPosibleSelected(id,true);