CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxTransferFunction2DColorWidget.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 =========================================================================*/
11 
13 #include "cxDoubleWidgets.h"
14 #include "cxImageLUT2D.h"
15 #include "cxActiveData.h"
16 
17 namespace cx
18 {
19 
21  BaseWidget(parent, "transfer_function_2d_color_widget", "2D Color"),
22  mActiveData(activeData)
23 {
24  this->setToolTip("Set a 2D color transfer function");
25  QVBoxLayout* layout = new QVBoxLayout(this);
26 
30 
33 
37 
38  mTransferFunctionColorWidget->setSizePolicy(QSizePolicy::Expanding,
39  QSizePolicy::Fixed);
40  mTransferFunctionAlphaWidget->setSizePolicy(QSizePolicy::MinimumExpanding,
41  QSizePolicy::MinimumExpanding);
42 
43  layout->addWidget(mTransferFunctionAlphaWidget);
44 
45  layout->addWidget(mTransferFunctionColorWidget);
46 
47  QGridLayout* gridLayout = new QGridLayout;
48  layout->addLayout(gridLayout);
49  new SliderGroupWidget(this, mDataWindow, gridLayout, 0);
50  new SliderGroupWidget(this, mDataLevel, gridLayout, 1);
51 
52  this->setLayout(layout);
53  this->activeImageChangedSlot();
54 }
55 
57 {
59 }
60 
62 {
63  ImagePtr image = mActiveData->getDerivedActiveImage();
64 
65  ImageTFDataPtr tf;
66  if (image)
67  tf = image->getLookupTable2D();
68  else
69  image.reset();
70 
73 
74  mDataWindow->setImageTFData(tf, image);
75  mDataLevel->setImageTFData(tf, image);
76 }
77 
78 
79 }//end namespace cx
TransferFunction2DColorWidget(ActiveDataPtr activeData, QWidget *parent)
Composite widget for scalar data manipulation.
boost::shared_ptr< class Image > ImagePtr
Definition: cxDicomWidget.h:27
void setData(ImagePtr image, ImageTFDataPtr tfData)
DoublePropertyImageTFDataBasePtr mDataLevel
boost::shared_ptr< class ActiveData > ActiveDataPtr
Definition: cxColorWidget.h:21
DoublePropertyImageTFDataBasePtr mDataWindow
void transferFunctionsChanged()
TransferFunctionAlphaWidget * mTransferFunctionAlphaWidget
static ActiveImageProxyPtr New(ActiveDataPtr activeData)
void activeDataChanged(const QString &uId)
TransferFunctionColorWidget * mTransferFunctionColorWidget
void setReadOnly(bool readOnly)
Set class readonly: Disable mouse interaction.
void setData(ImagePtr image, ImageTFDataPtr tfData)
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
boost::shared_ptr< class ImageTFData > ImageTFDataPtr
Namespace for all CustusX production code.