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 #include "bbmaracasvisuContourStatistics.h"
27 #include "bbcreaMaracasVisuPackage.h"
29 namespace bbcreaMaracasVisu
32 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaMaracasVisu,ContourStatistics)
33 BBTK_BLACK_BOX_IMPLEMENTATION(ContourStatistics,bbtk::AtomicBlackBox);
35 //------------------------------------------------------------
36 void ContourStatistics::Process()
40 double average=0,standardeviation=0;
44 if (bbGetInputLstValue()!=NULL)
46 size=bbGetInputLstValue()->size();
48 max=(*bbGetInputLstValue())[0];
49 min=(*bbGetInputLstValue())[0];
52 for ( i=0; i<size; i++ )
54 ng=(*bbGetInputLstValue())[i];
56 if (max<ng) max=ng; // Max
57 if (min>ng) min=ng; // Min
59 average = acum / size;
64 for ( i=0; i<size; i++ )
66 tmp = (*bbGetInputLstValue())[i] - average;
67 acum = acum + tmp*tmp;
69 standardeviation = sqrt(acum/size);
75 bbSetOutputMax( max );
76 bbSetOutputnPoints( size );
77 bbSetOutputMin( min );
78 bbSetOutputAverage( average );
79 bbSetOutputStandarDeviation( standardeviation );
82 //------------------------------------------------------------
83 void ContourStatistics::bbUserSetDefaultValues()
85 bbSetInputLstValue(NULL);
89 //-----------------------------------------------------------------
90 void ContourStatistics::bbUserInitializeProcessing()
94 //-----------------------------------------------------------------
95 void ContourStatistics::bbUserFinalizeProcessing()
99 //-----------------------------------------------------------------
103 // EO namespace bbcreaMaracasVisu