1 #ifndef __OTULINE_MODEL_MANAGER__
2 #define __OTULINE_MODEL_MANAGER__
5 //------------------------------------------------------------------------------------------------------------
7 //------------------------------------------------------------------------------------------------------------
17 #include "ContourThing.h"
19 #include "ImageSourceThing.h"
20 #include "ImageSectionThing.h"
21 #include "InstantMembersNameList.h"
22 #include "OutlineGroup.h"
23 #include "ContourWorkspace.h"
24 #include "CommandsHandler.h"
25 #include "InstantMembersNameList.h"
26 #include "PrefixMaxKeyGenerator.h"
28 //#include "../kernel_Environment/InstantHandler.h" //Is not working
29 //#include "../kernel_Environment/Instant.h" //Is included in the SomeEnvironment template
30 //#include "../kernel_Environment/SomeEnvironment.h"
31 #include "SomeEnvironment.h"
33 class ContourWorkspace;
35 class OutlineModelManager{
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
43 * Creates the outline manager
45 OutlineModelManager( SomeEnvironment<ImageSourceThing *>* imSourceEnv, SomeEnvironment<ImageSectionThing *>* imSectionEnv, SomeEnvironment<AxeThing *>* axesEnv, SomeEnvironment<ContourThing *>* contourEnv );
49 * Destroys the outline manager
51 ~OutlineModelManager();
53 //------------------------------------------------------------------------------------------------------------
55 //------------------------------------------------------------------------------------------------------------
58 * Creates and sets a workSpace object
59 * @return Retourns the created workSpace
61 ContourWorkspace * createWorkSpace();
64 * Sets the workSpace object
65 * @param aWorkSpace The workSpace to set
67 void setWorkSpace( ContourWorkspace * aWorkSpace );
70 * Executes a command over an outline object
71 * @param imaKName Is the key name of the outline
72 * @param theCommand Is the command to execute
73 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
75 bool executeCommand_OutlineModel(std::string outKName, CommandObject * theCommand, bool fromRegistration);
78 * Executes a command identifying which actions have to realize before executing it.
79 * @param theCommand Is the command to execute
80 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
82 bool executeCommand(CommandObject * theCommand, bool fromRegistration=false);
85 * Executes a command queue identifying which actions have to realize before executing it, starting in from the front of it.
86 * @param executionQueue Is the command queue to execute
87 * @param fromRegistration Indicates if the execution is directed from the registration, by default comes from the GUI = false.
89 bool executeCommandsQueue(std::deque<CommandObject *> executionQueue, bool fromRegistration=false);
92 * Sets the concepts of the environments and includes the concepts managed by the program
93 * @conceptsScript Is the script for with the concepts descrition
94 * @return Returns true if successful insert of the given concepts, false otherwise
96 bool setUserConcepts(std::string conceptsScript);
99 * Add a concept to all the environments
100 * @param theConceptName Is the name of the new concept
101 * @param conceptSize Is the size of the concept, that represent the ammount of concept posible instances
102 * @return Returns true if successful insert of concept, false otherwise
104 bool addUserConcept( std::string theConceptName, int conceptSize );
107 * Gets the outlines at an instant form the wrapping reference
108 * @param anInstant The instant wondered to get outlines at
109 * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
110 * @return The vector to the outlines at the given instance
112 std::vector<NameWrapper *> getActualInstantOutlines ();
115 * Gets the outlines at an instant form the outline's environment
116 * @param anInstant The instant wondered to get outlines at
117 * @param ifAnnotate Indicates if it is needed to annotate the searched outlines
118 * @return The vector to the outlines at the given instance
120 std::vector<ContourThing**> getOutlinesAtInstant(Instant * anInstant, bool ifAnnotate = true);
123 * Gets the name of all outlines
124 * @return The vector of strings of all outlines
126 std::vector<std::string> GetLstNameThings();
128 std::vector<std::string> GetLstNameThingsStatic();
132 * Gets the outlines at a specific form the outline's environment
133 * @param aGroupName The name of the group containing the outlines names to get
134 * @return The vector to the outlineGroups at the given group
136 std::vector<ContourThing*> getOutlinesFromGroup(std::string aGroupName);
139 * Adds to storing at (outlineGroups) an outline group given its name and the group
140 * @param theOutlineName The name of the group containing the outlines names to add
141 * @param theGroup The outlines group to add
142 * @return Returns true
144 bool addOutlinesGroup( std::string theOutlineName, OutlineGroup * theGroup );
147 * Gets the an outline given the keyName used to be indexed in the outlines's environment
148 * @param outKName Is the outline keyName to search
149 * @return The corresponding unique outline with the given key name
151 ContourThing* getOutlineByKeyName(std::string outKName);
154 * Gets the an imageSourceThing given the keyName used to be indexed in the ImageSourceThing's environment
155 * @param outKName Is the imageSourceThing keyName to search
156 * @return The corresponding unique outline with the given key name
158 ImageSourceThing* getImageSourceThingByKeyName(std::string iSeourceKName);
161 * Gets the an imageSectionThing given the keyName used to be indexed in the ImageSectionThing's environment
162 * @param outISectionName Is the imageSectionThing keyName to search
163 * @return The corresponding unique outline with the given key name
165 ImageSectionThing* getImageSectionThingByKeyName(std::string iSectionName);
168 * Creates an outlineThing with a given name, if no name is given it would have an automatic
169 * @param aName The name for the outlineThing
170 * @return Returns the key name of the created outline, or ""if it wasn't created
172 //bool createOutline(std::string aName, ContourThing * &theOutline);
173 std::string createOutline(manualContourModel * model, std::vector<int> theInstantData, std::string aName = "" );
176 * Creates an axeThing with a given name
177 * @param aDescription The description for the axeThing
178 * @return Returns true if the creation of the axe was successful
180 //bool createAxe(std::string aDescription,AxeThing * &theAxe);
181 bool createAxe(std::string aDescription, Instant * theInstantData);
184 * Creates an imageSourceThing with a given name
185 * @param aName The name for the imageSourceThing
186 * @return Returns true if the creation of the imageSource was successful
188 //bool createImageSource(std::string aName, ImageSourceThing * &imageSource);
189 bool createImageSource(std::string aSource, Instant * theInstantData);
192 * Creates an imageSectionThing with a given name
193 * @param aSecImageData The name for the imageSectionThing
194 * @return Returns true if the creation of the imageSection was successful
196 //bool createImageSection(std::string aSecImageData, ImageSectionThing * &imageSection);
197 bool createImageSection(std::string aSecImageData, Instant * theInstantData);
200 * Adds an outlineThing
201 * @param theOutline The outline/contour (thing)
202 * @param theInstantData Is the instant for the outline to add
203 * @return Returns the key name of the created outline, or ""if it wasn't created
205 std::string addOutline(ContourThing * theOutline, Instant * theInstantData);
208 * Remove an outlineThing
209 * @param theOutline The outline/contour (thing)
211 void removeOutline( std::string ss );
215 * @param thaAxe The axe (thing)
216 * @param theInstantData Is the instant for the axe to add
217 * @return Returns true if the addition of the axe was successful
219 bool addAxe( AxeThing * thaAxe, Instant * theInstantData);
222 * Adds an imageSourceThing
223 * @param imgageSource The image source (thing)
224 * @param theInstantData Is the instant for the source to add
225 * @return Returns true if the addition of the imageSource was successful
227 bool addImageSource(ImageSourceThing * imageSource, Instant * theInstantData);
230 * Adds an imageSectionThing with a given name, if no name is given it would have an automatic
231 * @param aName The imageSection (thing)
232 * @param theInstantData Is the instant for the imageSection to add
233 * @return Returns true if the addition of the imageSection was successful
235 bool addImageSection(ImageSectionThing * imageSection, Instant * theInstantData);
238 * Annotates an outline keyname at the actual instant
239 * @param kOutlineName The key name to annotate
240 * @param theRealName The real name asigned to the outline
242 void annotateOutlineWrap(std::string kOutlineName, std::string theRealName);
245 * Annotates a set of outline keynames-real names wrapping at the actual instant
246 * @param kNamesVector The key names vector to annotate
247 * @param theOutlinesVector The outlines pointers vector to get the real names from
249 void annotateOutlinesWrap(std::vector<std::string> keyNames, std::vector<ContourThing **> theOutlinesVector);
252 * Annotates the actual outline keyName-real name wrapping at the actual instant
253 * @param actualKeyOutline The key name to annotate
254 * @param theRealName The real name asigned to the actual outline
256 void annotateActualOutlineWrap(std::string actualKeyOutline, std::string theRealName);
259 * Annotate the actual axe keyName-real name wrapping at the actual instant
260 * @param actualKeyAxe The key name to annotate
261 * @param theRealName The real name asigned to the actual axe
263 void annotateActualAxeWrap(std::string actualKeyAxe, std::string theRealName);
266 * Annotate the annotateActualSection image keyName-real name wrapping at the actual instant
267 * @param actualKeyImage The key name to annotate
269 void annotateActualSectionImageWrap(std::string actualKeyImage, std::string theRealName);//---BORRAR...
272 * Annotate the annotateActualSource image keyName-real name wrapping at the actual instant
273 * @param actualKeyImage The key name to annotate
275 void annotateActualSourceImageWrap(std::string actualKeyImage, std::string theRealName);//---BORRAR...
277 * Sets the actual instant and manage the search of the corresponding elements with the specified instant in all the enviornments
278 * @param newActualInstantData Is the instant data
280 void setInstant(Instant * newActualInstantData);
283 * Gets the an axe with a given keyName
284 * @axeKName The axe keyName for searching in the axes environment
285 * @return The corresponding axe
287 AxeThing * getAxeByKeyName(std::string axeKName);
290 * Gets the instants of a specific outline
291 * @param thekName Is the name of the outline
292 * @return The instants set
294 std::vector<Instant *> getOutlineInstantsByName(std::string thekName);
297 * Gets all instants outlines
298 * @return The instants set
301 std::vector<Instant *> getOutlineInstants();
304 * Includes an instant to the specified axe
305 * @param outKName Is outline key name
306 * @param anInstantData Is the instant data
307 * @return Returns if the insertion was successful or not
309 bool includeOutlineInstant(std::string outKName,Instant * anInstantData);
312 * Includes an instant to the specified axe
313 * @param axeKName Is axe key name
314 * @param anInstantData Is the instant data
315 * @return Returns if the insertion was successful or not
317 bool includeAxeInstant(std::string axeKName,Instant * anInstantData);
320 * Includes an instant to the specified image section
321 * @param imaKName Is the image section key name
322 * @param anInstantData Is the instant data
323 * @return Returns if the insertion was successful or not
325 bool includeImageSectionInstant(std::string imaKName,Instant * anInstantData);
328 * Includes an instant to the specified image source
329 * @param imaKName Is the image section key name
330 * @param anInstantData Is the instant data
331 * @return Returns if the insertion was successful or not
333 bool includeImageSourceInstant(std::string imaKName,Instant * anInstantData);
336 * Method that retorns the name of each concept and the size of it.
337 * @param conceptNameVect, Vector in which is disposed to be setted the name for each of the included concepts
338 * @param conceptSizeVect, Vector in which is disposed to be setted the size for each of the included concepts
340 void getConceptsInformation(std::vector<std::string>& conceptNameVect, std::vector<int>& conceptSizeVect);
343 * Gets the contourWorspace
344 * @return Returns the workspace
346 ContourWorkspace * getContourWorkspace();
349 * Gets the number of groups in the model management
350 * @return Returns the size of
352 int getGroupsCount();
355 * Cleans the outline model manager and its dependencies
359 void removeAllOutlines();
360 std::string createCopyContourOf( std::string anExistingKName, std::vector<int> &instantNoTouchData );
362 void SaveThingName( FILE *pFile, std::string nameThing );
364 void ChangeContourOfList(std::string keyName, Instant *instant);
365 int IsPartOfStaticList(std::string ss);
372 * Update the registered objects in the InstantMemebersNameList, is the one that really changes the instant in the model
374 void updateToActualInstant();
377 * Sets the automatic managed concepts including them in the environments. That are at the beginning of the instant vector for the corresponding environments.
378 * @return Returns true if successful insert of the automatic concepts, false otherwise
380 bool setAutomaticConcepts();
385 //------------------------------------------------------------------------------------------------------------
387 //------------------------------------------------------------------------------------------------------------
391 //------------------------------------------------------------------------------------------------------------
393 //------------------------------------------------------------------------------------------------------------
399 * Represents the keyName of the actual gruop in the map of gruops
401 std::string actualGruopID;
404 * Represents the environment instant iterator of axes
406 // InstantHandler<AxeThing *> * axesITER;
409 * Represents the environment of axes
411 SomeEnvironment<AxeThing *>* axesEnvironment;
414 * Represents the environment instant iterator of section images
416 // InstantHandler<ImageSectionThing *> * sectionITER;
419 * Represents the environment of section images
421 SomeEnvironment<ImageSectionThing *>* imagesSectionEnvironment;
424 * Represents the environment instant iterator of source's images (Generally a complete volume data per image)
426 // InstantHandler<ImageSourceThing *> * imageITER;
429 * Represents the environment of source images (Generally a complete volume data per image)
431 SomeEnvironment<ImageSourceThing *>* imageSourceEnvironment;
434 * Represents the environment instant iterator of outlines (outlines)
436 // InstantHandler<ContourThing *> * outlinesITER;
439 * Represents the environment of outlines (outlines)
441 SomeEnvironment<ContourThing *>* outlinesEnvironment;
444 * Represents the table of outlines groups
446 std::map< std::string,OutlineGroup * > outlineGroups;
449 * Represents the workspace
451 ContourWorkspace * workSpace;
454 * Represents the actual instant members list wrrapping (keyName, realName) of objects
456 InstantMembersNameList * actualInstantWrapping;
459 * Represents a flag indicating if the actualSourceImage has to be changed when changed instant
461 bool changeSourceImage;
464 PrefixMaxKeyGenerator keyGenerator;
467 /*const*/std::string axeConcept /*= "Axe"*/;
468 /*const*/std::string axeDepthConcept /*= "Axe Depth"*/;
470 Instant * actualInstant;
473 std::vector<ContourThing **> staticContourLst;