1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
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
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.
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
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 # ------------------------------------------------------------------------ */
26 #ifndef __KERNELMANAGERCONTOUR__
27 #define __KERNELMANAGERCONTOUR__
31 //------------------------------------------------------------------------------------------------------------
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"
41 #ifdef ParserOsirix_BUILD
42 #include "OsirixParser.h"
44 #include "ContourPropagation.h"
46 #include "manualContourModel.h"
47 #include "manualContourModelCircle.h"
48 #include "manualContourModelLine.h"
49 #include "manualContourModelRoi.h"
50 #include "manualContourModelPolygon.h"
52 #include <vtkImageChangeInformation.h>
54 class KernelManagerContour{
56 //------------------------------------------------------------------------------------------------------------
57 // Constructors & Destructors
58 //------------------------------------------------------------------------------------------------------------
62 ** With this constructor the setVectImages and initialize environment must be called
64 KernelManagerContour();
66 ** If images are available before the construction of the kernelManager this method should be used
67 ** it sets the vector images and initializes the environment
69 KernelManagerContour(std::vector<vtkImageData*> images,std::string datadir,std::string tmpdir);
70 ~KernelManagerContour();
72 std::vector<vtkImageData*> getVectImages();
73 void setVectImages(std::vector<vtkImageData*> vectimg);
75 void GetSpacing(double *vecspc, int iImage);
79 ** This method returns the source of the image data selected by the user.
81 vtkImageData* getSourceImage();
85 void initializeEnvironment(std::string datadir);
89 ** This methods connect the event in the class interfNewContourMenu with the world of the appli
92 std::string createOutline(manualBaseModel * manModelContour,std::vector<int> instantVector);
93 /////////////////////////////////
95 std::string intToString(int num);
97 std::vector<std::string> GetLstNameThingsStatic();
99 void SaveThingName(FILE* pFile, FILE *pFileData, std::string name );
101 std::vector<std::string> GetLstNameThings();
103 bool IsPartOfStaticList(std::string keyName );
105 void deleteCModel(std::string theKeyName);
107 void removeAllOutlines();
109 //void setInstance(theInstant);
111 std::vector<NameWrapper *> getActualInstantOutlines();
113 int getNamesWrappingSize();
115 std::string getNameWrapping(int i);
117 void setInstant(Instant* theInstant);
118 void setInstant(std::vector<int> vectInstant);
119 std::string createCopyContourOf ( std::string anExistingKName, std::vector<int> &instantNoTouchData);
121 Instant * getCurrentInstant();
123 manualBaseModel* getOutlineByKeyName(std::string cloneName);
125 bool onRedo(std::string& filename);
127 bool onUndo(std::string& filename);
129 bool onUndoSaveFile(std::string& filename);
131 std::string saveState();
133 void changeContourOfManager(std::string keyName, Instant *instant);
137 std::string onSpreadAdd( std::vector<double> *vecX, std::vector<double> *vecY, std::vector<double> *vecZ, std::vector<int> instants);
139 void getMaxMinZ(double *minZ,double *maxZ);
141 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);
144 // Method which creates the model associated with the type in parameter. The possible contour types are:
153 // NOTE: The view and the controler are created in the wxVtkBaseView_SceneManager class, configureViewControlTo method
154 // @param typeContour - int
155 // @return manualBaseModel - Model created based on the type
156 manualBaseModel* factoryManualContourModel(int typeContour);
158 void CalculeSplinePropagation();
160 std::vector<std::string> getOutlinesNameAtInstant(std::vector<int> tempvector);
162 std::vector<ContourThing**> getOutlinesAtInstant(Instant* instant );
164 std::vector<manualBaseModel*> ExploseEachModel( std::vector<manualBaseModel*> lstManConMod );
167 void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
169 vtkImageData* getImageAtInstant(std::vector<int> inst);
171 //------------------------------------------------------------------------------------------------------------
173 //------------------------------------------------------------------------------------------------------------
175 void setCurrentFileName(std::string filenam);
176 std::string getCurrentFileName();
178 std::string parseOsirixFile(std::string filename);
180 //------------------------------------------------------------------------------------------------------------
182 //------------------------------------------------------------------------------------------------------------
183 std::vector<vtkImageData*> vectimages;
184 std::vector<std::vector<double> > vectimagesSpacing;
186 ImageSourceThing *imageSource;
188 //Instant * _actualInstant;
189 //Temporary attribute should be removed
190 OutlineModelManager *modelManager;
192 std::string filename;
197 std::string stundoredo;
198 std::string _datadir;
200 ContourPropagation *_contourPropagation;
202 OutlineModelManager *getOutlineModelManager();