3 # File : itkSTMS_BlurringSTMS.h
4 # ( C++ header file - STMS )
6 # Description : STMS lib that implements the STMS filter and clustering.
7 # This file is a part of the STMS Library project.
8 # ( https://www.creatis.insa-lyon.fr/site7/fr/realisations )
10 # [1] S. Mure, Grenier, T., Meier, S., Guttmann, R. G., et Benoit-Cattin, H.,
11 # « Unsupervised spatio-temporal filtering of image sequences. A mean-shift specification »,
12 # Pattern Recognition Letters, vol. 68, Part 1, p. 48 - 55, 2015.
14 # Copyright : Thomas GRENIER - Simon MURE
15 # ( https://www.creatis.insa-lyon.fr/~grenier/ )
18 # ( http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.txt )
20 # This software is governed by the CeCILL license under French law and
21 # abiding by the rules of distribution of free software. You can use,
22 # modify and/ or redistribute the software under the terms of the CeCILL
23 # license as circulated by CEA, CNRS and INRIA at the following URL
24 # "http://www.cecill.info".
26 # As a counterpart to the access to the source code and rights to copy,
27 # modify and redistribute granted by the license, users are provided only
28 # with a limited warranty and the software's author, the holder of the
29 # economic rights, and the successive licensors have only limited
32 # In this respect, the user's attention is drawn to the risks associated
33 # with loading, using, modifying and/or developing or reproducing the
34 # software by the user in light of its specific status of free software,
35 # that may mean that it is complicated to manipulate, and that also
36 # therefore means that it is reserved for developers and experienced
37 # professionals having in-depth computer knowledge. Users are therefore
38 # encouraged to load and test the software's suitability as regards their
39 # requirements in conditions enabling the security of their systems and/or
40 # data to be ensured and, more generally, to use and operate it in the
41 # same conditions as regards security.
43 # The fact that you are presently reading this means that you have had
44 # knowledge of the CeCILL license and that you accept its terms.
47 /* Please don't forget to cite our work :
49 title = {Unsupervised spatio-temporal filtering of image sequences. A mean-shift specification},
50 journal = {Pattern Recognition Letters},
51 volume = {68, Part 1},
55 doi = {http://dx.doi.org/10.1016/j.patrec.2015.07.021},
56 url = {http://www.sciencedirect.com/science/article/pii/S0167865515002305},
57 author = {S. Mure and T Grenier and Meier, S. and Guttmann, R.G. and H. Benoit-Cattin}
60 #ifndef itkSTMS_BlurringSTMS_H
61 #define itkSTMS_BlurringSTMS_H
63 #include "itkSTMS_ArgumentsAnalysis.h"
64 #include "itkSTMS_ImageSequenceToTemporalSet.h"
65 #include "itkImageFileReader.h"
67 #ifndef STMS_NUMBERING_FORM_ONE
68 #define STMS_NUMBERING_FORM_ONE "1"
73 template < class IndexType, class SpatialType, class PixelType, class ImageType>
74 class itkSTMS_BlurringSTMS
78 typedef itkSTMS::ParamsAnalysisOutputType ParametersType;
80 // Sample set typedefs
81 typedef std::vector< SpatialType > SpatialVectorType;
82 typedef std::vector< PixelType > RangeVectorType;
84 typedef std::vector< IndexType > IndexSampleSetType;
85 typedef std::vector< SpatialVectorType > SpatialSampleSetType;
86 typedef std::vector< RangeVectorType > RangeSampleSetType;
88 typedef typename ImageType::Pointer ImagePointer;
89 typedef itk::ImageFileReader<ImageType> ReaderType;
90 typedef typename ReaderType::Pointer ReaderPointer;
93 typedef typename ImageType::IndexType ImageIndexType;
94 typedef std::vector<ImageIndexType> ImageIndexSetType;
97 itkSTMS_BlurringSTMS( IndexSampleSetType* idx,
98 IndexSampleSetType* cla,
99 IndexSampleSetType* wei,
100 SpatialSampleSetType* sp,
101 RangeSampleSetType* ra,
102 ParametersType* params,
103 ParserOutputType* desc );
105 inline ~itkSTMS_BlurringSTMS(){ delete classSetMemory;
106 delete spatialSetMemory; }
108 inline IndexSampleSetType* GetIndexSet (){ return indexSet; }
109 inline IndexSampleSetType* GetClassSet (){ return classSet; }
110 inline IndexSampleSetType* GetWeightsSet (){ return weightsSet; }
111 inline SpatialSampleSetType* GetSpatialSet (){ return spatialSet; }
112 inline RangeSampleSetType* GetRangeSet (){ return rangeSet; }
113 inline IndexSampleSetType* GetClassMemory (){ return classSetMemory; }
114 inline SpatialSampleSetType* GetSpatialMemory (){ return spatialSetMemory; }
117 void NoMergeSTMSFiltering();
118 void ClassificationNoMergeSTMSFiltering();
119 void MergeSTMSFiltering();
123 template<class T> void VectorDistance(float &dist, std::vector< T > &a, std::vector< T > &b);
124 void InfiniteNorm (bool &dist, RangeVectorType &a, RangeVectorType &b);
125 void MergeInfiniteNorm(bool &dist, RangeVectorType &a, RangeVectorType &b);
127 template<class T> void VectorWeightedMean(std::vector<T> &a, unsigned int &a_w, std::vector<T> &b, unsigned int &b_w);
128 template<class T> void VectorWeightedAcc(std::vector<T> &a, std::vector<T> &b, unsigned int &b_w);
129 template<class T> void VectorWeightedAcc(std::vector<T> &a, unsigned int &a_w, std::vector<T> &b, unsigned int &b_w);
130 template<class T> void VectorMul(std::vector<T> &a, unsigned int &coeff);
131 template<class T> void VectorDiv(std::vector<T> &a, unsigned int &coeff);
132 template<class T> void VectorAcc(std::vector<T> &a, std::vector<T> &b);
138 ParametersType* stmsParams;
139 ParserOutputType* expDescription;
141 IndexSampleSetType* classSetMemory;
142 SpatialSampleSetType* spatialSetMemory;
143 IndexSampleSetType* indexSet;
144 IndexSampleSetType* classSet;
145 IndexSampleSetType* weightsSet;
146 SpatialSampleSetType* spatialSet;
147 RangeSampleSetType * rangeSet;
150 } // end of namespace itkSTMS
152 #ifndef ITK_MANUAL_INSTANTIATION
153 #include "itkSTMS_BlurringSTMS.txx"
156 #endif // itkSTMS_BlurringSTMS_H