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 //------------------------------------------------------------------------------------------------------------
61 ** With this constructor the setVectImages and initialize environment must be called
63 KernelManagerContour();
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
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);
75 ** This method returns the source of the image data selected by the user.
77 vtkImageData* getSourceImage();
78 void initializeEnvironment(std::string datadir);
80 ** This methods connect the event in the class interfNewContourMenu with the world of the appli
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);
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);
110 // Method which creates the model associated with the type in parameter. The possible contour types are:
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);
130 //------------------------------------------------------------------------------------------------------------
132 //------------------------------------------------------------------------------------------------------------
134 void setCurrentFileName(std::string filenam);
135 std::string getCurrentFileName();
136 std::string parseOsirixFile(std::string filename);
138 //------------------------------------------------------------------------------------------------------------
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;
151 std::string stundoredo;
152 std::string _datadir;
153 ContourPropagation *_contourPropagation;
154 OutlineModelManager *getOutlineModelManager();