NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkQDSCommon.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkQDSCommon_h
16 #define niftkQDSCommon_h
17 
18 #include "niftkOpenCVExports.h"
19 #include <boost/gil/gil_all.hpp>
20 #include <opencv2/core/types_c.h>
21 #include <opencv2/core/core.hpp>
22 
23 // the ancient version of boost that comes with mitk does not have
24 // a 64-bit floating point pixel format.
25 // so define this, based on my hacked boost version:
26 // https://bitbucket.org/bruelltuete/boost/commits/27198c44596696d1bb1ae686c828efa82b08fd9f
27 namespace boost
28 {
29 namespace gil
30 {
31 
32 struct double_zero { static float apply() { return 0.0; } };
33 struct double_one { static float apply() { return 1.0; } };
34 
35 typedef scoped_channel_value<double, double_zero, double_one> bits64f;
36 
37 GIL_DEFINE_BASE_TYPEDEFS(64f,gray)
38 
39 } // end namespace boost
40 } // end namespace gil
41 
42 namespace niftk
43 {
44 
46 {
47  unsigned short x;
48  unsigned short y;
49 
50  RefPoint(unsigned short _x = -1, unsigned short _y = -1)
51  : x(_x), y(_y)
52  {
53  }
54 
56  {
57  x = p.x;
58  y = p.y;
59  return *this;
60  }
61 
62  // conversion operator! exists for convinience with refmaps
63  // FIXME: pixel assignment is done with a template parameter
64  // so this conversion is not actually called automagically!
65  operator boost::gil::dev2n16_pixel_t() const
66  {
67  return boost::gil::dev2n16_pixel_t(x, y);
68  }
69 
70  // compares coordinates, for use in priority_queue
71  bool operator<(const RefPoint& rhs) const;
72 };
73 
74 
83  const boost::gil::gray8c_view_t src,
84  const boost::gil::gray8_view_t dst);
85 
86 float NIFTKOPENCV_EXPORT Zncc_C1(int p0x, int p0y, int p1x, int p1y, int w,
87  boost::gil::gray8c_view_t img0,
88  boost::gil::gray8c_view_t img1,
89  boost::gil::gray32sc_view_t integral0,
90  boost::gil::gray32sc_view_t integral1,
91  boost::gil::gray64fc_view_t square0,
92  boost::gil::gray64fc_view_t square1);
93 
98 {
99 public:
100  virtual ~QDSInterface();
101 
102  virtual void Process(const IplImage* left, const IplImage* right) = 0;
103 
104  virtual int GetWidth() const = 0;
105  virtual int GetHeight() const = 0;
106 
107  virtual CvPoint GetMatch(int x, int y) const = 0;
108 
109  // caller needs to clean up
110  virtual IplImage* CreateDisparityImage() const = 0;
111 };
112 
113 } // namespace
114 
115 #endif
Definition: niftkQDSCommon.h:27
bool operator<(const GoldStandardPoint &GSP1, const GoldStandardPoint &GSP2)
Definition: mitkOpenCVPointTypes.cxx:125
void BuildTextureDescriptor(const boost::gil::gray8c_view_t src, const boost::gil::gray8_view_t dst)
Definition: niftkQDSCommon.cxx:45
static float apply()
Definition: niftkQDSCommon.h:32
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1236
GLenum src
Definition: glew.h:2406
unsigned short x
Definition: niftkQDSCommon.h:47
Definition: niftkQDSCommon.h:32
Definition: niftkQDSCommon.h:97
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1874
GLenum GLenum dst
Definition: glew.h:2406
Definition: niftkQDSCommon.h:33
unsigned short y
Definition: niftkQDSCommon.h:48
GLfloat GLfloat p
Definition: glew.h:14169
static float apply()
Definition: niftkQDSCommon.h:33
#define NIFTKOPENCV_EXPORT
Definition: niftkSequentialCpuQds.h:27
Definition: niftkQDSCommon.h:45
RefPoint & operator=(const RefPoint &p)
Definition: niftkQDSCommon.h:55
GLint left
Definition: glew.h:6793
scoped_channel_value< double, double_zero, double_one > bits64f
Definition: niftkQDSCommon.h:35
float Zncc_C1(int p0x, int p0y, int p1x, int p1y, int w, boost::gil::gray8c_view_t img0, boost::gil::gray8c_view_t img1, boost::gil::gray32sc_view_t integral0, boost::gil::gray32sc_view_t integral1, boost::gil::gray64fc_view_t square0, boost::gil::gray64fc_view_t square1)
Definition: niftkQDSCommon.cxx:90
GLint GLint GLint GLint GLint x
Definition: glew.h:1236
RefPoint(unsigned short _x=-1, unsigned short _y=-1)
Definition: niftkQDSCommon.h:50
Definition: niftkExceptionObject.h:21
GLclampf f
Definition: glew.h:3136