creaContours_lib
OutlineModelBuilder.cxx
Go to the documentation of this file.
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 
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "OutlineModelBuilder.h"
31 
32 //----------------------------------------------------------------------------------------------------------------
33 // Class implementation
34 //----------------------------------------------------------------------------------------------------------------
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
40 
49 OutlineModelBuilder :: OutlineModelBuilder(std::string theConceptsFile, std::string datadir)//std::map<std::string, std::string> filesNames, std::map<std::string, ImageSourceThing *> * sources, std::map<std::string, ImageSectionThing *>* sections, std::map<std::string, AxeThing *>* axes, std::map<std::string, ContourThing *>* outlines)
50  {
51  conceptsFile = theConceptsFile;
52  imagesSectionEnvOtherConceptsFN = datadir + "/imageSectionOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/imageSectionOtherConceptsFile.cf";
53  outlinesEnvOtherConceptsFN = datadir + "/outlinesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/outlinesOtherConceptsFile.cf";
54  axesEnvOtherConceptsFN = datadir + "/axesOtherConceptsFile.cf";//"C:/Creatis/Maracas/src/interface/wxWindows/NDimension/data/axesOtherConceptsFile.cf";
55  axesEnv_Reader = NULL;
57  imageSourceEnv_Reader = NULL;
58  outlinesEnv_Reader = NULL;
59  }
60 
65  {
66  delete axesEnv_Reader;
68  delete imageSourceEnv_Reader;
69  delete outlinesEnv_Reader;
70  }
71 //------------------------------------------------------------------------------------------------------------
72 // Methods
73 //------------------------------------------------------------------------------------------------------------
74 
79  SomeEnvironment<ImageSourceThing *> * OutlineModelBuilder :: getImSourceEnv()
80  {
81  return ( imageSourceEnv_Reader!= NULL ) ? imageSourceEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSourceThing *>();
82  }
87  SomeEnvironment<ImageSectionThing *> * OutlineModelBuilder :: getImSectionEnv()
88  {
89  return ( imagesSectionEnv_Reader!= NULL ) ? imagesSectionEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSectionThing *>();
90  }
91  /*
92  * Gets the AxeThing environment
93  *@param AxesEnv
94  */
95  SomeEnvironment<AxeThing *> * OutlineModelBuilder :: getAxesEnv()
96  {
97  return ( axesEnv_Reader!= NULL ) ? axesEnv_Reader->getEnvironment() : new SomeEnvironment<AxeThing *>();
98  }
103  SomeEnvironment<ContourThing *> * OutlineModelBuilder :: getContourEnv()
104  {
105  return ( outlinesEnv_Reader!= NULL ) ? outlinesEnv_Reader->getEnvironment() : new SomeEnvironment<ContourThing *>();
106  }
107 
108 
114  void OutlineModelBuilder :: buildImageSource_Envornment( std::string sourcesFile, std::map<std::string, ImageSourceThing *> * sources )
115  {
116  if( !conceptsFile.empty() )
117  imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> (conceptsFile, sourcesFile, sources);
118  //imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> ("data/holaConceptsFile.cf", sourcesFile, sources);
119  }
120 
126  void OutlineModelBuilder :: buildImageSection_Envornment( std::string sectionsFile, std::map<std::string, ImageSectionThing *>* sections )
127  {
128  if( !conceptsFile.empty() )
129  imagesSectionEnv_Reader = new ReaderEnvironment<ImageSectionThing *> ( imagesSectionEnvOtherConceptsFN, conceptsFile, sectionsFile, sections);
130  }
131 
132 
138  void OutlineModelBuilder :: buildAxe_Envornment( std::string axesFile, std::map<std::string, AxeThing *>* axes )
139  {
140  if( !conceptsFile.empty() )
141  axesEnv_Reader = new ReaderEnvironment<AxeThing *> ( axesEnvOtherConceptsFN, conceptsFile, axesFile, axes);
142  }
143 
149  void OutlineModelBuilder :: buildCountour_Envornment( std::string outlinesFile, std::map<std::string, ContourThing *>* outlines )
150  {
151  if( !conceptsFile.empty() )
152  outlinesEnv_Reader = new ReaderEnvironment< ContourThing *> ( outlinesEnvOtherConceptsFN, conceptsFile, outlinesFile, outlines);
153  }
154