EMAN2
tomoseg.h
Go to the documentation of this file.
1/*
2 * This software is issued under a joint BSD/GNU license. You may use the
3 * source code in this file under either license. However, note that the
4 * complete EMAN2 and SPARX software packages have some GPL dependencies,
5 * so you are responsible for compliance with the licenses of these packages
6 * if you opt to use BSD licensing. The warranty disclaimer below holds
7 * in either instance.
8 *
9 * This complete copyright notice must be included in any revised version of the
10 * source code. Additional authorship citations may be added, but existing
11 * author citations must be preserved.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by.edge
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 */
27
28#ifndef eman_tomoseg_h_
29#define eman_tomoseg_h_
30
31#include "emdata.h"
32
33namespace EMAN
34{
36 public:
37 TomoObject(vector<Vec3i> allpt, float md=1, int slice=0);
38 void write_imod(FILE *fp);
39 int get_size();
40
41 /* Starting from connecting two terminis and iteratively bend the polyline by breaking at the
42 * most distant point from the polyline.*/
43 int bend();
44
45 /* Enlong the line segments and connect the adjecent objects. */
46 void enlong(EMData *bwmap,EMData *skelmap);
47
48 public:
49 vector<int> ptid; // ID of the cornor points in the object
50 vector<int> segid; // ID of the segments in the labeled map that are in this object.
51 vector<Vec3i> allpoints;// Cooridinates of all points in this object
52 float maxdist; // Max distance to bend the polyline.
54 };
55 class TomoSeg
56 {
57 public:
58 TomoSeg(){verb=false;};
59 void set_verb(){verb=!verb;};
60
61 /* Read the black-white map. Each segment in the map should be labeled. */
62 int read_bwmap(EMData *map);
63
64 /* Read the skeleton map. The map should be labeled the same as the bwmap */
65 int read_skelmap(EMData *map);
66
67 /* Generate objects from numo largest segments in the skeleton map. */
68 int generate_objects(int numo, float maxdist, int nowslice);
69
70 /* Check the value of 8 neighbors. Return the number of white neighbors. */
71 int check_neighbors(int x,int y);
72
73 /* Write objects to imod format */
74 void write_imod(const char *file);
75
76 private:
79 bool verb;
80 vector<TomoObject> objs;
81 };
82}
83
84#endif
EMData stores an image's data and defines core image processing routines.
Definition: emdata.h:82
void enlong(EMData *bwmap, EMData *skelmap)
Definition: tomoseg.cpp:123
TomoObject(vector< Vec3i > allpt, float md=1, int slice=0)
Definition: tomoseg.cpp:36
vector< int > segid
Definition: tomoseg.h:50
void write_imod(FILE *fp)
Definition: tomoseg.cpp:112
vector< int > ptid
Definition: tomoseg.h:49
vector< Vec3i > allpoints
Definition: tomoseg.h:51
float maxdist
Definition: tomoseg.h:52
int check_neighbors(int x, int y)
Definition: tomoseg.cpp:209
int generate_objects(int numo, float maxdist, int nowslice)
Definition: tomoseg.cpp:145
int read_bwmap(EMData *map)
EMData * bwmap
Definition: tomoseg.h:78
void write_imod(const char *file)
Definition: tomoseg.cpp:194
int read_skelmap(EMData *map)
Definition: tomoseg.cpp:138
void set_verb()
Definition: tomoseg.h:59
EMData * skelmap
Definition: tomoseg.h:77
bool verb
Definition: tomoseg.h:79
vector< TomoObject > objs
Definition: tomoseg.h:80
E2Exception class.
Definition: aligner.h:40
#define y(i, j)
Definition: projector.cpp:1516
#define x(i)
Definition: projector.cpp:1517