MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkUSImageVideoSource.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12
13#ifndef mitkUSImageVideoSource_h
14#define mitkUSImageVideoSource_h
15
16// ITK
17#include <itkProcessObject.h>
18
19// MITK
20#include "mitkUSImageSource.h"
24
25// OpenCV
26#include <opencv2/videoio.hpp>
27
28namespace mitk {
39 class MITKUS_EXPORT USImageVideoSource : public mitk::USImageSource
40 {
41 public:
45
50 {
55
57 : topLeftX(0), topLeftY(0), bottomRightX(0), bottomRightY(0) { };
58 USImageRoi(unsigned int topLeftX, unsigned int topLeftY, unsigned int bottomRightX, unsigned int bottomRightY)
59 : topLeftX(topLeftX), topLeftY(topLeftY), bottomRightX(bottomRightX), bottomRightY(bottomRightY) { };
60 };
61
66 {
67 unsigned int top;
68 unsigned int bottom;
69 unsigned int left;
70 unsigned int right;
71
73 : top(0), bottom(0), left(0), right(0) { };
74 USImageCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
75 : top(top), bottom(bottom), left(left), right(right) { };
76 };
77
82 void SetVideoFileInput(std::string path);
83
89 void SetCameraInput(int deviceID);
90
91 void ReleaseInput();
92
98 void SetColorOutput(bool isColor);
99
107 void SetRegionOfInterest(int topLeftX, int topLeftY, int bottomRightX, int bottomRightY);
108
118 void SetRegionOfInterest(USImageRoi regionOfInterest);
119
129 void SetCropping(USImageCropping cropping);
130
135 void RemoveRegionOfInterest();
136
145 void OverrideResolution(int width, int height);
146
147 // Getter & Setter
148 itkGetMacro(IsVideoReady, bool);
149 itkGetMacro(ResolutionOverride, bool);
150 itkSetMacro(ResolutionOverride, bool);
151 itkGetMacro(IsGreyscale,bool);
152 itkGetMacro(ResolutionOverrideWidth,int);
153 itkGetMacro(ResolutionOverrideHeight,int);
154 int GetImageHeight();
155 int GetImageWidth();
156 USImageCropping GetCropping();
157 USImageRoi GetRegionOfInterest();
158
166 bool GetIsReady();
167
168 protected:
170 ~USImageVideoSource() override;
171
177 void GetNextRawImage( std::vector<cv::Mat>& image ) override;
178
184 void GetNextRawImage( std::vector<mitk::Image::Pointer>& image ) override;
185
189 cv::VideoCapture* m_VideoCapture;
190
195
200
205
212
213 ConvertGrayscaleOpenCVImageFilter::Pointer m_GrayscaleFilter;
214 CropOpenCVImageFilter::Pointer m_CropFilter;
215 };
216} // namespace mitk
217#endif
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.
bool m_IsCropped
If true, image will be cropped according to settings of crop filter.
bool m_IsVideoReady
If true, a frame can be grabbed anytime.
bool m_IsGreyscale
If true, image output will be greyscale.
itkGetMacro(ResolutionOverrideWidth, int)
itkGetMacro(IsVideoReady, bool)
itkGetMacro(IsGreyscale, bool)
ConvertGrayscaleOpenCVImageFilter::Pointer m_GrayscaleFilter
CropOpenCVImageFilter::Pointer m_CropFilter
itkSetMacro(ResolutionOverride, bool)
cv::VideoCapture * m_VideoCapture
The source of the video, managed internally.
mitkClassMacroItkParent(USImageVideoSource, itk::ProcessObject)
itkGetMacro(ResolutionOverrideHeight, int)
itkGetMacro(ResolutionOverride, bool)
IGT Exceptions.
Defines a region of interest by distances to the four image borders.
USImageCropping(unsigned int top, unsigned int bottom, unsigned int left, unsigned int right)
Defines a region of interest by top left and bottom right corner.
USImageRoi(unsigned int topLeftX, unsigned int topLeftY, unsigned int bottomRightX, unsigned int bottomRightY)