cisst-saw
Loading...
Searching...
No Matches
nmrPython.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* ex: set filetype=cpp softtabstop=4 shiftwidth=4 tabstop=4 cindent expandtab: */
3
4/*
5
6 Author(s): Anton Deguet
7 Created on: 2010-07-12
8
9 (C) Copyright 2010-2016 Johns Hopkins University (JHU), All Rights Reserved.
10
11--- begin cisst license - do not edit ---
12
13This software is provided "as is" under an open source license, with
14no warranty. The complete license can be found in license.txt and
15http://www.cisst.org/cisst/license.txt.
16
17--- end cisst license ---
18
19*/
20
21
26#pragma once
27
28#ifndef _nmrPython_h
29#define _ntmPython_h
30
33
35
36#if CISST_HAS_CISSTNETLIB
40
41// Following is declared in cisstNumerical.i
42std::pair<vctFrm3, double> nmrRegistrationRigid(const vctDynamicMatrix<double> &dataSet1, const vctDynamicMatrix<double> &dataSet2)
43{
44 if ((dataSet1.cols() != 3) || (dataSet2.cols() != 3))
45 cmnThrow(std::runtime_error("nmrRegistrationRigid: column size must be 3"));
46 if (dataSet1.rows() != dataSet2.rows())
47 cmnThrow(std::runtime_error("nmrRegistrationRigid: number of data points (row sizes) must be equal"));
48 const vct3 *ptr1 = reinterpret_cast<const vct3 *>(dataSet1.Pointer());
49 vctDynamicConstVectorRef<vct3> d1(dataSet1.rows(), ptr1, 1);
50 const vct3 *ptr2 = reinterpret_cast<const vct3 *>(dataSet2.Pointer());
51 vctDynamicConstVectorRef<vct3> d2(dataSet2.rows(), ptr2, 1);
52 vctFrm3 transform;
53 double fre;
54 if (!nmrRegistrationRigid(d1, d2, transform, &fre))
55 cmnThrow(std::runtime_error("nmrRegistrationRigid: failed to compute registration"));
56 return std::pair<vctFrm3, double>(transform, fre);
57}
58
59#endif
60
61#endif // _nmrPython_h
Dynamic vector referencing existing memory (const).
Definition vctDynamicConstVectorRef.h:79
Definition vctForwardDeclarations.h:157
Header files from cisstCommon required to compile the SWIG generated Python wrappers.
void cmnThrow(const _exceptionType &except, cmnLogLevel lod=CMN_LOG_LEVEL_INIT_ERROR)
Definition cmnThrow.h:76
Declaration of nmrPInverse.
bool CISST_EXPORT nmrRegistrationRigid(vctDynamicConstVectorBase< _vectorOwnerType, vct3 > &dataSet1, vctDynamicConstVectorBase< _vectorOwnerType, vct3 > &dataSet2, vctFrm3 &transform, double *fre=0)
Declaration of nmrSVD.
vctFixedSizeVector< double, 3 > vct3
Definition vctFixedSizeVectorTypes.h:46
Header files from cisstVector required to compile the SWIG generated Python wrappers.
vctFrameBase< vctRot3 > vctFrm3
Definition vctTransformationTypes.h:137