2 /*=========================================================================
5 Module: $RCSfile: manualContourContainer.cxx,v $
7 Date: $Date: 2008/10/31 16:32:09 $
8 Version: $Revision: 1.1 $
10 Copyright: (c) 2002, 2003
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notice for more information.
17 =========================================================================*/
19 #include "manualContourContainer.h"
21 //////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////
25 //--------------------------------------------------------
26 manualContourContainer::manualContourContainer()
29 _manContourControlWall = NULL;
30 _mContourModelWall = NULL;
31 _mViewContourWall = NULL;
34 _manContourControlLumen = NULL;
35 _mContourModelLumen = NULL;
36 _mViewContourLumen = NULL;
42 //--------------------------------------------------------
43 manualContourContainer::~manualContourContainer()
48 //--------------------------------------------------------
49 manualContourControler* manualContourContainer::getWallController()
51 return _manContourControlWall;
54 //--------------------------------------------------------
55 manualContourControler* manualContourContainer::getLumenController()
57 return _manContourControlLumen;
60 //--------------------------------------------------------
61 manualContourControler* manualContourContainer::getCalcController(int i)
63 return _manContourControlCalc[i];
66 //--------------------------------------------------------
67 manualContourControler* manualContourContainer::getHypoController(int i)
69 return _manContourControlHypo[i];
72 //--------------------------------------------------------
73 int manualContourContainer::addCalcificationContour(wxVtk2DBaseView *_imageviewer2D_1)
76 manualContourControler *tempC = new manualContourControler();
77 manualContourModel *tempM = new manualContourModel();
78 manualViewContour *tempV = new manualViewContour();
80 tempV->SetRange((int)(0.6) );
82 _manContourControlCalc.push_back(tempC);
83 _mContourModelCalc.push_back(tempM);
84 _mViewContourCalc.push_back(tempV);
86 tam = _mViewContourCalc.size() - 1;
88 _mViewContourCalc[tam]->SetModel( _mContourModelCalc[tam] );
89 _mViewContourCalc[tam]->SetWxVtkBaseView( _imageviewer2D_1 );
90 // _mViewContourCalc[tam]->SetRange( 2 );
91 _mViewContourCalc[tam]->SetZ( 1000 );
92 _mViewContourCalc[tam]->SetColorNormalContour(0, 0.5, 0);
93 _mViewContourCalc[tam]->SetColorEditContour(1, 1, 0.33);
94 _manContourControlCalc[tam]->SetModelView( _mContourModelCalc[tam] , _mViewContourCalc[tam] );
95 _manContourControlCalc[tam]->CreateNewManualContour();
96 _manContourControlCalc[tam]->SetActive(false);
97 _mViewContourCalc[tam]->RefreshContour();
101 //--------------------------------------------------------
102 int manualContourContainer::addHypodenseContour(wxVtk2DBaseView *_imageviewer2D_1)
105 manualContourControler *tempC = new manualContourControler();
106 manualContourModel *tempM = new manualContourModel();
107 manualViewContour *tempV = new manualViewContour();
109 tempV->SetRange( (int)(0.6) );
111 _manContourControlHypo.push_back(tempC);
112 _mContourModelHypo.push_back(tempM);
113 _mViewContourHypo.push_back(tempV);
115 tam = _mViewContourHypo.size() - 1;
116 _mViewContourHypo[tam]->SetModel( _mContourModelHypo[tam] );
117 _mViewContourHypo[tam]->SetWxVtkBaseView( _imageviewer2D_1 );
118 // _mViewContourHypo[tam]->SetRange( 2 );
119 _mViewContourHypo[tam]->SetZ( 1000 );
120 _mViewContourHypo[tam]->SetColorNormalContour(0, 0.5, 0.5);
121 _mViewContourHypo[tam]->SetColorEditContour(1, 1, 0.33);
122 _manContourControlHypo[tam]->SetModelView( _mContourModelHypo[tam] , _mViewContourHypo[tam] );
123 _manContourControlHypo[tam]->CreateNewManualContour();
124 _manContourControlHypo[tam]->SetActive(false);
125 _mViewContourHypo[tam]->RefreshContour();
130 //--------------------------------------------------------
131 void manualContourContainer::setWallVisibility(bool visible)
133 if (_mViewContourWall != NULL)
135 _mViewContourWall->SetVisible( visible );
136 _mViewContourWall->Refresh();
141 //--------------------------------------------------------
142 void manualContourContainer::setLumenVisibility(bool visible)
144 if (_mViewContourLumen != NULL)
146 _mViewContourLumen->SetVisible( visible );
147 _mViewContourLumen->Refresh();
152 //--------------------------------------------------------
153 void manualContourContainer::setCalcVisibility(bool visible)
156 for (i = 0; i < (int)_mViewContourCalc.size(); i++)
158 _mViewContourCalc[i]->SetVisible( visible );
159 _mViewContourCalc[i]->Refresh();
164 //--------------------------------------------------------
165 void manualContourContainer::setHypoVisibility(bool visible)
168 for (i = 0; i < (int)_mViewContourHypo.size(); i++)
170 _mViewContourHypo[i]->SetVisible( visible );
171 _mViewContourHypo[i]->Refresh();
175 //--------------------------------------------------------
176 void manualContourContainer::setWallActive()
178 _manContourControlWall -> SetActive(true);
180 if (_manContourControlLumen != NULL)
182 _manContourControlLumen -> SetActive(false);
186 for (i = 0; i < (int)_manContourControlCalc.size(); i++)
188 _manContourControlCalc[i] -> SetActive(false);
191 for (j = 0; j < (int)_manContourControlHypo.size(); j++)
193 _manContourControlHypo[j] -> SetActive(false);
197 //--------------------------------------------------------
198 void manualContourContainer::setLumenActive()
200 if (_manContourControlWall != NULL)
202 _manContourControlWall -> SetActive(false);
204 _manContourControlLumen -> SetActive(true);
207 for (i = 0; i < (int)_manContourControlCalc.size(); i++)
209 _manContourControlCalc[i] -> SetActive(false);
213 for (j = 0; j < (int)_manContourControlHypo.size(); j++)
215 _manContourControlHypo[j] -> SetActive(false);
221 //--------------------------------------------------------
222 void manualContourContainer::setCalcActive()
224 if (_manContourControlWall != NULL)
226 _manContourControlWall -> SetActive(false);
228 if (_manContourControlLumen != NULL)
230 _manContourControlLumen -> SetActive(false);
233 for (i = 0; i < (int)_manContourControlHypo.size(); i++)
235 _manContourControlHypo[i] -> SetActive(false);
238 for (j = 0; j < (int)_manContourControlCalc.size(); j++)
240 _manContourControlCalc[j] -> SetActive(true);
244 //--------------------------------------------------------
245 void manualContourContainer::setHypoActive()
247 if (_manContourControlWall != NULL)
249 _manContourControlWall -> SetActive(false);
252 if (_manContourControlLumen != NULL)
254 _manContourControlLumen -> SetActive(false);
258 for (i = 0; i < (int)_manContourControlCalc.size(); i++)
260 _manContourControlCalc[i] -> SetActive(false);
264 for (j = 0; j < (int)_manContourControlHypo.size(); j++)
266 _manContourControlHypo[j] -> SetActive(true);
270 //--------------------------------------------------------
271 void manualContourContainer::setCalcContourActive(int i)
273 if (_manContourControlWall != NULL)
275 _manContourControlWall -> SetActive(false);
277 if (_manContourControlLumen != NULL)
279 _manContourControlLumen -> SetActive(false);
283 for (j = 0; j < (int)_manContourControlHypo.size(); j++)
285 _manContourControlHypo[j] -> SetActive(false);
288 _manContourControlCalc[i] -> SetActive(true);
291 //--------------------------------------------------------
292 void manualContourContainer::setHypoContourActive(int i)
294 if (_manContourControlWall != NULL)
296 _manContourControlWall -> SetActive(false);
298 if (_manContourControlLumen != NULL)
300 _manContourControlLumen -> SetActive(false);
304 for (j = 0; j < (int)_manContourControlCalc.size(); j++)
306 _manContourControlCalc[j] -> SetActive(true);
309 _manContourControlHypo[i] -> SetActive(true);
312 //--------------------------------------------------------
313 int manualContourContainer::getNumberOfCalcContours()
315 return _manContourControlCalc.size();
318 //--------------------------------------------------------
319 int manualContourContainer::getNumberOfHypoContours()
321 return _manContourControlHypo.size();
324 //--------------------------------------------------------
325 void manualContourContainer::inactivate()
327 if (_manContourControlWall != NULL)
329 _manContourControlWall -> SetActive(false);
331 if (_manContourControlLumen != NULL)
333 _manContourControlLumen -> SetActive(false);
337 for (i = 0; i < (int)_manContourControlCalc.size(); i++)
339 _manContourControlCalc[i] -> SetActive(false);
342 for (j = 0; j < (int)_manContourControlHypo.size(); j++)
344 _manContourControlHypo[j] -> SetActive(false);
348 //--------------------------------------------------------
349 int manualContourContainer::getNumberOfWallContourPoints()
351 return _manContourControlWall->GetNumberOfPointsSplineManualContour();
354 //--------------------------------------------------------
355 int manualContourContainer::getNumberOfLumenContourPoints()
357 return _manContourControlLumen->GetNumberOfPointsSplineManualContour();
360 //--------------------------------------------------------
361 int manualContourContainer::getNumberOfCalcContourPoints(int i)
363 return _manContourControlCalc[i]->GetNumberOfPointsSplineManualContour();
366 //--------------------------------------------------------
367 int manualContourContainer::getNumberOfHypoContourPoints(int i)
369 return _manContourControlHypo[i]->GetNumberOfPointsSplineManualContour();
372 //--------------------------------------------------------
373 double* manualContourContainer::getXVectorWallPoints()
375 return _manContourControlWall->GetVectorPointsXManualContour();
378 //--------------------------------------------------------
379 double* manualContourContainer::getXVectorLumenPoints()
381 return _manContourControlLumen->GetVectorPointsXManualContour();
384 //--------------------------------------------------------
385 double* manualContourContainer::getXVectorCalcPoints(int i)
387 return _manContourControlCalc[i]->GetVectorPointsXManualContour();
390 //--------------------------------------------------------
391 double* manualContourContainer::getXVectorHypoPoints(int i)
393 return _manContourControlHypo[i]->GetVectorPointsXManualContour();
396 //--------------------------------------------------------
397 double* manualContourContainer::getYVectorWallPoints()
399 return _manContourControlWall->GetVectorPointsYManualContour();
402 //--------------------------------------------------------
403 double* manualContourContainer::getYVectorLumenPoints()
405 return _manContourControlLumen->GetVectorPointsYManualContour();
408 //--------------------------------------------------------
409 double* manualContourContainer::getYVectorCalcPoints(int i)
411 return _manContourControlCalc[i]->GetVectorPointsYManualContour();
414 //--------------------------------------------------------
415 double* manualContourContainer::getYVectorHypoPoints(int i)
417 return _manContourControlHypo[i]->GetVectorPointsYManualContour();
420 //--------------------------------------------------------
421 void manualContourContainer::clear()
429 //--------------------------------------------------------
430 void manualContourContainer::clearWall()
432 if (_mViewContourWall != NULL)
434 _mViewContourWall->ClearContour();
439 //--------------------------------------------------------
440 void manualContourContainer::clearLumen()
442 if (_mViewContourLumen != NULL)
444 _mViewContourLumen->ClearContour();
449 //--------------------------------------------------------
450 void manualContourContainer::clearCalc()
453 for (i = 0; i < (int)_mViewContourCalc.size(); i++)
455 _mViewContourCalc[i] -> ClearContour();
459 //--------------------------------------------------------
460 void manualContourContainer::clearHypo()
463 for (j = 0; j < (int)_mViewContourHypo.size(); j++)
465 _mViewContourHypo[j] -> ClearContour();
470 //--------------------------------------------------------
471 void manualContourContainer::refreshWall(wxVtk2DBaseView *_imageviewer2D_1)
474 if (_mContourModelWall == NULL)
479 int size = _mContourModelWall->GetSizeLstPoints();
480 std::vector<manualPoint *> points;
483 for (i = 0; i < size; i++)
485 points.push_back(_mContourModelWall->GetManualPoint(i));
488 _mContourModelWall->DeleteAllPoints();
489 _manContourControlWall->CreateNewManualContour();
490 _manContourControlWall->SetActive(false);
491 _mViewContourWall->RefreshContour();
492 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
493 _manContourControlWall );
494 for (i = 0; i < size; i++)
496 manualPoint* mp = points[i];
497 int id = _manContourControlWall->GetManualContourModel()->AddPoint(mp->GetX(),mp->GetY(),mp->GetZ());
498 _manContourControlWall->GetManualViewBaseContour()->AddPoint();
499 _manContourControlWall->GetManualViewBaseContour()->Refresh();
505 //--------------------------------------------------------
506 void manualContourContainer::refreshLumen(wxVtk2DBaseView *_imageviewer2D_1)
508 if (_mContourModelLumen == NULL)
512 int size = _mContourModelLumen->GetSizeLstPoints();
513 std::vector<manualPoint *> points;
516 for (i = 0; i < size; i++)
518 points.push_back(_mContourModelLumen->GetManualPoint(i));
521 _mContourModelLumen->DeleteAllPoints();
522 _manContourControlLumen->CreateNewManualContour();
523 _manContourControlLumen->SetActive(false);
524 _mViewContourLumen->RefreshContour();
525 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
526 _manContourControlLumen );
527 for (i = 0; i < size; i++)
529 manualPoint* mp = points[i];
530 int id = _manContourControlLumen->GetManualContourModel()->AddPoint(mp->GetX(),mp->GetY(),mp->GetZ());
531 _manContourControlLumen->GetManualViewBaseContour()->AddPoint();
532 _manContourControlLumen->GetManualViewBaseContour()->Refresh();
536 //--------------------------------------------------------
537 void manualContourContainer::refreshCalc(int j,wxVtk2DBaseView *_imageviewer2D_1)
540 int size = _mContourModelCalc[j]->GetSizeLstPoints();
541 std::vector<manualPoint *> points;
544 for (i = 0; i < size; i++)
546 points.push_back(_mContourModelCalc[j]->GetManualPoint(i));
549 _mContourModelCalc[j]->DeleteAllPoints();
550 _manContourControlCalc[j]->CreateNewManualContour();
551 _manContourControlCalc[j]->SetActive(false);
552 _mViewContourCalc[j]->RefreshContour();
553 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
554 _manContourControlCalc[j] );
555 for (i = 0; i < size; i++)
557 manualPoint* mp = points[i];
558 int id = _manContourControlCalc[j]->GetManualContourModel()->AddPoint(mp->GetX(),mp->GetY(),mp->GetZ());
559 _manContourControlCalc[j]->GetManualViewBaseContour()->AddPoint();
560 _manContourControlCalc[j]->GetManualViewBaseContour()->Refresh();
567 //--------------------------------------------------------
568 void manualContourContainer::refreshHypo(int j,wxVtk2DBaseView *_imageviewer2D_1)
571 int size = _mContourModelHypo[j]->GetSizeLstPoints();
572 std::vector<manualPoint *> points;
575 for (i = 0; i < size; i++)
577 points.push_back(_mContourModelHypo[j]->GetManualPoint(i));
580 _mContourModelHypo[j]->DeleteAllPoints();
581 _manContourControlHypo[j]->CreateNewManualContour();
582 _manContourControlHypo[j]->SetActive(false);
583 _mViewContourHypo[j]->RefreshContour();
584 _imageviewer2D_1->GetInteractorStyleBaseView()->AddInteractorStyleMaracas(
585 _manContourControlHypo[j] );
586 for (i = 0; i < size; i++)
588 manualPoint* mp = points[i];
589 int id = _manContourControlHypo[j]->GetManualContourModel()->AddPoint(mp->GetX(),mp->GetY(),mp->GetZ());
590 _manContourControlHypo[j]->GetManualViewBaseContour()->AddPoint();
591 _manContourControlHypo[j]->GetManualViewBaseContour()->Refresh();
595 //--------------------------------------------------------
596 void manualContourContainer::restartWallContour(wxVtk2DBaseView *_imageviewer2D_1)
598 if (_manContourControlWall == NULL)
602 delete _manContourControlWall;
603 delete _mContourModelWall;
604 delete _mViewContourWall;
606 _manContourControlWall = new manualContourControler();
607 _mContourModelWall = new manualContourModel();
608 _mViewContourWall = new manualViewContour();
610 _mViewContourWall->SetRange( (int)(0.6) );
612 _mViewContourWall->SetModel( _mContourModelWall );
613 _mViewContourWall->SetWxVtkBaseView( _imageviewer2D_1 );
614 // _mViewContourWall->SetRange( 2 );
615 _mViewContourWall->SetZ( 1000 );
616 _mViewContourWall->SetColorNormalContour(0.2, 0.6, 1);
617 _mViewContourWall->SetColorEditContour(1, 1, 0.33);
619 _manContourControlWall->SetModelView( _mContourModelWall , _mViewContourWall );
620 _manContourControlWall->CreateNewManualContour();
621 _manContourControlWall->SetActive(false);
622 _mViewContourWall->RefreshContour();
624 //--------------------------------------------------------
625 void manualContourContainer::restartLumenContour(wxVtk2DBaseView *_imageviewer2D_1)
628 if (_manContourControlLumen == NULL)
632 delete _manContourControlLumen;
633 delete _mContourModelLumen;
634 delete _mViewContourLumen;
636 _manContourControlLumen = new manualContourControler();
637 _mContourModelLumen = new manualContourModel();
638 _mViewContourLumen = new manualViewContour();
639 _mViewContourLumen->SetModel( _mContourModelLumen );
640 _mViewContourLumen->SetWxVtkBaseView( _imageviewer2D_1 );
642 _mViewContourLumen->SetRange( (int)(0.6) );
643 _mViewContourLumen->SetZ( 1000 );
644 _mViewContourLumen->SetColorNormalContour(1, 0, 0);
645 _mViewContourLumen->SetColorEditContour(1, 1, 0.33);
647 _manContourControlLumen->SetModelView( _mContourModelLumen , _mViewContourLumen );
648 _manContourControlLumen->CreateNewManualContour();
649 _manContourControlLumen->SetActive(false);
650 _mViewContourLumen->RefreshContour();
653 //--------------------------------------------------------
654 void manualContourContainer::restartCalcContours()
657 for (i = 0; i < (int)_mContourModelCalc.size(); i++)
660 _manContourControlCalc[i] = NULL;
661 _mContourModelCalc[i] = NULL;
662 _mViewContourCalc[i] = NULL;
664 delete _manContourControlCalc[i];
665 delete _mContourModelCalc[i];
666 delete _mViewContourCalc[i];
669 _manContourControlCalc.clear();
670 _mContourModelCalc.clear();
671 _mViewContourCalc.clear();
674 //--------------------------------------------------------
675 void manualContourContainer::restartHypoContours()
678 for (i = 0; i < (int)_mContourModelHypo.size(); i++)
681 _manContourControlHypo[i] = NULL;
682 _mContourModelHypo[i] = NULL;
683 _mViewContourHypo[i] = NULL;
685 delete _manContourControlHypo[i];
686 delete _mContourModelHypo[i];
687 delete _mViewContourHypo[i];
690 _manContourControlHypo.clear();
691 _mContourModelHypo.clear();
692 _mViewContourHypo.clear();
695 //--------------------------------------------------------
696 void manualContourContainer::createWallContour(wxVtk2DBaseView *_imageviewer2D_1)
699 _manContourControlWall = new manualContourControler();
700 _mContourModelWall = new manualContourModel();
701 _mViewContourWall = new manualViewContour();
702 _mViewContourWall->SetModel( _mContourModelWall );
703 _mViewContourWall->SetWxVtkBaseView( _imageviewer2D_1 );
705 _mViewContourWall->SetRange( (int)(0.6) );
707 _mViewContourWall->SetZ( 1000 );
708 _mViewContourWall->SetColorNormalContour(0.2, 0.6, 1);
709 _mViewContourWall->SetColorEditContour(1, 1, 0.33);
711 _manContourControlWall->SetModelView( _mContourModelWall , _mViewContourWall );
712 _manContourControlWall->CreateNewManualContour();
713 _manContourControlWall->SetActive(false);
714 _mViewContourWall->RefreshContour();
717 //--------------------------------------------------------
718 void manualContourContainer::createLumenContour(wxVtk2DBaseView *_imageviewer2D_1)
722 _manContourControlLumen = new manualContourControler();
723 _mContourModelLumen = new manualContourModel();
724 _mViewContourLumen = new manualViewContour();
725 _mViewContourLumen->SetModel( _mContourModelLumen );
726 _mViewContourLumen->SetWxVtkBaseView( _imageviewer2D_1 );
728 _mViewContourLumen->SetRange( (int)(0.6) );
730 _mViewContourLumen->SetZ( 1000 );
731 _mViewContourLumen->SetColorNormalContour(1, 0, 0);
732 _mViewContourLumen->SetColorEditContour(1, 1, 0.33);
734 _manContourControlLumen->SetModelView( _mContourModelLumen , _mViewContourLumen );
735 _manContourControlLumen->CreateNewManualContour();
736 _manContourControlLumen->SetActive(false);
737 _mViewContourLumen->RefreshContour();