EMAN2
boxingtools.h
Go to the documentation of this file.
1/*
2 * Author: David Woolford, 04/15/2008 (woolford@bcm.edu)
3 * Copyright (c) 2000-2006 Baylor College of Medicine
4 *
5 * This software is issued under a joint BSD/GNU license. You may use the
6 * source code in this file under either license. However, note that the
7 * complete EMAN2 and SPARX software packages have some GPL dependencies,
8 * so you are responsible for compliance with the licenses of these packages
9 * if you opt to use BSD licensing. The warranty disclaimer below holds
10 * in either instance.
11 *
12 * This complete copyright notice must be included in any revised version of the
13 * source code. Additional authorship citations may be added, but existing
14 * author citations must be preserved.
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, write to the Free Software
28 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 *
30 * */
31
32#ifndef eman_boxingtools_h__
33#define eman_boxingtools_h__ 1
34
35#include "emdata.h"
36#include "geometry.h"
37#include <vector>
38using std::vector;
39
40#include <vector>
41using std::vector;
42
43#include <map>
44using std::map;
45
46#include <gsl/gsl_matrix.h>
47
48namespace EMAN
49{
57 {
58 public:
61
72 static vector<float> get_min_delta_profile(const EMData* const image, int x, int y, int radius);
73
85 static bool is_local_maximum(const EMData* const image, int x, int y, int radius, EMData* const exclusion_map);
86
87
88 static vector<IntPoint> auto_correlation_pick(const EMData* const image, float threshold, int radius, const vector<float>& profile, EMData* const exclusion,const int cradius, int mode=1);
89
90 static bool hi_brid(const EMData* const image, int x, int y, int radius,EMData* const exclusion_map, vector<float>& profile);
91
92 static void set_radial_non_zero(EMData* const exclusion, int x, int y, int radius);
93
94 static IntPoint find_radial_max(const EMData* const map, int x, int y, int radius);
95
96 static map<unsigned int, unsigned int> classify(const vector<vector<float> >& data, const unsigned int& classes = 4);
97
98 static Vec3f get_color( const unsigned int index );
99
100 static void set_region( EMData* const image, const EMData* const mask, const int x, const int y, const float& val );
101
102 enum CmpMode {
106 };
107
108 static void set_mode( const CmpMode m ) { mode = m; }
109 private:
110 // A vector to store the "seed" starting colors, which exist at the corners of the cube.
111 // Then the vector is grown as more colours are asked for.
112 static vector<Vec3f> colors;
113 static CmpMode mode;
114 };
115
117 {
118 public:
119 BoxSVDClassifier(const vector<vector<float> >& data, const unsigned int& classes = 4);
120
122
123 map< unsigned int, unsigned int> go();
124
125 // Because the results of the classification always give a random class number, I thought it
126 // be easier for the user if the classes with the greatest numbers always had the same colour.
127 // This is achieved using this function
128 static map< unsigned int, unsigned int> colorMappingByClassSize( const map< unsigned int, unsigned int>& grouping );
129 private:
130 const vector<vector<float> >& mData;
131
132 unsigned int mColumns;
133 unsigned int mRows;
134
135 unsigned int mClasses;
136
137
138 map< unsigned int, unsigned int> randomSeedCluster(const gsl_matrix* const svd_coords, unsigned int matrix_dims);
139 map< unsigned int, unsigned int> getIterativeCluster(const gsl_matrix* const svd_coords, const map< unsigned int, unsigned int>& current_grouping);
140
141 bool setDims( const vector<vector<float> >& data );
142
143 vector<vector<float> > getDistances( const gsl_matrix* const svd_coords, const gsl_matrix* const ref_coords);
144
145 map< unsigned int, unsigned int> getMapping(const vector<vector<float> >& distances);
146 };
147
148} // namespace EMAN
149
150#endif // eman_boxingtools_h__
unsigned int mColumns
Definition: boxingtools.h:132
const vector< vector< float > > & mData
Definition: boxingtools.h:130
map< unsigned int, unsigned int > getIterativeCluster(const gsl_matrix *const svd_coords, const map< unsigned int, unsigned int > &current_grouping)
map< unsigned int, unsigned int > go()
unsigned int mClasses
Definition: boxingtools.h:135
bool setDims(const vector< vector< float > > &data)
map< unsigned int, unsigned int > randomSeedCluster(const gsl_matrix *const svd_coords, unsigned int matrix_dims)
static map< unsigned int, unsigned int > colorMappingByClassSize(const map< unsigned int, unsigned int > &grouping)
BoxSVDClassifier(const vector< vector< float > > &data, const unsigned int &classes=4)
Definition: boxingtools.cpp:98
map< unsigned int, unsigned int > getMapping(const vector< vector< float > > &distances)
vector< vector< float > > getDistances(const gsl_matrix *const svd_coords, const gsl_matrix *const ref_coords)
BoxingTools is class for encapsulating common boxing operations that may become expensive if they are...
Definition: boxingtools.h:57
static IntPoint find_radial_max(const EMData *const map, int x, int y, int radius)
static vector< float > get_min_delta_profile(const EMData *const image, int x, int y, int radius)
Gets a pixel minimum delta radial profile about some pixel focal point.
static map< unsigned int, unsigned int > classify(const vector< vector< float > > &data, const unsigned int &classes=4)
static void set_region(EMData *const image, const EMData *const mask, const int x, const int y, const float &val)
static void set_radial_non_zero(EMData *const exclusion, int x, int y, int radius)
static vector< Vec3f > colors
Definition: boxingtools.h:112
static vector< IntPoint > auto_correlation_pick(const EMData *const image, float threshold, int radius, const vector< float > &profile, EMData *const exclusion, const int cradius, int mode=1)
static Vec3f get_color(const unsigned int index)
static bool hi_brid(const EMData *const image, int x, int y, int radius, EMData *const exclusion_map, vector< float > &profile)
static void set_mode(const CmpMode m)
Definition: boxingtools.h:108
static CmpMode mode
Definition: boxingtools.h:113
static bool is_local_maximum(const EMData *const image, int x, int y, int radius, EMData *const exclusion_map)
Determines if a given pixel is the maximum in local radial neighborhood Useful for automated correlat...
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
IntPoint defines an integer-coordinate point in a 1D/2D/3D space.
Definition: geometry.h:192
E2Exception class.
Definition: aligner.h:40
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517