cctw  0.2.1
cctwqtsetuptransformdialog.cpp
Go to the documentation of this file.
1 #define _USE_MATH_DEFINES
2 #include <cmath>
4 #include "ui_cctwqtsetuptransformdialog.h"
5 #include "cctwqtmainwindow.h"
6 #include "cctwapplication.h"
7 
9  QDialog(parent),
11  m_Application(app)
12 {
13  ui->setupUi(this);
14 
15  setAttribute(Qt::WA_DeleteOnClose);
16 
18 }
19 
21 {
22  delete ui;
23 }
24 
26 {
28 
29  QDialog::accept();
30 }
31 
33 {
36 
37  ui->m_PixelDimensionX->setValue(input->dimensions().x());
38  ui->m_PixelDimensionY->setValue(input->dimensions().y());
39 
40  ui->m_PixelSize->setValue(parms->pixelSize());
41  ui->m_Wavelength->setValue(parms->wavelength());
42  ui->m_Distance->setValue(parms->distance());
43 
44  CctwUnitCell cell = parms->unitCell();
45 
46  ui->m_UnitCellA->setValue(cell.a());
47  ui->m_UnitCellB->setValue(cell.b());
48  ui->m_UnitCellC->setValue(cell.c());
49  ui->m_UnitCellAlpha->setValue(rad2deg(cell.alpha()));
50  ui->m_UnitCellBeta->setValue(rad2deg(cell.beta()));
51  ui->m_UnitCellGamma->setValue(rad2deg(cell.gamma()));
52 
53  CctwDoubleMatrix3x3 ubMat = parms->ubMat();
54 
55  ui->m_UBMat00->setValue(ubMat(0,0));
56  ui->m_UBMat01->setValue(ubMat(0,1));
57  ui->m_UBMat02->setValue(ubMat(0,2));
58  ui->m_UBMat10->setValue(ubMat(1,0));
59  ui->m_UBMat11->setValue(ubMat(1,1));
60  ui->m_UBMat12->setValue(ubMat(1,2));
61  ui->m_UBMat20->setValue(ubMat(2,0));
62  ui->m_UBMat21->setValue(ubMat(2,1));
63  ui->m_UBMat22->setValue(ubMat(2,2));
64 
65  CctwDoubleMatrix3x3 oMat = parms->oMat();
66 
67  ui->m_OMat00->setValue(oMat(0,0));
68  ui->m_OMat01->setValue(oMat(0,1));
69  ui->m_OMat02->setValue(oMat(0,2));
70  ui->m_OMat10->setValue(oMat(1,0));
71  ui->m_OMat11->setValue(oMat(1,1));
72  ui->m_OMat12->setValue(oMat(1,2));
73  ui->m_OMat20->setValue(oMat(2,0));
74  ui->m_OMat21->setValue(oMat(2,1));
75  ui->m_OMat22->setValue(oMat(2,2));
76 
77  CctwDoubleVector3D oVec = parms->oVec();
78 
79  ui->m_OVec0->setValue(oVec(0));
80  ui->m_OVec1->setValue(oVec(1));
81  ui->m_OVec2->setValue(oVec(2));
82 
83  ui->m_Det0x->setValue(parms->det0x());
84  ui->m_Det0y->setValue(parms->det0y());
85 
86  CctwDoubleVector3D xt = parms->xTrans();
87 
88  ui->m_XTransX->setValue(xt.x());
89  ui->m_XTransY->setValue(xt.y());
90  ui->m_XTransZ->setValue(xt.z());
91 
92  ui->m_OrientErrorDetPitch->setValue(rad2deg(parms->orientErrorDetPitch()));
93  ui->m_OrientErrorDetRoll->setValue(rad2deg(parms->orientErrorDetRoll()));
94  ui->m_OrientErrorDetYaw->setValue(rad2deg(parms->orientErrorDetYaw()));
95  ui->m_OrientErrorGonPitch->setValue(rad2deg(parms->orientErrorGonPitch()));
96 
97  ui->m_TwoTheta->setText(parms->get_TwoTheta());
98  ui->m_TwoThetaCorrection->setValue(rad2deg(parms->get_TwoThetaCorrection()));
99  ui->m_TwoThetaNom->setValue(rad2deg(parms->get_TwoThetaNom()));
100  ui->m_TwoThetaStep->setValue(rad2deg(parms->get_TwoThetaStep()));
101 
102  ui->m_Omega->setText(parms->get_Omega());
103  ui->m_OmegaCorrection->setValue(rad2deg(parms->get_OmegaCorrection()));
104  ui->m_OmegaNom->setValue(rad2deg(parms->get_OmegaNom()));
105  ui->m_OmegaStep->setValue(rad2deg(parms->get_OmegaStep()));
106 
107  ui->m_Chi->setText(parms->get_Chi());
108  ui->m_ChiCorrection->setValue(rad2deg(parms->get_ChiCorrection()));
109  ui->m_ChiNom->setValue(rad2deg(parms->get_ChiNom()));
110  ui->m_ChiStep->setValue(rad2deg(parms->get_ChiStep()));
111 
112  ui->m_Phi->setText(parms->get_Phi());
113  ui->m_PhiCorrection->setValue(rad2deg(parms->get_PhiCorrection()));
114  ui->m_PhiNom->setValue(rad2deg(parms->get_PhiNom()));
115  ui->m_PhiStep->setValue(rad2deg(parms->get_PhiStep()));
116 
117  CctwDoubleVector3D gridOrigin = parms->gridOrigin();
118 
119  ui->m_GridOriginX->setValue(gridOrigin.x());
120  ui->m_GridOriginY->setValue(gridOrigin.y());
121  ui->m_GridOriginZ->setValue(gridOrigin.z());
122 
123  CctwDoubleMatrix3x3 gridBasis = parms->gridBasis();
124 
125  ui->m_GridBasis00->setValue(gridBasis(0,0));
126  ui->m_GridBasis01->setValue(gridBasis(0,1));
127  ui->m_GridBasis02->setValue(gridBasis(0,2));
128  ui->m_GridBasis10->setValue(gridBasis(1,0));
129  ui->m_GridBasis11->setValue(gridBasis(1,1));
130  ui->m_GridBasis12->setValue(gridBasis(1,2));
131  ui->m_GridBasis20->setValue(gridBasis(2,0));
132  ui->m_GridBasis21->setValue(gridBasis(2,1));
133  ui->m_GridBasis22->setValue(gridBasis(2,2));
134 
135  CctwDoubleVector3D gridDim = parms->gridDim();
136 
137  ui->m_GridDimX->setValue(gridDim.x());
138  ui->m_GridDimY->setValue(gridDim.y());
139  ui->m_GridDimZ->setValue(gridDim.z());
140 
141  CctwDoubleVector3D gridOffset = parms->gridOffset();
142 
143  ui->m_GridOffsetX->setValue(gridOffset.x());
144  ui->m_GridOffsetY->setValue(gridOffset.y());
145  ui->m_GridOffsetZ->setValue(gridOffset.z());
146 }
147 
149 {
151 
152  parms->setPixelSize(ui->m_PixelSize->value());
153  parms->setWavelength(ui->m_Wavelength->value());
154  parms->setDistance(ui->m_Distance->value());
155 
156  CctwUnitCell cell;
157 
158  cell.a() = ui->m_UnitCellA->value();
159  cell.b() = ui->m_UnitCellB->value();
160  cell.c() = ui->m_UnitCellC->value();
161  cell.alpha() = deg2rad(ui->m_UnitCellAlpha->value());
162  cell.beta() = deg2rad(ui->m_UnitCellBeta->value());
163  cell.gamma() = deg2rad(ui->m_UnitCellGamma->value());
164 
165  parms->setUnitCell(cell);
166 
167  CctwDoubleMatrix3x3 ubMat;
168 
169  ubMat(0,0) = ui->m_UBMat00->value();
170  ubMat(0,1) = ui->m_UBMat01->value();
171  ubMat(0,2) = ui->m_UBMat02->value();
172  ubMat(1,0) = ui->m_UBMat10->value();
173  ubMat(1,1) = ui->m_UBMat11->value();
174  ubMat(1,2) = ui->m_UBMat12->value();
175  ubMat(2,0) = ui->m_UBMat20->value();
176  ubMat(2,1) = ui->m_UBMat21->value();
177  ubMat(2,2) = ui->m_UBMat22->value();
178 
179  parms->setUBMat(ubMat);
180 
181  CctwDoubleMatrix3x3 oMat;
182 
183  oMat(0,0) = ui->m_OMat00->value();
184  oMat(0,1) = ui->m_OMat01->value();
185  oMat(0,2) = ui->m_OMat02->value();
186  oMat(1,0) = ui->m_OMat10->value();
187  oMat(1,1) = ui->m_OMat11->value();
188  oMat(1,2) = ui->m_OMat12->value();
189  oMat(2,0) = ui->m_OMat20->value();
190  oMat(2,1) = ui->m_OMat21->value();
191  oMat(2,2) = ui->m_OMat22->value();
192 
193  parms->setOMat(oMat);
194 
195  CctwDoubleVector3D oVec;
196 
197  oVec(0) = ui->m_OVec0->value();
198  oVec(1) = ui->m_OVec1->value();
199  oVec(2) = ui->m_OVec2->value();
200 
201  parms->setOVec(oVec);
202 
203  parms->setDet0x(ui->m_Det0x->value());
204  parms->setDet0y(ui->m_Det0y->value());
205 
207 
208  xt.x() = ui->m_XTransX->value();
209  xt.y() = ui->m_XTransY->value();
210  xt.z() = ui->m_XTransZ->value();
211 
212  parms->setXTrans(xt);
213 
214  parms->setOrientErrorDetPitch(deg2rad(ui->m_OrientErrorDetPitch->value()));
215  parms->setOrientErrorDetRoll(deg2rad(ui->m_OrientErrorDetRoll->value()));
216  parms->setOrientErrorDetYaw(deg2rad(ui->m_OrientErrorDetYaw->value()));
217  parms->setOrientErrorGonPitch(deg2rad(ui->m_OrientErrorGonPitch->value()));
218 
219  parms->set_TwoThetaCorrection(deg2rad(ui->m_TwoThetaCorrection->value()));
220  parms->set_TwoThetaNom(deg2rad(ui->m_TwoThetaNom->value()));
221  parms->set_TwoThetaStep(deg2rad(ui->m_TwoThetaStep->value()));
222  parms->setTwoTheta(ui->m_TwoTheta->text());
223 
224  parms->set_OmegaCorrection(deg2rad(ui->m_OmegaCorrection->value()));
225  parms->set_OmegaNom(deg2rad(ui->m_OmegaNom->value()));
226  parms->set_OmegaStep(deg2rad(ui->m_OmegaStep->value()));
227  parms->setOmega(ui->m_Omega->text());
228 
229  parms->set_ChiCorrection(deg2rad(ui->m_ChiCorrection->value()));
230  parms->set_ChiNom(deg2rad(ui->m_ChiNom->value()));
231  parms->set_ChiStep(deg2rad(ui->m_ChiStep->value()));
232  parms->setChi(ui->m_Chi->text());
233 
234  parms->set_PhiCorrection(deg2rad(ui->m_PhiCorrection->value()));
235  parms->set_PhiNom(deg2rad(ui->m_PhiNom->value()));
236  parms->set_PhiStep(deg2rad(ui->m_PhiStep->value()));
237  parms->setPhi(ui->m_Phi->text());
238 
239  CctwDoubleVector3D gridOrigin;
240 
241  gridOrigin.x() = ui->m_GridOriginX->value();
242  gridOrigin.y() = ui->m_GridOriginY->value();
243  gridOrigin.z() = ui->m_GridOriginZ->value();
244 
245  parms->setGridOrigin(gridOrigin);
246 
247  CctwDoubleMatrix3x3 gridBasis;
248 
249  gridBasis(0,0) = ui->m_GridBasis00->value();
250  gridBasis(0,1) = ui->m_GridBasis01->value();
251  gridBasis(0,2) = ui->m_GridBasis02->value();
252  gridBasis(1,0) = ui->m_GridBasis10->value();
253  gridBasis(1,1) = ui->m_GridBasis11->value();
254  gridBasis(1,2) = ui->m_GridBasis12->value();
255  gridBasis(2,0) = ui->m_GridBasis20->value();
256  gridBasis(2,1) = ui->m_GridBasis21->value();
257  gridBasis(2,2) = ui->m_GridBasis22->value();
258 
259  parms->setGridBasis(gridBasis);
260 
261  CctwDoubleVector3D gridDim;
262 
263  gridDim.x() = ui->m_GridDimX->value();
264  gridDim.y() = ui->m_GridDimY->value();
265  gridDim.z() = ui->m_GridDimZ->value();
266 
267  parms->setGridDim(gridDim);
268 
269  CctwDoubleVector3D gridOffset;
270 
271  gridOffset.x() = ui->m_GridOffsetX->value();
272  gridOffset.y() = ui->m_GridOffsetY->value();
273  gridOffset.z() = ui->m_GridOffsetZ->value();
274 
275  parms->setGridOffset(gridOffset);
276 }
277 
279 {
280  return rad*180.0/M_PI;
281 }
282 
284 {
285  return deg*M_PI/180.0;
286 }
CctwChunkedData * m_InputData
CctwqtSetupTransformDialog(CctwApplication *app, CctwqtMainWindow *parent)
double beta() const
CctwCrystalCoordinateParameters * m_Parameters
double b() const
CctwIntVector3D dimensions
double a() const
double alpha() const
T x() const
Definition: cctwvector3d.h:17
Ui::CctwqtSetupTransformDialog * ui
T z() const
Definition: cctwvector3d.h:19
double gamma() const
double c() const
T y() const
Definition: cctwvector3d.h:18