Seg3D  2.4
Seg3D is a free volume segmentation and processing tool developed by the NIH Center for Integrative Biomedical Computing at the University of Utah Scientific Computing and Imaging (SCI) Institute.
extrema.hxx
1 /*
2  For more information, please see: http://software.sci.utah.edu
3 
4  The MIT License
5 
6  Copyright (c) 2016 Scientific Computing and Imaging Institute,
7  University of Utah.
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a
11  copy of this software and associated documentation files (the "Software"),
12  to deal in the Software without restriction, including without limitation
13  the rights to use, copy, modify, merge, publish, distribute, sublicense,
14  and/or sell copies of the Software, and to permit persons to whom the
15  Software is furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included
18  in all copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21  OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26  DEALINGS IN THE SOFTWARE.
27 */
28 
29 // File : extrema.hxx
30 // Author : Pavel A. Koshevoy
31 // Created : 2006/04/04 11:10
32 // Copyright : (C) 2004-2008 University of Utah
33 // Description : SIFT key extrema point and descriptor vector classes.
34 
35 #ifndef EXTREMA_HXX_
36 #define EXTREMA_HXX_
37 
38 // system includes:
39 #include <vector>
40 
41 // ITK includes:
42 #include <itkPoint.h>
43 
44 
45 //----------------------------------------------------------------
46 // KEY_SIZE
47 //
48 static const unsigned int KEY_SIZE = 128;
49 
50 
51 //----------------------------------------------------------------
52 // extrema_t
53 //
54 class extrema_t
55 {
56 public:
57 
58  // shorthand notation for 2D points:
59  typedef itk::Point<double, 2> pnt2d_t;
60 
61  // local pixel coordinates (non-physical) within the octave image:
62  pnt2d_t pixel_coords_;
63 
64  // coordinates in the physical space of the local image:
65  pnt2d_t local_coords_;
66 
67  // physical coordinates within the target space:
68  mutable pnt2d_t target_coords_;
69 
70  // FIXME: extrema mass (cluster mass normalized by cluster area):
71  double mass_;
72 
73  // point ids:
74  unsigned int pyramid_;
75  unsigned int octave_;
76  unsigned int scale_;
77 };
78 
79 //----------------------------------------------------------------
80 // descriptor_t
81 //
83 {
84 public:
85  descriptor_t(extrema_t * extrema = NULL):
86  extrema_(extrema)
87  {}
88 
89  descriptor_t(const descriptor_t & key)
90  { *this = key; }
91 
92  descriptor_t & operator = (const descriptor_t & key)
93  {
94  if (this == &key) return *this;
95 
96  extrema_ = key.extrema_;
97  local_orientation_ = key.local_orientation_;
98  target_orientation_ = key.target_orientation_;
99  descriptor_ = key.descriptor_;
100 
101  return *this;
102  }
103 
104  // reference to the extrema point:
105  extrema_t * extrema_;
106 
107  // coordinate system orientation angle expressed in the local image space:
108  double local_orientation_;
109 
110  // orientation angle in the target image space:
111  mutable double target_orientation_;
112 
113  // the descriptor vector:
114  std::vector<double> descriptor_;
115 };
116 
117 //----------------------------------------------------------------
118 // ext_wrapper_t
119 //
121 {
122 public:
123  ext_wrapper_t():
124  key_(NULL)
125  {}
126 
127  // vector-like accessor to the extrema target space coordinates:
128  inline const double & operator [] (const unsigned int & index) const
129  { return key_->extrema_->target_coords_[index]; }
130 
131  // pointer to the key:
132  const descriptor_t * key_;
133 };
134 
135 //----------------------------------------------------------------
136 // key_wrapper_t
137 //
139 {
140 public:
141  key_wrapper_t():
142  key_(NULL)
143  {}
144 
145  // vector-like accessor to the key descriptor:
146  inline const double & operator [] (const unsigned int & index) const
147  { return key_->descriptor_[index]; }
148 
149  // pointer to the key:
150  const descriptor_t * key_;
151 };
152 
153 
154 #endif // EXTREMA_HXX_
Definition: extrema.hxx:82
Definition: extrema.hxx:54
Definition: extrema.hxx:120
Definition: extrema.hxx:138