Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkUSImageVideoSource.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef MITKUSImageVideoSource_H_HEADER_INCLUDED_
18 #define MITKUSImageVideoSource_H_HEADER_INCLUDED_
19 
20 // ITK
21 #include <itkProcessObject.h>
22 
23 // MITK
24 #include "mitkUSImageSource.h"
28 
29 // OpenCV
30 #include <highgui.h>
31 
32 namespace mitk {
43  class MITKUS_EXPORT USImageVideoSource : public mitk::USImageSource
44  {
45  public:
46  mitkClassMacroItkParent(USImageVideoSource, itk::ProcessObject);
47  itkFactorylessNewMacro(Self)
48  itkCloneMacro(Self)
49 
50 
53  struct USImageRoi
54  {
55  int topLeftX;
56  int topLeftY;
59 
61  : topLeftX(0), topLeftY(0), bottomRightX(0), bottomRightY(0) { };
62  USImageRoi(unsigned int topLeftX, unsigned int topLeftY, unsigned int bottomRightX, unsigned int bottomRightY)
63  : topLeftX(topLeftX), topLeftY(topLeftY), bottomRightX(bottomRightX), bottomRightY(bottomRightY) { };
64  };
65 
70  {
71  unsigned int top;
72  unsigned int bottom;
73  unsigned int left;
74  unsigned int right;
75 
77  : top(0), bottom(0), left(0), right(0) { };
78  USImageCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
79  : top(top), bottom(bottom), left(left), right(right) { };
80  };
81 
86  void SetVideoFileInput(std::string path);
87 
93  void SetCameraInput(int deviceID);
94 
95  void ReleaseInput();
96 
102  void SetColorOutput(bool isColor);
103 
111  void SetRegionOfInterest(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY);
112 
122  void SetRegionOfInterest(USImageRoi regionOfInterest);
123 
133  void SetCropping(USImageCropping cropping);
134 
139  void RemoveRegionOfInterest();
140 
149  void OverrideResolution(int width, int height);
150 
151  // Getter & Setter
152  itkGetMacro(IsVideoReady, bool);
153  itkGetMacro(ResolutionOverride, bool);
154  itkSetMacro(ResolutionOverride, bool);
155  itkGetMacro(IsGreyscale,bool);
156  itkGetMacro(ResolutionOverrideWidth,int);
157  itkGetMacro(ResolutionOverrideHeight,int);
158  int GetImageHeight();
159  int GetImageWidth();
160  USImageCropping GetCropping();
161  USImageRoi GetRegionOfInterest();
162 
170  bool GetIsReady();
171 
172  protected:
174  virtual ~USImageVideoSource();
175 
181  virtual void GetNextRawImage( cv::Mat& image ) override;
182 
188  virtual void GetNextRawImage( mitk::Image::Pointer& image ) override;
189 
193  cv::VideoCapture* m_VideoCapture;
194 
199 
204 
209 
216 
219  };
220 } // namespace mitk
221 #endif /* MITKUSImageVideoSource_H_HEADER_INCLUDED_ */
itk::SmartPointer< Self > Pointer
Defines a region of interest by distances to the four image borders.
ConvertGrayscaleOpenCVImageFilter::Pointer m_GrayscaleFilter
cv::VideoCapture * m_VideoCapture
The source of the video, managed internally.
DataCollection - Class to facilitate loading/accessing structured data.
This is an abstract superclass for delivering USImages. Each subclass must implement the method mitk:...
This class can be pointed to a video file or a videodevice and delivers USImages. ...
CropOpenCVImageFilter::Pointer m_CropFilter
Defines a region of interest by top left and bottom right corner.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:53
USImageRoi(unsigned int topLeftX, unsigned int topLeftY, unsigned int bottomRightX, unsigned int bottomRightY)
bool m_IsVideoReady
If true, a frame can be grabbed anytime.
bool m_IsGreyscale
If true, image output will be greyscale.
USImageCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
bool m_IsCropped
If true, image will be cropped according to settings of crop filter.