Skip to content

Commit a886a90

Browse files
committed
Merge branch 'master' into calcTMP
2 parents e612005 + d85c5d8 commit a886a90

File tree

114 files changed

+5179
-442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+5179
-442
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
*.swp
77
*.vcxproj*
88
*DS_Store
9+
src/Documentation/*/*/*.aux
10+
src/Documentation/*/*/*.blg
11+
src/Documentation/*/*/*.bbl
12+
src/Documentation/*/*/*.log
13+
src/Documentation/*/*/*.out
14+
src/Documentation/*/*/*.toc
915
bin*/*/*
1016
bin64/*
1117
doc/*

Superbuild/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,12 @@
2424
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2525
# DEALINGS IN THE SOFTWARE.
2626

27-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9 FATAL_ERROR)
27+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
2828
#CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR)
29-
#CMAKE_POLICY(SET CMP0054 NEW)
29+
30+
IF(CMAKE_VERSION VERSION_EQUAL 3.1 OR CMAKE_VERSION VERSION_GREATER 3.1)
31+
CMAKE_POLICY(SET CMP0054 NEW)
32+
ENDIF()
3033

3134
PROJECT(Superbuild)
3235

Superbuild/LibPNGExternal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# DEALINGS IN THE SOFTWARE.
2626

2727
SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
28-
SET(libpng_GIT_TAG "origin/seg3d_external_test")
28+
SET(libpng_GIT_TAG "origin/master")
2929
SET(libpng_DEPENDENCIES "Zlib_external")
3030

3131
# If CMake ever allows overriding the checkout command or adding flags,

Superbuild/SQLiteExternal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# DEALINGS IN THE SOFTWARE.
2626

2727
SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
28-
SET(sqlite_GIT_TAG "origin/seg3d_external_test")
28+
SET(sqlite_GIT_TAG "origin/master")
2929

3030
# If CMake ever allows overriding the checkout command or adding flags,
3131
# git checkout -q will silence message about detached head (harmless).

Superbuild/Superbuild.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,6 @@ SET(SCIRUN_CACHE_ARGS
165165
"-DCMAKE_VERBOSE_MAKEFILE:BOOL=${CMAKE_VERBOSE_MAKEFILE}"
166166
"-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}"
167167
"-DSCIRUN_BINARY_DIR:PATH=${SCIRUN_BINARY_DIR}"
168-
"-DBUILD_LARGE_VOLUME_TOOLS:BOOL=${BUILD_LARGE_VOLUME_TOOLS}"
169-
"-DBUILD_MOSAIC_TOOLS:BOOL=${BUILD_MOSAIC_TOOLS}"
170168
"-DSCIRUN_BITS:STRING=${SCIRUN_BITS}"
171169
"-DBUILD_TESTING:BOOL=${BUILD_TESTING}"
172170
"-DBUILD_DOCUMENTATION:BOOL=${BUILD_DOCUMENTATION}"

Superbuild/TeemExternal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# DEALINGS IN THE SOFTWARE.
2626

2727
SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
28-
SET(teem_GIT_TAG "origin/seg3d_external_test")
28+
SET(teem_GIT_TAG "origin/master")
2929
SET(teem_DEPENDENCIES "Zlib_external;LibPNG_external")
3030

3131
# If CMake ever allows overriding the checkout command or adding flags,

Superbuild/ZlibExternal.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# DEALINGS IN THE SOFTWARE.
2626

2727
SET_PROPERTY(DIRECTORY PROPERTY "EP_BASE" ${ep_base})
28-
SET(zlib_GIT_TAG "origin/seg3d_external_test")
28+
SET(zlib_GIT_TAG "origin/master")
2929

3030
# If CMake ever allows overriding the checkout command or adding flags,
3131
# git checkout -q will silence message about detached head (harmless).

src/CMakeLists.txt

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,19 @@
2828
IF(UNIX)
2929
# temporary - needed to make Travis CI build work
3030
# TODO: revisit and delete when CMake 2.8.11 or greater is available
31+
# or switch to another CI tool
3132
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)
3233
ELSE()
3334
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11 FATAL_ERROR)
34-
ENDIF(UNIX)
35+
ENDIF()
36+
37+
IF(CMAKE_VERSION VERSION_GREATER 3.0)
38+
# TODO: when support for versions older than 2.8.12 is dropped,
39+
# enable new policy and get rid of version check
40+
#
41+
# see https://cmake.org/cmake/help/v3.0/policy/CMP0042.html
42+
CMAKE_POLICY(SET CMP0042 OLD)
43+
ENDIF()
3544

3645
PROJECT(SCIRun)
3746

@@ -303,6 +312,16 @@ IF(APPLE)
303312

304313
SET(MACDEPLOYQT_OUTPUT_LEVEL 0 CACHE STRING "Set macdeployqt output level (0-3)")
305314
MARK_AS_ADVANCED(MACDEPLOYQT_OUTPUT_LEVEL)
315+
316+
FIND_PROGRAM(SED
317+
NAMES sed
318+
)
319+
MARK_AS_ADVANCED(SED)
320+
321+
FIND_PROGRAM(AWK
322+
NAMES awk
323+
)
324+
MARK_AS_ADVANCED(AWK)
306325
ENDIF()
307326

308327

@@ -386,7 +405,8 @@ MESSAGE(STATUS "Configuring CPMs")
386405
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
387406

388407
# CPM Setup.
389-
set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/Externals/cpm-packages" CACHE TYPE STRING)
408+
#set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/Externals/cpm-packages" CACHE TYPE STRING)
409+
set(CPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/cpm-packages" CACHE TYPE STRING)
390410
find_package(Git)
391411
if(NOT GIT_FOUND)
392412
message(FATAL_ERROR "CPM requires Git.")

src/Core/Algorithms/Base/AlgorithmParameterList.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include <Core/Utils/ProgressReporter.h>
4646
#include <Core/Utils/StringUtil.h>
4747
#include <Core/Thread/Mutex.h>
48+
#include <Core/Algorithms/Base/AlgorithmInterfaces.h>
4849
#include <Core/Algorithms/Base/share.h>
4950

5051
namespace SCIRun {
@@ -56,8 +57,8 @@ namespace Algorithms {
5657
{
5758
public:
5859
AlgorithmParameterList();
59-
bool set(const AlgorithmParameterName& key, const AlgorithmParameter::Value& value);
60-
const AlgorithmParameter& get(const AlgorithmParameterName& key) const;
60+
bool set(const AlgorithmParameterName& key, const AlgorithmParameter::Value& value) override;
61+
const AlgorithmParameter& get(const AlgorithmParameterName& key) const override;
6162

6263
bool set_option(const AlgorithmParameterName& key, const std::string& value);
6364
bool get_option(const AlgorithmParameterName& key, std::string& value) const;
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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+
#include <Core/Algorithms/Math/SortMatrixAlgo.h>
30+
#include <Core/Datatypes/MatrixTypeConversions.h>
31+
#include <Core/Math/MiscMath.h>
32+
33+
using namespace SCIRun;
34+
using namespace SCIRun::Core::Datatypes;
35+
using namespace SCIRun::Core::Algorithms;
36+
using namespace SCIRun::Core::Algorithms::Math;
37+
38+
SortMatrixAlgo::SortMatrixAlgo()
39+
{
40+
//set parameter defaults for UI
41+
addParameter(Variables::Method, 0);
42+
}
43+
44+
45+
AlgorithmOutput SortMatrixAlgo::run_generic(const AlgorithmInput& input) const
46+
{
47+
auto input_matrix = input.get<Matrix>(Variables::InputMatrix);
48+
AlgorithmOutput output;
49+
50+
//sparse support not fully implemented yet.
51+
if (!matrix_is::dense(input_matrix))
52+
{
53+
//TODO implement something with sparse
54+
error("SortMatrix: Currently only works with dense matrices");
55+
output[Variables::OutputMatrix] = 0;
56+
return output;
57+
}
58+
auto mat = matrix_cast::as_dense (input_matrix);
59+
DenseMatrixHandle return_matrix;
60+
61+
//pull parameter from UI
62+
auto method = get(Variables::Method).toInt();
63+
64+
Sort(mat,return_matrix,method);
65+
output[Variables::OutputMatrix] = return_matrix;
66+
return output;
67+
}
68+
69+
70+
bool
71+
SortMatrixAlgo::Sort(DenseMatrixHandle input, DenseMatrixHandle& output,int method) const
72+
{
73+
if (!input)
74+
{
75+
error("SortAscending: no input matrix found");
76+
return false;
77+
}
78+
//get size of original matrix
79+
size_type nrows = input->nrows();
80+
size_type ncols = input->ncols();
81+
//copy original matrix for processing
82+
output.reset(new DenseMatrix(*input));
83+
//pointer to matrix data
84+
double *data = output->data();
85+
86+
if (!output)
87+
{
88+
error("ApplyRowOperation: could not create output matrix");
89+
return false;
90+
}
91+
92+
size_type n = nrows*ncols;
93+
//call the sorting functions
94+
Quicksort(data,0,n-1);
95+
96+
if (method==1)
97+
{
98+
//if set to descending, reverse the order.
99+
output.reset(new DenseMatrix(output -> reverse()));
100+
}
101+
return true;
102+
}
103+
104+
bool
105+
SortMatrixAlgo::Quicksort(double* input, index_type lo, index_type hi) const
106+
{
107+
//splits matrix based on Partition function
108+
index_type ind;
109+
if (lo<hi)
110+
{
111+
ind=Partition(input,lo,hi);
112+
Quicksort(input,lo,ind-1);
113+
Quicksort(input,ind+1,hi);
114+
}
115+
return true;
116+
}
117+
118+
index_type
119+
SortMatrixAlgo::Partition(double* input, index_type lo, index_type hi) const
120+
{
121+
// places the last entry in its proper place in relation to the other
122+
// entries, ie, smaller values before and larger values after.
123+
index_type ind=lo;
124+
125+
double pivot = input[hi];
126+
double tmp;
127+
for (index_type k=lo;k<hi;k++)
128+
{
129+
if (input[k]<=pivot)
130+
{
131+
tmp=input[ind];
132+
input[ind]=input[k];
133+
input[k]=tmp;
134+
ind+=1;
135+
}
136+
}
137+
tmp=input[ind];
138+
input[ind]=input[hi];
139+
input[hi]=tmp;
140+
return ind;
141+
}
142+
143+
144+
145+
146+

0 commit comments

Comments
 (0)