CustusX  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 }
DoublePropertyTimeCalibration(TrackingServicePtr trackingService)
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
boost::shared_ptr< class TrackingService > TrackingServicePtr
virtual double getValue() const
get the data value.
Utility class for describing a bounded numeric range.
Definition: cxDoubleRange.h:32
static DoublePropertyBasePtr New(TrackingServicePtr trackingService)
void activeToolChanged(const QString &uId)
void sectorChanged()
< Return a ProbeSectorPtr for the given uid. Use &#39;active&#39; to get the default.
boost::shared_ptr< class DoublePropertyBase > DoublePropertyBasePtr
void changed()
emit when the underlying data value is changed: The user interface will be updated.
virtual bool setValue(double val)
set the data value.
Namespace for all CustusX production code.
boost::shared_ptr< class Tool > ToolPtr