]> Creatis software - creaMaracasVisu.git/blob - bbtk/src/bbmaracasvisuContourCrown.cxx
#3262 creaMaracasVisu Feature New Normal - Export LookupTable fron ColorLayerImageV...
[creaMaracasVisu.git] / bbtk / src / bbmaracasvisuContourCrown.cxx
1 /*# ---------------------------------------------------------------------
2 #
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
4 #                        pour la Sant�)
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
8 #
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.
15 #
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
20 #  liability.
21 #
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 # ------------------------------------------------------------------------ */
25
26 #include "bbmaracasvisuContourCrown.h"
27 #include "bbcreaMaracasVisuPackage.h"
28
29 #include <vtkImageData.h>
30
31 namespace bbcreaMaracasVisu
32 {
33
34 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourCrown)
35 BBTK_BLACK_BOX_IMPLEMENTATION(ContourCrown,bbtk::WxBlackBox);
36
37 //-----------------------------------------------------------
38 void ContourCrown::Process()
39 {
40
41     if (firsttime==true)
42         {
43                 firsttime=false;
44                 if (bbGetInputwxVtkBaseView()==NULL) 
45                 {
46                         wxMessageDialog(NULL,  bbtk::std2wx("(ContourCrown) Input 'wxVtkBaseView' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
47                 }
48                 if (bbGetInputIn()==NULL) 
49                 {
50                         wxMessageDialog(NULL,  bbtk::std2wx("(ContourCrown) Input 'In' is not set"),  bbtk::std2wx(bbGetFullName()) ).ShowModal();
51                 }
52         
53                 mwxwidget->Init(  bbGetInputwxVtkBaseView(), bbGetInputIn() );
54                 mwxwidget->ConfigureVTK();
55         
56                 bbSetOutputImageValueResult( mwxwidget->GetVtkImageValueResult() );
57                 bbSetOutputImageMaskResult( mwxwidget->GetVtkImageMaskResult() );
58         }
59         
60         
61         if (mwxwidget!=NULL){
62                 //JSTG 04-04-08
63                 mwxwidget->SetControlPoints( bbGetInputControlPointsInX(), bbGetInputControlPointsInY(), bbGetInputControlPointsInZ() );
64                 
65                 LstValuePosX.clear();
66                 LstValuePosY.clear();
67                 LstValuePosZ.clear();
68                 mwxwidget->GetValuesInsideCrown(&LstValue,&LstValuePosX,&LstValuePosY,&LstValuePosZ);
69
70                 //JSTG 226-02-08 ----------------------------------------------------------
71                 LstContourX.clear();
72                 LstContourY.clear();
73                 LstContourZ.clear();
74                 mwxwidget->GetSplinePoints(&LstContourX,&LstContourY,&LstContourZ);
75                 //-------------------------------------------------------------------------
76
77                 bbSetOutputLstValue(&LstValue);
78                 bbSetOutputLstValuePosX(&LstValuePosX);
79                 bbSetOutputLstValuePosY(&LstValuePosY);
80                 bbSetOutputLstValuePosZ(&LstValuePosZ);
81                 bbSetOutputLstContourX(&LstContourX);
82                 bbSetOutputLstContourY(&LstContourY);
83                 bbSetOutputLstContourZ(&LstContourZ);
84                 bbSetOutputLstContourCrlX(&LstContourCrlX);
85                 bbSetOutputLstContourCrlY(&LstContourCrlY);
86                 bbSetOutputLstContourCrlZ(&LstContourCrlZ);
87                 bbSetOutputLstContourCrlZ(&LstContourCrlZ);
88         } // mwxwidget
89 }
90
91 //-----------------------------------------------------------
92 void ContourCrown::CreateWidget(wxWindow* parent)
93 {
94         bbtkDebugMessageInc("Core",9,"ContourCrown::CreateWidget()"<<std::endl);
95   
96         mwxwidget = new wxMaracasCoutourTool( parent );
97         bbSetOutputWidget( mwxwidget );
98         bbtkDebugDecTab("Core",9);
99 }
100
101 //-----------------------------------------------------------
102 void ContourCrown::bbUserSetDefaultValues()
103 {
104         firsttime=true;
105         mwxwidget = NULL;
106         bbSetInputIn(NULL);
107         bbSetInputwxVtkBaseView(NULL);
108 //JSTG 26-02-08 ------------------------------------
109         bbSetInputControlPointsInX(NULL);
110         bbSetInputControlPointsInY(NULL);
111         bbSetInputControlPointsInZ(NULL);
112 //--------------------------------------------------
113 }
114
115         //-----------------------------------------------------------------     
116         void ContourCrown::bbUserInitializeProcessing()
117         {
118         }
119         
120         //-----------------------------------------------------------------     
121         void ContourCrown::bbUserFinalizeProcessing()
122         {
123         }
124         
125         //-----------------------------------------------------------------     
126         
127
128 }
129 // EO namespace bbcreaMaracasVisu
130
131