]> Creatis software - creaContours.git/blob - bbtk/src/bbCreaContournDimensions.cxx
d0a4504dc68bcdef88777ba708a2e3712a68bd18
[creaContours.git] / bbtk / src / bbCreaContournDimensions.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 "bbCreaContournDimensions.h"
27 #include "bbcreaContoursPackage.h"
28
29 #include "creaSystem.h"
30 namespace bbcreaContours
31 {
32
33 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaContours,nDimensions)
34 BBTK_BLACK_BOX_IMPLEMENTATION(nDimensions,bbtk::WxBlackBox);
35 void nDimensions::Process()
36 {
37 printf("EED nDimensions::Process Start \n" );
38         double **vectx = 0, **vecty = 0, **vectz = 0;
39
40         std::vector< void * > vectortemp;
41         std::vector<int> size;
42         vtkImageData **mask = 0, **value = 0;
43
44         vtkImageData* img = bbGetInputIn();
45
46         std::vector<vtkImageData*> selectedimages;
47         if(img!=NULL && currentimg!=img)
48         {
49                 wxContourMainFrame::getInstance()->ShowToolsPanel(true);
50                 currentimg=img;
51                 selectedimages.push_back(img);
52 printf("EED nDimensions::Process 1 \n" );
53                 wxContourMainFrame::getInstance()->setVectImages(selectedimages);
54 printf("EED nDimensions::Process 2 \n" );
55         }
56
57         if(currentimg != NULL)
58    {
59                 int contourtype = bbGetInputContourType();
60                 //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
61                 //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
62         }
63
64     wxContourMainFrame::getInstance()->RefreshInterface();
65
66
67 printf("EED nDimensions::Process 3.1 \n" );
68 //      bbSetOutputX(vectx);
69 printf("EED nDimensions::Process 3.2 \n" );
70 //      bbSetOutputY(vecty);
71 printf("EED nDimensions::Process 3.3 \n" );
72 //      bbSetOutputZ(vectz);
73 printf("EED nDimensions::Process 3.4 \n" );
74 //      bbSetOutputSizeContour(size);
75 printf("EED nDimensions::Process 3.5 \n" );
76 //      bbSetOutputMask(*mask);
77 printf("EED nDimensions::Process 3.6 \n" );
78 //      bbSetOutputValue(*value);
79 printf("EED nDimensions::Process End \n" );
80 }
81
82 //-----------------------------------------------------------------
83 void nDimensions::CreateWidget(wxWindow* parent)
84 {
85         //vtkImageData* img = bbGetInputIn();
86
87         std::vector<vtkImageData*> selectedimages;
88         //selectedimages.push_back(img);
89
90         //wxFrame* frame1 = new wxFrame(parent, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 "), wxPoint(400,50), wxSize(800, 600) );
91         //frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages );
92         //new wxContourMainFrame( frame1, wxID_ANY, _T(""), wxPoint(50,50), wxSize(800, 600),selectedimages );
93         //frame1->CreateStatusBar();
94         //bbSetOutputWidget( frame1 );
95 std::string datadir=".";
96 #ifdef WIN32
97 printf("EED WARNING Verify that GetDllAppPath in  nDimensions::CreateWidget bbCreaContournDimensions is working.. \n");
98         datadir = crea::System::GetDllAppPath("bbCreaContours.dll");
99 #else
100         datadir= crea::System::GetExecutablePath();
101 #endif
102         
103         
104 #ifdef LINUX /* assume this is OSX */
105         datadir=datadir+"/../share/creaContours";
106 #endif // MACOSX        
107         
108 #ifdef MACOSX /* assume this is OSX */
109         datadir=datadir+"/../../../../share/creaContours";
110 #endif // MACOSX        
111         
112         
113 printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
114
115         wxContourMainFrame* wxcontourmainframe = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
116 printf("EED nDimensions::CreateWidget 1 \n" );
117         wxContourMainFrame::getInstance()->ShowToolsPanel(false);
118 printf("EED nDimensions::CreateWidget 2 \n" );
119
120 //              bbSetOutputWidget( new wxPanel(parent,-1) );
121                 bbSetOutputWidget( wxcontourmainframe    );
122
123 printf("EED nDimensions::CreateWidget 3 \n" );
124 }
125
126 //-----------------------------------------------------------------
127 void nDimensions::bbUserSetDefaultValues()
128 {
129         bbSetInputContourType(0);
130         bbSetInputIn(NULL);
131 }
132
133 //-----------------------------------------------------------------
134 void nDimensions::bbUserInitializeProcessing()
135 {
136 }
137
138 //-----------------------------------------------------------------
139 void nDimensions::bbUserFinalizeProcessing()
140 {
141 }
142
143 }  // EO namespace bbCreaContour