NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxDoublePropertyTemporalCalibration.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
12 #include "cxTrackingService.h"
13 
14 namespace cx
15 {
16 
18  mTrackingService(trackingService)
19 {
20  connect(mTrackingService.get(), &TrackingService::activeToolChanged, this, &DoublePropertyTimeCalibration::activeToolChanged);
21  connect(mTrackingService.get(), &TrackingService::stateChanged, this, &DoublePropertyTimeCalibration::activeToolChanged);
22  this->activeToolChanged();
23 }
24 
25 void DoublePropertyTimeCalibration::activeToolChanged()
26 {
27  // ignore tool changes to something non-probeish.
28  // This gives the user a chance to use the widget without having to show the probe.
29  ToolPtr newTool = mTrackingService->getFirstProbe();
30  if (!newTool || !newTool->getProbe())
31  return;
32 
33  if (mTool)
34  disconnect(mTool->getProbe().get(), &Probe::sectorChanged, this, &DoublePropertyTimeCalibration::changed);
35 
36  mTool = newTool;
37 
38  if (mTool)
39  connect(mTool->getProbe().get(), &Probe::sectorChanged, this, &DoublePropertyTimeCalibration::changed);
40 
41  emit changed();
42 }
43 
45 {
46  return DoublePropertyBasePtr(new DoublePropertyTimeCalibration(trackingService));
47 }
48 
50 {
51  if (!mTool || !mTool->getProbe())
52  return 0;
53  return mTool->getProbe()->getProbeDefinition().getTemporalCalibration();
54 }
55 
57 {
58  return "Set a temporal shift to add to input probe frames (the frames will be stored with this shift applied).\n"
59  "Changes done here will NOT be saved.";
60 }
61 
63 {
64  if (!mTool)
65  return 0;
66  mTool->getProbe()->setTemporalCalibration(val);
67  return true;
68 }
69 
71 {
72  return DoubleRange(-50000,50000,1);
73 }
74 
75 }
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cx::DoublePropertyTimeCalibration::setValue
virtual bool setValue(double val)
set the data value.
Definition: cxDoublePropertyTemporalCalibration.cpp:62
cx::DoublePropertyTimeCalibration::New
static DoublePropertyBasePtr New(TrackingServicePtr trackingService)
Definition: cxDoublePropertyTemporalCalibration.cpp:44
cx::DoublePropertyTimeCalibration::getValueRange
DoubleRange getValueRange() const
Definition: cxDoublePropertyTemporalCalibration.cpp:70
cx::Probe::sectorChanged
void sectorChanged()
< Return a ProbeSectorPtr for the given uid. Use 'active' to get the default.
cx::DoublePropertyTimeCalibration::getValue
virtual double getValue() const
get the data value.
Definition: cxDoublePropertyTemporalCalibration.cpp:49
cx::TrackingServicePtr
boost::shared_ptr< class TrackingService > TrackingServicePtr
Definition: cxToolFilterWidget.h:27
cx::TrackingService::stateChanged
void stateChanged()
cx::TrackingService::activeToolChanged
void activeToolChanged(const QString &uId)
cx::DoublePropertyTimeCalibration::getHelp
virtual QString getHelp() const
Definition: cxDoublePropertyTemporalCalibration.cpp:56
cx::ToolPtr
boost::shared_ptr< class Tool > ToolPtr
Definition: cxVideoConnectionWidget.h:43
cx::DoublePropertyTimeCalibration::DoublePropertyTimeCalibration
DoublePropertyTimeCalibration(TrackingServicePtr trackingService)
Definition: cxDoublePropertyTemporalCalibration.cpp:17
cx::DoublePropertyBasePtr
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
Definition: cxIGTLinkStreamerService.h:21
cx::DoubleRange
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32
cxDoublePropertyTemporalCalibration.h
cxTrackingService.h