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 # ------------------------------------------------------------------------ */
27 //----------------------------------------------------------------------------------------------------------------
28 // Class definition include
29 //----------------------------------------------------------------------------------------------------------------
30 #include "OutlineModelBuilder.h"
32 //----------------------------------------------------------------------------------------------------------------
33 // Class implementation
34 //----------------------------------------------------------------------------------------------------------------
35 /** @file OutlineModelBuilder.cxx */
37 //------------------------------------------------------------------------------------------------------------
38 // Constructors & Destructors
39 //------------------------------------------------------------------------------------------------------------
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
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)
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;
62 * Destroys an AxeThing
64 OutlineModelBuilder :: ~OutlineModelBuilder()
66 delete axesEnv_Reader;
67 delete imagesSectionEnv_Reader;
68 delete imageSourceEnv_Reader;
69 delete outlinesEnv_Reader;
71 //------------------------------------------------------------------------------------------------------------
73 //------------------------------------------------------------------------------------------------------------
76 * Gets the ImageSourceThing environment
79 SomeEnvironment<ImageSourceThing *> * OutlineModelBuilder :: getImSourceEnv()
81 return ( imageSourceEnv_Reader!= NULL ) ? imageSourceEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSourceThing *>();
84 * Gets the ImageSectionThing environment
87 SomeEnvironment<ImageSectionThing *> * OutlineModelBuilder :: getImSectionEnv()
89 return ( imagesSectionEnv_Reader!= NULL ) ? imagesSectionEnv_Reader->getEnvironment() : new SomeEnvironment<ImageSectionThing *>();
92 * Gets the AxeThing environment
95 SomeEnvironment<AxeThing *> * OutlineModelBuilder :: getAxesEnv()
97 return ( axesEnv_Reader!= NULL ) ? axesEnv_Reader->getEnvironment() : new SomeEnvironment<AxeThing *>();
100 * Gets the ContourThing environment
103 SomeEnvironment<ContourThing *> * OutlineModelBuilder :: getContourEnv()
105 return ( outlinesEnv_Reader!= NULL ) ? outlinesEnv_Reader->getEnvironment() : new SomeEnvironment<ContourThing *>();
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
114 void OutlineModelBuilder :: buildImageSource_Envornment( std::string sourcesFile, std::map<std::string, ImageSourceThing *> * sources )
116 if( !conceptsFile.empty() )
117 imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> (conceptsFile, sourcesFile, sources);
118 //imageSourceEnv_Reader = new ReaderEnvironment<ImageSourceThing *> ("data/holaConceptsFile.cf", sourcesFile, sources);
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
126 void OutlineModelBuilder :: buildImageSection_Envornment( std::string sectionsFile, std::map<std::string, ImageSectionThing *>* sections )
128 if( !conceptsFile.empty() )
129 imagesSectionEnv_Reader = new ReaderEnvironment<ImageSectionThing *> ( imagesSectionEnvOtherConceptsFN, conceptsFile, sectionsFile, sections);
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
138 void OutlineModelBuilder :: buildAxe_Envornment( std::string axesFile, std::map<std::string, AxeThing *>* axes )
140 if( !conceptsFile.empty() )
141 axesEnv_Reader = new ReaderEnvironment<AxeThing *> ( axesEnvOtherConceptsFN, conceptsFile, axesFile, axes);
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
149 void OutlineModelBuilder :: buildCountour_Envornment( std::string outlinesFile, std::map<std::string, ContourThing *>* outlines )
151 if( !conceptsFile.empty() )
152 outlinesEnv_Reader = new ReaderEnvironment< ContourThing *> ( outlinesEnvOtherConceptsFN, conceptsFile, outlinesFile, outlines);