Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkUSVideoDeviceCustomControls.cpp
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 
18 
20  : mitk::USAbstractControlInterface(device.GetPointer()), m_IsActive(false)
21 {
22  m_ImageSource = dynamic_cast<mitk::USImageVideoSource*>(m_Device->GetUSImageSource().GetPointer());
23 }
24 
26 {
27 }
28 
30 {
31  m_IsActive = isActive;
32 }
33 
35 {
36  return m_IsActive;
37 }
38 
40 {
41  MITK_INFO << "Set Crop Area L:" << newArea.left << " R:" << newArea.right
42  << " T:" << newArea.top << " B:" << newArea.bottom;
43 
44  if (m_ImageSource.IsNotNull())
45  {
46  // if area is empty, remove region
47  if ((newArea.bottom == 0) && (newArea.top == 0) &&
48  (newArea.left == 0) && (newArea.right == 0))
49  {
50  m_ImageSource->RemoveRegionOfInterest();
51  }
52  else
53  {
54  m_ImageSource->SetCropping(newArea);
55  }
56  }
57  else
58  {
59  MITK_WARN << "Cannot set crop are, source is not initialized!";
60  }
61 }
62 
64 {
65  m_Device->DepthChanged(depth);
66 }
67 
69 {
70  m_Device->ProbeChanged(probename);
71 }
72 
74 {
75  // just return the crop area set at the image source
76  return m_ImageSource->GetCropping();
77 }
78 
79 std::vector<mitk::USProbe::Pointer> mitk::USVideoDeviceCustomControls::GetProbes()
80 {
81  mitk::USVideoDevice::Pointer device = dynamic_cast<mitk::USVideoDevice*>(m_Device.GetPointer());
82  return device->GetAllProbes();
83 }
84 
85 std::vector<int> mitk::USVideoDeviceCustomControls::GetDepthsForProbe(std::string name)
86 {
87  mitk::USVideoDevice::Pointer device = dynamic_cast<mitk::USVideoDevice*>(m_Device.GetPointer());
88  mitk::USProbe::Pointer probe = device->GetProbeByName(name);
89  std::map<int, mitk::Vector3D> depthsAndSpacings = probe->GetDepthsAndSpacing();
90  std::vector<int> depths;
91  for (std::map<int, mitk::Vector3D>::iterator it = depthsAndSpacings.begin(); it != depthsAndSpacings.end(); it++)
92  {
93  depths.push_back((it->first));
94  }
95  return depths;
96 }
Superclass for all ultrasound device control interfaces. Defines an interface for activating and deac...
itk::SmartPointer< Self > Pointer
void SetCropArea(USImageVideoSource::USImageCropping newArea)
Sets the area that will be cropped from the US image. Set [0,0,0,0] to disable it, which is also default.
#define MITK_INFO
Definition: mitkLogMacros.h:22
Defines a region of interest by distances to the four image borders.
void SetNewDepth(double depth)
Sets new depth value.
DataCollection - Class to facilitate loading/accessing structured data.
std::vector< mitk::USProbe::Pointer > GetProbes()
Get all the probes for the current device.
std::vector< int > GetDepthsForProbe(std::string name)
Get the scanning dephts of the given probe.
This class can be pointed to a video file or a videodevice and delivers USImages. ...
mitk::USImageVideoSource::USImageCropping GetCropArea()
#define MITK_WARN
Definition: mitkLogMacros.h:23
virtual void SetIsActive(bool isActive) override
USVideoDeviceCustomControls(itk::SmartPointer< USVideoDevice > device)
A mitk::USVideoDevice is the common class for video only devices. They capture video input either fro...