/* # # File : itkSTMS_BlurringSTMS.h # ( C++ header file - STMS ) # # Description : STMS lib that implements the STMS filter and clustering. # This file is a part of the STMS Library project. # ( https://www.creatis.insa-lyon.fr/site7/fr/realisations ) # # [1] S. Mure, Grenier, T., Meier, S., Guttmann, R. G., et Benoit-Cattin, H., # « Unsupervised spatio-temporal filtering of image sequences. A mean-shift specification », # Pattern Recognition Letters, vol. 68, Part 1, p. 48 - 55, 2015. # # Copyright : Thomas GRENIER - Simon MURE # ( https://www.creatis.insa-lyon.fr/~grenier/ ) # # License : CeCILL C # ( http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.txt ) # # This software is governed by the CeCILL license under French law and # abiding by the rules of distribution of free software. You can use, # modify and/ or redistribute the software under the terms of the CeCILL # license as circulated by CEA, CNRS and INRIA at the following URL # "http://www.cecill.info". # # As a counterpart to the access to the source code and rights to copy, # modify and redistribute granted by the license, users are provided only # with a limited warranty and the software's author, the holder of the # economic rights, and the successive licensors have only limited # liability. # # In this respect, the user's attention is drawn to the risks associated # with loading, using, modifying and/or developing or reproducing the # software by the user in light of its specific status of free software, # that may mean that it is complicated to manipulate, and that also # therefore means that it is reserved for developers and experienced # professionals having in-depth computer knowledge. Users are therefore # encouraged to load and test the software's suitability as regards their # requirements in conditions enabling the security of their systems and/or # data to be ensured and, more generally, to use and operate it in the # same conditions as regards security. # # The fact that you are presently reading this means that you have had # knowledge of the CeCILL license and that you accept its terms. # */ /* Please don't forget to cite our work : @article {MURE-15a, title = {Unsupervised spatio-temporal filtering of image sequences. A mean-shift specification}, journal = {Pattern Recognition Letters}, volume = {68, Part 1}, year = {2015}, pages = {48 - 55}, issn = {0167-8655}, doi = {http://dx.doi.org/10.1016/j.patrec.2015.07.021}, url = {http://www.sciencedirect.com/science/article/pii/S0167865515002305}, author = {S. Mure and T Grenier and Meier, S. and Guttmann, R.G. and H. Benoit-Cattin} } */ #ifndef itkSTMS_BlurringSTMS_H #define itkSTMS_BlurringSTMS_H #include "itkSTMS_ArgumentsAnalysis.h" #include "itkSTMS_ImageSequenceToTemporalSet.h" #include "itkImageFileReader.h" #ifndef STMS_NUMBERING_FORM_ONE #define STMS_NUMBERING_FORM_ONE "1" #endif namespace itkSTMS { template < class IndexType, class SpatialType, class PixelType, class ImageType> class itkSTMS_BlurringSTMS { public: typedef itkSTMS::ParamsAnalysisOutputType ParametersType; // Sample set typedefs typedef std::vector< SpatialType > SpatialVectorType; typedef std::vector< PixelType > RangeVectorType; typedef std::vector< IndexType > IndexSampleSetType; typedef std::vector< SpatialVectorType > SpatialSampleSetType; typedef std::vector< RangeVectorType > RangeSampleSetType; typedef typename ImageType::Pointer ImagePointer; typedef itk::ImageFileReader ReaderType; typedef typename ReaderType::Pointer ReaderPointer; // Image typedefs typedef typename ImageType::IndexType ImageIndexType; typedef std::vector ImageIndexSetType; // Methods itkSTMS_BlurringSTMS( IndexSampleSetType* idx, IndexSampleSetType* cla, IndexSampleSetType* wei, SpatialSampleSetType* sp, RangeSampleSetType* ra, ParametersType* params, ParserOutputType* desc ); inline ~itkSTMS_BlurringSTMS(){ delete classSetMemory; delete spatialSetMemory; } inline IndexSampleSetType* GetIndexSet (){ return indexSet; } inline IndexSampleSetType* GetClassSet (){ return classSet; } inline IndexSampleSetType* GetWeightsSet (){ return weightsSet; } inline SpatialSampleSetType* GetSpatialSet (){ return spatialSet; } inline RangeSampleSetType* GetRangeSet (){ return rangeSet; } inline IndexSampleSetType* GetClassMemory (){ return classSetMemory; } inline SpatialSampleSetType* GetSpatialMemory (){ return spatialSetMemory; } void GenerateData(); void NoMergeSTMSFiltering(); void ClassificationNoMergeSTMSFiltering(); void MergeSTMSFiltering(); void MergeSamples(); void FinalMerging(); template void VectorDistance(float &dist, std::vector< T > &a, std::vector< T > &b); void InfiniteNorm (bool &dist, RangeVectorType &a, RangeVectorType &b); void MergeInfiniteNorm(bool &dist, RangeVectorType &a, RangeVectorType &b); template void VectorWeightedMean(std::vector &a, unsigned int &a_w, std::vector &b, unsigned int &b_w); template void VectorWeightedAcc(std::vector &a, std::vector &b, unsigned int &b_w); template void VectorWeightedAcc(std::vector &a, unsigned int &a_w, std::vector &b, unsigned int &b_w); template void VectorMul(std::vector &a, unsigned int &coeff); template void VectorDiv(std::vector &a, unsigned int &coeff); template void VectorAcc(std::vector &a, std::vector &b); private: // Attributes float mergeFactor; ParametersType* stmsParams; ParserOutputType* expDescription; IndexSampleSetType* classSetMemory; SpatialSampleSetType* spatialSetMemory; IndexSampleSetType* indexSet; IndexSampleSetType* classSet; IndexSampleSetType* weightsSet; SpatialSampleSetType* spatialSet; RangeSampleSetType * rangeSet; }; } // end of namespace itkSTMS #ifndef ITK_MANUAL_INSTANTIATION #include "itkSTMS_BlurringSTMS.txx" #endif #endif // itkSTMS_BlurringSTMS_H