]> Creatis software - creaContours.git/blob - bbtk/src/bbCreaContournDimensions.cxx
Feature #1772 Add licence terms for all files.
[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         double **vectx = 0, **vecty = 0, **vectz = 0;
38
39         std::vector< void * > vectortemp;
40         std::vector<int> size;
41         vtkImageData **mask = 0, **value = 0;
42
43         vtkImageData* img = bbGetInputIn();
44
45         std::vector<vtkImageData*> selectedimages;
46         if(img!=NULL && currentimg!=img){
47
48                 printf("EED nDimensions::Process 02\n");        
49                 wxContourMainFrame::getInstance()->ShowToolsPanel(true);
50                 currentimg=img;
51                 selectedimages.push_back(img);
52                 wxContourMainFrame::getInstance()->setVectImages(selectedimages);
53                 printf("EED nDimensions::Process 03\n");        
54         }
55
56         if(currentimg != NULL){
57                 int contourtype = bbGetInputContourType();
58                 //wxContourMainFrame::getInstance()->getValuesXYZ(vectx, vecty, vectz, &size);
59                 //wxContourMainFrame::getInstance()->getMaskValue(mask, value, contourtype);
60         }
61
62         bbSetOutputX(vectx);
63         bbSetOutputY(vecty);
64         bbSetOutputZ(vectz);
65         bbSetOutputSizeContour(size);
66         bbSetOutputMask(*mask);
67         bbSetOutputValue(*value);
68 }
69
70 //-----------------------------------------------------------------
71 void nDimensions::CreateWidget(wxWindow* parent)
72 {
73         //vtkImageData* img = bbGetInputIn();
74
75         std::vector<vtkImageData*> selectedimages;
76         //selectedimages.push_back(img);
77
78         //wxFrame* frame1 = new wxFrame(parent, wxID_ANY, wxT("ROI Application  -    Evaluation version, 23 Oct 2008 "), wxPoint(400,50), wxSize(800, 600) );
79         //frame = wxContourMainFrame::getInstance(frame1, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages );
80         //new wxContourMainFrame( frame1, wxID_ANY, _T(""), wxPoint(50,50), wxSize(800, 600),selectedimages );
81         //frame1->CreateStatusBar();
82         //bbSetOutputWidget( frame1 );
83 std::string datadir=".";
84 #ifdef WIN32
85 printf("EED WARNING Verify that GetDllAppPath in  nDimensions::CreateWidget bbCreaContournDimensions is working.. \n");
86         datadir = crea::System::GetDllAppPath("bbCreaContours.dll");
87 #else
88         datadir= crea::System::GetExecutablePath();
89 #endif
90         
91         
92 #ifdef LINUX /* assume this is OSX */
93         datadir=datadir+"/../share/creaContours";
94 #endif // MACOSX        
95         
96 #ifdef MACOSX /* assume this is OSX */
97         datadir=datadir+"/../../../../share/creaContours";
98 #endif // MACOSX        
99         
100         
101         printf("EED nDimensions::CreateWidget path=%s\n",datadir.c_str() );
102
103         wxPanel* panel = wxContourMainFrame::getInstance(parent, wxID_ANY, wxString(_T("")), wxPoint(100,50), wxSize(800, 600), selectedimages,wxDEFAULT_FRAME_STYLE | wxSUNKEN_BORDER,datadir );
104         wxContourMainFrame::getInstance()->ShowToolsPanel(false);
105 //EED   bbSetOutputWidget( panel );
106                 bbSetOutputWidget( new wxPanel(parent,-1) );
107 }
108
109 //-----------------------------------------------------------------
110 void nDimensions::bbUserSetDefaultValues()
111 {
112         bbSetInputContourType(0);
113         bbSetInputIn(NULL);
114 }
115
116 //-----------------------------------------------------------------
117 void nDimensions::bbUserInitializeProcessing()
118 {
119 }
120
121 //-----------------------------------------------------------------
122 void nDimensions::bbUserFinalizeProcessing()
123 {
124 }
125
126 }  // EO namespace bbCreaContour