]> Creatis software - creaContours.git/blob - lib/kernel_ManagerContour_NDimensions/OutlineModelBuilder.cxx
Feature #1772 Add licence terms for all files.
[creaContours.git] / lib / kernel_ManagerContour_NDimensions / OutlineModelBuilder.cxx
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 //----------------------------------------------------------------------------------------------------------------
35 /** @file OutlineModelBuilder.cxx */
36
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
40
41         /**
42         * Creates an OutlineModelBuilder
43         * @ param filesNames Paired set of files with the names of the files to read ConceptsFile, ImageSourcesFile, ImageSectionsFile, AxeThingsFile, ContoursFile
44         * @ param sources Paired set of sourceKeyName-ImageSourceThing
45         * @ param sections Paired set of sectionKeyName-ImageSectionThing
46         * @ param axes Paired set of axeKeyName-AxeThing
47         * @ param outlines Paired set of contoKeyName-ContourThing
48         */
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;
56                 imagesSectionEnv_Reader = NULL;
57                 imageSourceEnv_Reader = NULL;
58                 outlinesEnv_Reader = NULL;
59         }
60
61         /**
62         * Destroys an AxeThing
63         */
64         OutlineModelBuilder ::  ~OutlineModelBuilder()
65         {
66                 delete axesEnv_Reader;
67                 delete imagesSectionEnv_Reader;
68                 delete imageSourceEnv_Reader;
69                 delete outlinesEnv_Reader;
70         }
71 //------------------------------------------------------------------------------------------------------------
72 // Methods
73 //------------------------------------------------------------------------------------------------------------
74
75         /**
76         * Gets the ImageSourceThing environment
77         *@param  ImSourceEnv 
78         */
79     SomeEnvironment<ImageSourceThing *> * OutlineModelBuilder ::  getImSourceEnv()
80         {
81                 return ( imageSourceEnv_Reader!= NULL ) ? imageSourceEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSourceThing *>();
82         }
83         /**
84         * Gets the ImageSectionThing environment
85         *@param  imSectionEnv 
86         */
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         }
99         /**
100         * Gets the ContourThing environment
101         *@param  ContourEnv 
102         */
103         SomeEnvironment<ContourThing *> * OutlineModelBuilder ::  getContourEnv()
104         {
105                 return ( outlinesEnv_Reader!= NULL ) ? outlinesEnv_Reader->getEnvironment() : new SomeEnvironment<ContourThing *>();
106         }
107
108
109         /**
110         * Builds the ImageSourceThing * environment
111         * @param sourcesFile File path with the object key names and specific instants for each one
112         * @param sources The sources to include in the enivorment
113         */
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
121         /**
122         * Builds the ImageSectionThing * environment
123         * @param sectionsFile File path with the object key names and specific instants for each one
124         * @param sections The sections to include in the enivorment
125         */
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
133         /**
134         * Builds the AxeThing * environment
135         * @param axesFile File path with the object key names and specific instants for each one
136         * @param axes The axes to include in the enivorment
137         */
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
144         /**
145         * Builds the CountourThing * environment
146         * @param outlinesFile File path with the object key names and specific instants for each one
147         * @param outlines The outlines to include in the enivorment
148         */
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