|
From: Herton R. K. <he...@us...> - 2005-07-13 02:18:15
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/features/clustertendency In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10676/clustertendency Added Files: Makefile.am clustertendency.cpp clustertendency.h kimageprocess_glcm_clustertendency.desktop Log Message: - Added cluster tendency feature to glcm method. --- NEW FILE: kimageprocess_glcm_clustertendency.desktop --- [Desktop Entry] Name=clustertendency Comment=Cluster Tendency calculation over GLCM ServiceTypes=KImageProcess/Feature Type=Service X-KDE-Library=kimageprocess_glcm_clustertendency X-Category=glcm --- NEW FILE: clustertendency.cpp --- /*************************************************************************** * Copyright (C) 2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "clustertendency.h" #include <kgenericfactory.h> #include <kaction.h> #include <klocale.h> #include <kdebug.h> #include <ktimage.h> #include <ktfeaturemanager.h> #include <ktmethod.h> K_EXPORT_COMPONENT_FACTORY( kimageprocess_glcm_clustertendency, KGenericFactory<KTGLCMclustertendency>( "kimageprocess_glcm_clustertendency" ) ) KTGLCMclustertendency::KTGLCMclustertendency(QObject *parent, const char* name, const QStringList&) : KTFeature("glcm") { Q_UNUSED(parent); Q_UNUSED(name); //check dependencies m_featureName = i18n("clustertendency"); m_longName = i18n("Cluster Tendency"); } KTGLCMclustertendency::~KTGLCMclustertendency() { } float KTGLCMclustertendency::_calculate(KTImage *img, int direction) { int glcmSize = method()->dataSize(); float **glcm = (float**) method()->data(direction); float result = 0.0; float doublemean = 2 * m_mean->calculate(img, direction); int i, j; for (i = 0; i < glcmSize; ++i) for (j = 0; j < glcmSize; ++j) result += (i + j - doublemean) * glcm[i][j]; return result; } void KTGLCMclustertendency::resolveDeps() { m_mean = manager()->getFeature("glcm", "Mean"); } #include "clustertendency.moc" --- NEW FILE: clustertendency.h --- /*************************************************************************** * Copyright (C) 2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef KIMAGEPROCESS_GLCM_CLUSTERTENDENCY_H #define KIMAGEPROCESS_GLCM_CLUSTERTENDENCY_H #include <ktfeature.h> class KAction; class KTImage; /** * clustertendency calculation * @author Gustavo Pichorim Boiko * */ class KTGLCMclustertendency : public KTFeature { Q_OBJECT public: KTGLCMclustertendency(QObject *parent, const char *name, const QStringList&); ~KTGLCMclustertendency(); float _calculate(KTImage *img, int direction); void resolveDeps(); private: KTFeature *m_mean; }; #endif --- NEW FILE: Makefile.am --- INCLUDES = $(all_includes) -I$(srcdir)/../../../../libkimageprocess METASOURCES = AUTO kde_module_LTLIBRARIES = kimageprocess_glcm_clustertendency.la kimageprocess_glcm_clustertendency_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) noinst_HEADERS = clustertendency.h kimageprocess_glcm_clustertendency_la_SOURCES = clustertendency.cpp kde_services_DATA = kimageprocess_glcm_clustertendency.desktop kimageprocess_glcm_clustertendency_la_LIBADD = $(top_builddir)/src/libkimageprocess/libkimageprocess.la \ -lkdeui |