Skip to content

Commit cc28726

Browse files
authored
Merge pull request #2211 from SCIInstitute/release_v6.5
Release v6.5 changes
2 parents 30d9233 + ad69d0f commit cc28726

38 files changed

+244
-98
lines changed

.github/workflows/Dockerfile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
# Based on old ubuntu to create more compatible binaries
22

33
# To build (e.g. for ShapeWorks 6.5):
4-
# docker build --progress=plain -t akenmorris/ubuntu-build-box-sw65 .
4+
# docker build --progress=plain -t akenmorris/ubuntu-build-box-focal-sw65 .
55
# To publish:
6-
# docker push akenmorris/ubuntu-build-box-sw65
6+
# docker push akenmorris/ubuntu-build-box-focal-sw65
77

8-
FROM ubuntu:bionic-20230308 AS env
8+
FROM ubuntu:focal-20240123 AS env
99
1010

1111
# Set environment variables
1212
ENV PATH=/opt/conda/bin:/opt/rh/devtoolset-9/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1313
ENV LDFLAGS=-L/opt/conda/lib
1414

15+
ARG DEBIAN_FRONTEND=noninteractive
16+
ENV TZ=Etc/UTC
17+
1518
# Update
1619
RUN apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get install build-essential software-properties-common -y && add-apt-repository ppa:ubuntu-toolchain-r/test -y && apt-get update -y
1720

.github/workflows/build-linux-debug.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ jobs:
4141
run: df -h
4242

4343
- name: Free some space
44-
run: cd /__t ; rm -rf CodeQL go
44+
run: cd /__t ; rm -rf CodeQL go PyPy Python Ruby
45+
46+
- name: Check usage
47+
run: cd /__t ; du -sh *
4548

4649
- name: Check space2
4750
run: df -h
@@ -61,35 +64,35 @@ jobs:
6164
shell: bash -l {0}
6265
run: .github/workflows/restore_caches.sh
6366

64-
- name: Check space2
67+
- name: Check space3
6568
run: df -h
6669

6770
- name: Conda Installs
6871
shell: bash -l {0}
6972
run: .github/workflows/gha_conda.sh
7073

71-
- name: Check space3
74+
- name: Check space4
7275
run: df -h
7376

7477
- name: Build Dependencies
7578
shell: bash -l {0}
7679
run: .github/workflows/gha_deps.sh
7780

78-
- name: Check space4
81+
- name: Check space5
7982
run: df -h
8083

8184
- name: cmake
8285
shell: bash -l {0}
8386
run: conda activate shapeworks && mkdir build && cd build && cmake -DCMAKE_CXX_FLAGS=-g -DITK_DIR=$HOME/install/lib/cmake/ITK-5.2 -DVTK_DIR=$HOME/install/lib/cmake/vtk-9.1 -DXLNT_DIR=$HOME/install -DLIBIGL_DIR=$HOME/install -DOpenVDB_DIR=$HOME/install/lib/cmake/OpenVDB -DGEOMETRYCENTRAL_DIR=$HOME/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBuild_Studio=ON -DJKQTCommonSharedLib_DIR=$HOME/install/lib/cmake/JKQTCommonSharedLib -DJKQTMathTextSharedLib_DIR=$HOME/install/lib/cmake/JKQTMathTextSharedLib -DJKQTPlotterSharedLib_DIR=$HOME/install/lib/cmake/JKQTPlotterSharedLib -DACVD_DIR=$HOME/install -DCMAKE_PREFIX_PATH=${CONDA_PREFIX} -DCMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/shapeworks-install -DUSE_ORIGIN_RPATH=ON ..
8487

85-
- name: Check space5
88+
- name: Check space6
8689
run: df -h
8790

8891
- name: make
8992
shell: bash -l {0}
9093
run: conda activate shapeworks && cd build && make -j2
9194

92-
- name: Check space6
95+
- name: Check space7
9396
run: df -h
9497

9598
- name: make install

.github/workflows/copy_artifact.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ if [[ "$PLATFORM" == "windows" ]]; then
2222
# https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst
2323
# https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst
2424
curl.exe --output windows_rsync.tar.gz http://www.sci.utah.edu/~amorris/windows_rsync.tar.gz
25+
26+
tar -xzvf windows_rsync.tar.gz
2527

2628
mv usr/bin/* "C:\Program Files\Git\usr\bin\\"
2729
echo "rsync installed on windows runner"

Applications/shapeworks/MeshCommands.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ bool WarpMesh::execute(const optparse::Values &options, SharedCommandData &share
14321432
try {
14331433
MeshWarper warper;
14341434
Mesh inputMesh(inputMeshFilename);
1435+
inputMesh.clean();
14351436
targetPointsFilenames.push_back(inputPointsFilename);
14361437
ParticleSystemEvaluation particlesystem(targetPointsFilenames);
14371438
Eigen::MatrixXd landmarks;

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.20)
66
SET(SHAPEWORKS_MAJOR_VERSION 6 CACHE INTERNAL "Major version number" FORCE)
77
SET(SHAPEWORKS_MINOR_VERSION 5 CACHE INTERNAL "Minor version number" FORCE)
88
SET(SHAPEWORKS_PATCH_VERSION 0 CACHE INTERNAL "Patch version number" FORCE)
9-
SET(SHAPEWORKS_VERSION_STRING "6.5.0-RC3")
9+
SET(SHAPEWORKS_VERSION_STRING "6.5.0-RC4")
1010
SET(SHAPEWORKS_VERSION "${SHAPEWORKS_MAJOR_VERSION}.${SHAPEWORKS_MINOR_VERSION}.${SHAPEWORKS_PATCH_VERSION}")
1111

1212
# First, check that files were checked out properly using git-lfs

Libs/Common/Logging.h

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <QString>
66
#include <functional>
7+
#include <iostream>
78

89
template <>
910
struct fmt::formatter<QString> {
@@ -15,6 +16,18 @@ struct fmt::formatter<QString> {
1516
}
1617
};
1718

19+
template <typename... Args>
20+
std::string safe_format(const std::string& fmt_str, const Args&... args) {
21+
std::string result;
22+
try {
23+
result = fmt::format(fmt_str, args...);
24+
} catch (const std::exception& e) {
25+
// Handle formatting errors here, example:
26+
std::cerr << "Error formatting string: " << fmt_str << " : " << e.what() << std::endl;
27+
}
28+
return result;
29+
}
30+
1831
namespace shapeworks {
1932

2033
/**
@@ -105,7 +118,7 @@ class Logging {
105118
void show_progress(double value, const std::string& message);
106119

107120
//! Log a debug message, use SW_DEBUG macro
108-
void log_debug(const std::string& message, const int line, const char* file, const char *function) const;
121+
void log_debug(const std::string& message, const int line, const char* file, const char* function) const;
109122

110123
//! Log a warning message, use SW_WARN macro
111124
void log_warning(const std::string& message, const int line, const char* file) const;
@@ -156,44 +169,44 @@ class Logging {
156169

157170
//! Log message macro
158171
#define SW_LOG(message, ...) \
159-
shapeworks::Logging::Instance().log_message(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__)
172+
shapeworks::Logging::Instance().log_message(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__);
160173

161174
//! Log warning macro
162175
#define SW_WARN(message, ...) \
163-
shapeworks::Logging::Instance().log_warning(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__)
176+
shapeworks::Logging::Instance().log_warning(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__)
164177

165178
//! Log error macro
166179
#define SW_ERROR(message, ...) \
167-
shapeworks::Logging::Instance().log_error(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__)
180+
shapeworks::Logging::Instance().log_error(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__)
168181

169182
//! Log debug macro
170183
#define SW_DEBUG(message, ...) \
171-
shapeworks::Logging::Instance().log_debug(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__, __FUNCTION__)
184+
shapeworks::Logging::Instance().log_debug(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__, __FUNCTION__)
172185

173186
//! Variable trace macro (e.g. output variable name = <variable value>)
174187
#define SW_TRACE(x) SW_DEBUG(#x " = {}", x);
175188

176189
//! Log show message macro
177190
#define SW_MESSAGE(message, ...) \
178-
shapeworks::Logging::Instance().show_message(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__)
191+
shapeworks::Logging::Instance().show_message(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__)
179192

180193
//! Don't write to log, but set status (e.g. in the Studio statusbar)
181194
#define SW_STATUS(message, ...) \
182-
shapeworks::Logging::Instance().show_status(fmt::format(message, ##__VA_ARGS__), __LINE__, __FILE__)
195+
shapeworks::Logging::Instance().show_status(safe_format(message, ##__VA_ARGS__), __LINE__, __FILE__)
183196

184197
#define SW_PROGRESS(value, message, ...) \
185-
shapeworks::Logging::Instance().show_progress(value, fmt::format(message, ##__VA_ARGS__));
198+
shapeworks::Logging::Instance().show_progress(value, safe_format(message, ##__VA_ARGS__));
186199

187200
//! Close session macro
188201
#define SW_CLOSE_LOG() shapeworks::Logging::Instance().close_log();
189202

190203
//! Log once macro, will only log the message once
191-
#define SW_LOG_ONCE(message, ...) \
192-
{ \
193-
static bool logged = false; \
194-
if (!logged) { \
204+
#define SW_LOG_ONCE(message, ...) \
205+
{ \
206+
static bool logged = false; \
207+
if (!logged) { \
195208
SW_LOG(message, ##__VA_ARGS__); \
196-
logged = true; \
197-
} \
198-
}
209+
logged = true; \
210+
} \
211+
}
199212
} // namespace shapeworks

Libs/Groom/Groom.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,11 @@ std::string Groom::get_output_filename(std::string input, DomainType domain_type
727727
// check for and handle name clashes, e.g. a/foo.vtk, b/foo.vtk (see #1387)
728728
auto base_name = name;
729729
int count = 2;
730-
while (used_names_.find(name) != used_names_.end()) {
731-
name = base_name + std::to_string(count++);
730+
while (used_names_.find(name + suffix) != used_names_.end()) {
731+
name = base_name + "_" + std::to_string(count++);
732732
}
733-
used_names_.insert(name);
734-
735733
auto output = name + suffix;
736-
734+
used_names_.insert(output);
737735
return output;
738736
}
739737

Libs/Mesh/MeshWarper.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <Logging.h>
12
#include <Mesh/Mesh.h>
23
#include <Mesh/MeshWarper.h>
34
#include <igl/biharmonic_coordinates.h>
@@ -11,8 +12,6 @@
1112
#include <vtkPolyDataConnectivityFilter.h>
1213
#include <vtkTriangleFilter.h>
1314

14-
#include <Logging.h>
15-
1615
#include <set>
1716

1817
namespace shapeworks {
@@ -113,7 +112,6 @@ void MeshWarper::add_particle_vertices(Eigen::MatrixXd& vertices) {
113112
// with each other. If multiple particles (new vertices) land on the same triangle, the we will need
114113
// multiple passes since we will have to make the changes and rebuild the locator.
115114
while (not_all_done) {
116-
117115
not_all_done = false;
118116

119117
this->reference_mesh_->BuildLinks();
@@ -415,7 +413,7 @@ vtkSmartPointer<vtkPolyData> MeshWarper::recreate_mesh(vtkSmartPointer<vtkPolyDa
415413

416414
if (cell->GetCellType() != VTK_EMPTY_CELL) { // VTK_EMPTY_CELL means it was deleted
417415
// create an array of vtkIdType
418-
vtkIdType *pts = new vtkIdType[cell->GetNumberOfPoints()];
416+
vtkIdType* pts = new vtkIdType[cell->GetNumberOfPoints()];
419417
for (vtkIdType j = 0; j < cell->GetNumberOfPoints(); j++) {
420418
pts[j] = cell->GetPointId(j);
421419
}
@@ -556,14 +554,13 @@ Eigen::MatrixXd MeshWarper::extract_landmarks(vtkSmartPointer<vtkPolyData> warpe
556554

557555
vtkSmartPointer<vtkDataArray> data_array = warped_mesh->GetPoints()->GetData();
558556

559-
for (auto ids : landmarks_map_)
560-
{
561-
auto id_landmark = ids.first;
562-
auto id_vertice = ids.second;
557+
for (auto ids : landmarks_map_) {
558+
auto id_landmark = ids.first;
559+
auto id_vertex = ids.second;
563560

564-
landmarks(id_landmark, 0) = data_array->GetComponent(id_vertice, 0);
565-
landmarks(id_landmark, 1) = data_array->GetComponent(id_vertice, 1);
566-
landmarks(id_landmark, 2) = data_array->GetComponent(id_vertice, 2);
561+
landmarks(id_landmark, 0) = data_array->GetComponent(id_vertex, 0);
562+
landmarks(id_landmark, 1) = data_array->GetComponent(id_vertex, 1);
563+
landmarks(id_landmark, 2) = data_array->GetComponent(id_vertex, 2);
567564
}
568565

569566
return landmarks;

Studio/Analysis/AnalysisTool.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ std::string AnalysisTool::get_analysis_mode() {
186186
}
187187

188188
//---------------------------------------------------------------------------
189-
bool AnalysisTool::get_group_difference_mode() { return ui_->difference_button->isChecked(); }
189+
bool AnalysisTool::get_group_difference_mode() { return groups_active() && ui_->difference_button->isChecked(); }
190190

191191
//---------------------------------------------------------------------------
192192
std::vector<Shape::Point> AnalysisTool::get_group_difference_vectors() {
@@ -357,6 +357,8 @@ void AnalysisTool::handle_analysis_options() {
357357
pca_animate_timer_.stop();
358358
}
359359

360+
update_difference_particles();
361+
360362
Q_EMIT update_view();
361363
}
362364

@@ -1463,6 +1465,11 @@ void AnalysisTool::group_changed() {
14631465

14641466
//---------------------------------------------------------------------------
14651467
bool AnalysisTool::groups_active() {
1468+
// check that the group tab is active
1469+
if (ui_->tabWidget->currentWidget() != ui_->mean_tab) {
1470+
return false;
1471+
}
1472+
14661473
std::string group_set = ui_->group_box->currentText().toStdString();
14671474
bool groups_enabled = group_set != "" && group_set != "-None-";
14681475
return groups_enabled;

Studio/Analysis/AnalysisTool.ui

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,7 +1387,7 @@ QWidget#particles_panel {
13871387
<item row="2" column="0">
13881388
<widget class="QRadioButton" name="pca_scalar_only">
13891389
<property name="toolTip">
1390-
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
1390+
<string>PCA analysis on scalars only</string>
13911391
</property>
13921392
<property name="text">
13931393
<string>Scalar Only</string>
@@ -1412,7 +1412,7 @@ QWidget#particles_panel {
14121412
<item row="1" column="0">
14131413
<widget class="QRadioButton" name="pca_scalar_shape_only">
14141414
<property name="toolTip">
1415-
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
1415+
<string>PCA analysis on shape only</string>
14161416
</property>
14171417
<property name="text">
14181418
<string>Shape Only</string>
@@ -1428,7 +1428,7 @@ QWidget#particles_panel {
14281428
<item row="3" column="0">
14291429
<widget class="QRadioButton" name="pca_shape_and_scalar">
14301430
<property name="toolTip">
1431-
<string>Multi-Level Component Analysis - Modes of variation highlighting only morphological changes in shape subspace.</string>
1431+
<string>PCA analysis on shape+scalars combined</string>
14321432
</property>
14331433
<property name="text">
14341434
<string>Shape and Scalar</string>
@@ -1450,13 +1450,19 @@ QWidget#particles_panel {
14501450
</item>
14511451
<item row="1" column="1">
14521452
<widget class="QCheckBox" name="pca_predict_scalar">
1453+
<property name="toolTip">
1454+
<string>Predict scalars from shape using 2 block PLS fit</string>
1455+
</property>
14531456
<property name="text">
14541457
<string>Predict Scalar</string>
14551458
</property>
14561459
</widget>
14571460
</item>
14581461
<item row="2" column="1">
14591462
<widget class="QCheckBox" name="pca_predict_shape">
1463+
<property name="toolTip">
1464+
<string>Predict shape from scalars using 2 block PLS fit</string>
1465+
</property>
14601466
<property name="text">
14611467
<string>Predict Shape</string>
14621468
</property>

0 commit comments

Comments
 (0)