]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/KernelManagerContour.h
#3383 NDimension changeImage
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / KernelManagerContour.h
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 #ifndef __KERNELMANAGERCONTOUR__
27 #define __KERNELMANAGERCONTOUR__
28
29
30
31 //------------------------------------------------------------------------------------------------------------
32 // Includes
33 //------------------------------------------------------------------------------------------------------------
34 //#include "ImageSourceThing.h"
35 //#include "ImageSectionThing.h"
36 //#include "AxeThing.h"
37 //#include "ContourThing.h"
38 #include "OutlineModelManager.h"
39 #include "OutlineModelBuilder.h"
40 #include "time.h"
41 #ifdef ParserOsirix_BUILD
42 #include "OsirixParser.h"
43 #endif
44 #include "ContourPropagation.h"
45
46 #include "manualContourModel.h"
47 #include "manualContourModelCircle.h"
48 #include "manualContourModelLine.h"
49 #include "manualContourModelRoi.h"
50 #include "manualContourModelPolygon.h"
51
52 #include <vtkImageChangeInformation.h>
53
54 class KernelManagerContour{
55
56 //------------------------------------------------------------------------------------------------------------
57 // Constructors & Destructors
58 //------------------------------------------------------------------------------------------------------------
59 public:
60         /**
61         ** With this constructor the setVectImages and initialize environment must be called
62         **/
63         KernelManagerContour();
64         /**
65         **      If images are available before the construction of the kernelManager this method should be used
66         **      it sets the vector images and initializes the environment
67         **/
68         KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir);
69         ~KernelManagerContour();
70         std::vector<vtkImageData*> getVectImages();
71     void changeImage(int id, vtkImageData *img);
72     void setVectImages(std::vector<vtkImageData*> vectimg);
73         void GetSpacing(double *vecspc, int iImage);
74         /**
75         **      This method returns the source of the image data selected by the user.
76         */
77         vtkImageData* getSourceImage();
78         void initializeEnvironment(std::string datadir);
79         /**
80         **      This methods connect the event in the class interfNewContourMenu with the world of the appli
81         **/
82         std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
83         /////////////////////////////////
84         std::string intToString(int num);
85         std::vector<std::string> GetLstNameThingsStatic();
86         void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
87         std::vector<std::string> GetLstNameThings();
88         bool IsPartOfStaticList(std::string keyName );
89         void deleteCModel(std::string theKeyName);
90         void removeAllOutlines();
91         //void setInstance(theInstant);
92         std::vector<NameWrapper *> getActualInstantOutlines();
93         int getNamesWrappingSize();
94         std::string getNameWrapping(int i);
95         void setInstant(Instant* theInstant);
96         void setInstant(std::vector<int> vectInstant);
97         std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
98         Instant * getCurrentInstant();
99         manualBaseModel* getOutlineByKeyName(std::string cloneName);
100         bool onRedo(std::string& filename);
101         bool onUndo(std::string& filename);
102         bool onUndoSaveFile(std::string& filename);
103         std::string saveState();
104         void changeContourOfManager(std::string keyName, Instant *instant);
105         void resetAppend();
106         std::string onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants);
107         void getMaxMinZ(double *minZ,double *maxZ);
108         manualBaseModel* GetPoints(int z,int type, std::vector<double>* vecCtrlPointX,std::vector<double>* vecCtrlPointY,std::vector<double>* vecCtrlPointZ, std::string& theName,int typeofcontour, std::vector<int> tempVector);
109         //
110         // Method which creates the model associated with the type in parameter. The possible contour types are:
111         // 0-spline
112         // 1-spline
113         // 2-rectangle
114         // 3-circle
115         // 4-BullEye
116         // 5-BullEyeSector
117         // 6-Line
118         // 7-Points
119         // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
120         // @param typeContour - int
121         // @return manualBaseModel - Model created based on the type
122         manualBaseModel* factoryManualContourModel(int typeContour);
123         void CalculeSplinePropagation();
124         std::vector<std::string> getOutlinesNameAtInstant(std::vector<int> tempvector);
125         std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
126         std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
127         void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
128         vtkImageData* getImageAtInstant(std::vector<int> inst);
129
130 //------------------------------------------------------------------------------------------------------------
131 // Constants
132 //------------------------------------------------------------------------------------------------------------
133
134         void setCurrentFileName(std::string filenam);
135         std::string getCurrentFileName();
136         std::string parseOsirixFile(std::string filename);
137 private:
138 //------------------------------------------------------------------------------------------------------------
139 // Attributes
140 //------------------------------------------------------------------------------------------------------------
141         std::vector<vtkImageData*>                              vectimages;
142         std::vector<std::vector<double> >               vectimagesSpacing;
143         ImageSourceThing                                                *imageSource;
144         //Instant * _actualInstant;
145 //Temporary attribute should be removed
146         OutlineModelManager                                             *modelManager;
147         std::string                                                             filename;
148         int                                                                             inredo;
149         int                                                                             inundo;
150         int                                                                             _currentIndex;
151         std::string                                                             stundoredo;
152         std::string                                                             _datadir;
153         ContourPropagation                                              *_contourPropagation;
154         OutlineModelManager                                             *getOutlineModelManager();
155 };
156 #endif