Skip to content

Commit f66613a

Browse files
authored
Merge pull request #1645 from jessdtate/conditional
new Boolean comparison module
2 parents 69e1734 + 129f59c commit f66613a

20 files changed

+3178
-1
lines changed

src/Core/Algorithms/Math/BooleanCompareAlgo.cc

Lines changed: 505 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2009 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef CORE_ALGORITHMS_MATH_BooleanCompareALGO_H
30+
#define CORE_ALGORITHMS_MATH_BooleanCompareALGO_H
31+
32+
#include <Core/Datatypes/Matrix.h>
33+
#include <Core/Datatypes/DenseMatrix.h>
34+
#include <Core/Datatypes/DenseColumnMatrix.h>
35+
36+
37+
#include <string>
38+
#include <sstream>
39+
#include <vector>
40+
#include <algorithm>
41+
42+
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
43+
#include <Core/Algorithms/Base/AlgorithmBase.h>
44+
#include <Core/Algorithms/Math/share.h>
45+
46+
namespace SCIRun {
47+
namespace Core {
48+
namespace Algorithms {
49+
namespace Math {
50+
51+
ALGORITHM_PARAMETER_DECL(Value_Option_1);
52+
ALGORITHM_PARAMETER_DECL(Value_Option_2);
53+
ALGORITHM_PARAMETER_DECL(Then_Option);
54+
ALGORITHM_PARAMETER_DECL(Else_Option);
55+
ALGORITHM_PARAMETER_DECL(Comparison_Option);
56+
57+
class SCISHARE BooleanCompareAlgo : public AlgorithmBase
58+
{
59+
60+
public:
61+
BooleanCompareAlgo();
62+
AlgorithmOutput run(const AlgorithmInput& input) const;
63+
bool runImpl(Datatypes::DenseMatrixHandle matrixa, Datatypes::DenseMatrixHandle matrixb, std::string valoptA, std::string valoptB, std::string& cond_statement, int& cond_state) const;
64+
bool runImpl(Datatypes::DenseMatrixHandle matrixa, std::string valoptA, std::string& cond_statement, int& cond_state) const;
65+
bool return_check(int& cond_state, Datatypes::DenseMatrixHandle& cond_matrix, Datatypes::MatrixHandle& out_matrix, std::string then_result, std::string else_result, Datatypes::MatrixHandle matrixa, Datatypes::MatrixHandle matrixb, Datatypes::MatrixHandle possout) const;
66+
bool return_value(Datatypes::MatrixHandle& out_matrix, std::string result_statement, Datatypes::MatrixHandle first, Datatypes::MatrixHandle second, Datatypes::MatrixHandle possout) const;
67+
bool CompareMatrix(Datatypes::DenseMatrixHandle mata, Datatypes::DenseMatrixHandle matb, std::string cond_statement, int& cond_state) const;
68+
bool CompareMatrix(Datatypes::DenseMatrixHandle mata, int& cond_state) const;
69+
double ComputeNorm(Datatypes::DenseMatrixHandle mat) const;
70+
};
71+
72+
}}}}// end SCIRun namespace
73+
#endif

src/Core/Algorithms/Math/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ SET(Algorithms_Math_SRCS
4545
ComputePCA.cc
4646
CollectMatrices/CollectMatricesAlgorithm.cc
4747
ReportMatrixSliceMeasureAlgo.cc
48+
BooleanCompareAlgo.cc
4849
)
4950

5051
SET(Algorithms_Math_HEADERS
@@ -67,6 +68,7 @@ SET(Algorithms_Math_HEADERS
6768
ComputePCA.h
6869
CollectMatrices/CollectMatricesAlgorithm.h
6970
ReportMatrixSliceMeasureAlgo.h
71+
BooleanCompareAlgo.h
7072
)
7173

7274
SCIRUN_ADD_LIBRARY(Algorithms_Math

src/Documentation/Manuals/SCIRun5ModuleGeneration/SCIRun5ModuleGeneration.tex

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,28 @@ \section{Common Build Errors}
16481648
'Interface/Modules/Field/ui_ConvertMeshToPointCloudDialog.h' file not found
16491649
\end{verbatim}
16501650
In this instance, the path to the header is misspelled. Check for the correct path and filename. Make sure the file you want to include exists. If the code was converted from SCIRun4, some of the dependent header files are renamed, combined with other files, or deprecated.
1651-
1651+
\item
1652+
\begin{verbatim}
1653+
/Users/jess/software/SCIRun_mine/bin/SCIRun/Core/Algorithms/Factory/AlgorithmFactoryImpl_Generated.cc:4:10: error: empty filename
1654+
#include <>
1655+
^
1656+
/Users/jess/software/SCIRun_mine/bin/SCIRun/Core/Algorithms/Factory/AlgorithmFactoryImpl_Generated.cc:21:43: error: expected namespace name
1657+
using namespace SCIRun::Core::Algorithms::;
1658+
^
1659+
/Users/jess/software/SCIRun_mine/bin/SCIRun/Core/Algorithms/Factory/AlgorithmFactoryImpl_Generated.cc:39:3: error: expected expression
1660+
ADD_MODULE_ALGORITHM_GENERATED(, );
1661+
\end{verbatim}
1662+
This is a result of something wrong with the module configuration file. Check the spelling and syntax of the new file. Specifically, check the quotation characters used, as they may be different (for instance on mac TextEdit). This may also be caused if the Algorithm and other files have not been added to the `CMakeList.txt' file.
1663+
\item
1664+
\begin{verbatim}
1665+
/Users/jess/software/SCIRun_mine/src/Interface/Modules/Base/ModuleDialogGeneric.h:71:5: warning: 'metaObject' overrides a member function but is not marked
1666+
'override' [-Winconsistent-missing-override]
1667+
Q_OBJECT
1668+
^
1669+
/usr/local/Cellar/qt/4.8.7_3/lib/QtCore.framework/Headers/qobjectdefs.h:162:32: note: expanded from macro 'Q_OBJECT'
1670+
virtual const QMetaObject *metaObject() const; \
1671+
\end{verbatim}
1672+
Errors that involve qt and qt objects deal with the gui code. Make sure that the gui name is spelled correctly. Also make sure that the Qobject name is set properly.
16521673
\end{itemize}
16531674

16541675

0 commit comments

Comments
 (0)