Skip to content

Commit

Permalink
Merge pull request #2206 from SCIInstitute/release_v6.5
Browse files Browse the repository at this point in the history
Release v6.5
  • Loading branch information
akenmorris committed Feb 21, 2024
2 parents 077c588 + 7591466 commit 30d9233
Show file tree
Hide file tree
Showing 35 changed files with 764 additions and 380 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-linux-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ jobs:
build:

runs-on: ubuntu-latest
container: akenmorris/ubuntu-build-box-sw65
container: akenmorris/ubuntu-build-box-focal-sw65

steps:

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
uses: shimataro/ssh-key-action@v2.7.0
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
build:

runs-on: ubuntu-latest
container: akenmorris/ubuntu-build-box-sw65
container: akenmorris/ubuntu-build-box-focal-sw65

steps:

- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
uses: shimataro/ssh-key-action@v2.7.0
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.KNOWN_HOSTS }}
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/copy_artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ if [[ "$PLATFORM" == "windows" ]]; then
# install rsync on for windows/msys2 (the one from chocolatey doesn't work)
# (adapted from https://github.com/GuillaumeFalourd/setup-rsync)
echo "Installing rsync for Windows/msys2"
curl.exe --output rsync-3.2.3-2-x86_64.pkg.tar.zst --url https://repo.msys2.org/msys/x86_64/rsync-3.2.3-1-x86_64.pkg.tar.zst
zstd -d rsync-3.2.3-2-x86_64.pkg.tar.zst
tar -xvf rsync-3.2.3-2-x86_64.pkg.tar
mv usr/bin/rsync.exe "C:\Program Files\Git\usr\bin\\"
curl.exe --output libzstd-1.5.2-1-x86_64.pkg.tar.zst https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst
zstd -d libzstd-1.5.2-1-x86_64.pkg.tar.zst
tar -xvf libzstd-1.5.2-1-x86_64.pkg.tar
mv usr/bin/msys-zstd-1.dll "C:\Program Files\Git\usr\bin\\"
curl.exe --output libxxhash-0.8.0-1-x86_64.pkg.tar.zst https://repo.msys2.org/msys/x86_64/libxxhash-0.8.0-1-x86_64.pkg.tar.zst
zstd -d libxxhash-0.8.0-1-x86_64.pkg.tar.zst
tar -xvf libxxhash-0.8.0-1-x86_64.pkg.tar
mv usr/bin/msys-xxhash-0.8.0.dll "C:\Program Files\Git\usr\bin\\"

# These were the original URLs, but they keep changing and it's time consuming to keep up
# So I have just combined them in this windows_rsync.tar.gz that I'm hosting myself

# https://repo.msys2.org/msys/x86_64/rsync-3.2.3-1-x86_64.pkg.tar.zst
# https://repo.msys2.org/msys/x86_64/libzstd-1.5.2-1-x86_64.pkg.tar.zst
# https://repo.msys2.org/msys/x86_64/libxxhash-0.8.1-1-x86_64.pkg.tar.zst
curl.exe --output windows_rsync.tar.gz http://www.sci.utah.edu/~amorris/windows_rsync.tar.gz

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

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.20)
SET(SHAPEWORKS_MAJOR_VERSION 6 CACHE INTERNAL "Major version number" FORCE)
SET(SHAPEWORKS_MINOR_VERSION 5 CACHE INTERNAL "Minor version number" FORCE)
SET(SHAPEWORKS_PATCH_VERSION 0 CACHE INTERNAL "Patch version number" FORCE)
SET(SHAPEWORKS_VERSION_STRING "6.5.0-dev")
SET(SHAPEWORKS_VERSION_STRING "6.5.0-RC3")
SET(SHAPEWORKS_VERSION "${SHAPEWORKS_MAJOR_VERSION}.${SHAPEWORKS_MINOR_VERSION}.${SHAPEWORKS_PATCH_VERSION}")

# First, check that files were checked out properly using git-lfs
Expand Down
18 changes: 12 additions & 6 deletions Libs/Analyze/Shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,15 @@ bool Shape::import_global_point_files(std::vector<std::string> filenames) {
global_point_filenames_.clear();
for (int i = 0; i < filenames.size(); i++) {
Eigen::VectorXd points;
if (filenames[i] != "") {
if (!Shape::import_point_file(filenames[i], points)) {
auto filename = filenames[i];
// replace \ with /
filename = StringUtils::replace_string(filename, "\\", "/");
if (filename != "") {
if (!Shape::import_point_file(filename, points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
}
}
global_point_filenames_.push_back(filenames[i]);
global_point_filenames_.push_back(filename);
particles_.set_world_particles(i, points);
}
subject_->set_world_particle_filenames(global_point_filenames_);
Expand All @@ -165,12 +168,15 @@ bool Shape::import_local_point_files(std::vector<std::string> filenames) {
local_point_filenames_.clear();
for (int i = 0; i < filenames.size(); i++) {
Eigen::VectorXd points;
if (filenames[i] != "") {
if (!Shape::import_point_file(filenames[i], points)) {
auto filename = filenames[i];
// replace \ with /
filename = StringUtils::replace_string(filename, "\\", "/");
if (filename != "") {
if (!Shape::import_point_file(filename, points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
}
}
local_point_filenames_.push_back(filenames[i]);
local_point_filenames_.push_back(filename);
particles_.set_local_particles(i, points);
}
subject_->set_local_particle_filenames(local_point_filenames_);
Expand Down
2 changes: 1 addition & 1 deletion Libs/Mesh/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ Mesh& Mesh::fixElement() {
FEMesh* meshFE = import.Load(this->poly_data_);

if (meshFE == nullptr) {
throw std::invalid_argument("Unable to read file");
throw std::runtime_error("Unable to read mesh file");
}

FEFixMesh fix;
Expand Down
7 changes: 7 additions & 0 deletions Libs/Mesh/MeshWarper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,13 @@ bool MeshWarper::generate_warp() {
// prep points
this->vertices_ = this->reference_particles_;

if (reference_mesh_->GetNumberOfPoints() == 0) {
SW_ERROR("Unable to warp mesh, no points in surface mesh");
update_progress(1.0);
warp_available_ = false;
return false;
}

this->add_particle_vertices(this->vertices_);

if (this->landmarks_points_.size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Libs/Particles/ParticleFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Eigen::VectorXd read_particles(std::string filename) {

std::ifstream in(filename);
if (!in.good()) {
throw std::runtime_error("Unable to read file: " + filename);
throw std::runtime_error("Unable to read particle file: " + filename);
}
Eigen::VectorXd points;

Expand Down
9 changes: 7 additions & 2 deletions Libs/Project/Project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ void Project::set_project_path(const std::string& new_pathname) {

auto fixup = [&](StringList paths) {
StringList new_paths;
for (const auto& path : paths) {
for (auto path : paths) {
if (fs::exists(path)) {
// replace \ with / in path
path = StringUtils::replace_string(path, "\\", "/");
auto canonical = fs::canonical(path, old_path);
new_paths.push_back(fs::relative(canonical, new_path).string());
} else {
Expand All @@ -116,7 +118,10 @@ void Project::set_project_path(const std::string& new_pathname) {
auto features = subject->get_feature_filenames();
project::types::StringMap new_features;
for (auto const& x : features) {
auto canonical = fs::canonical(x.second, old_path);
auto path = x.second;
// replace \ with / in path
path = StringUtils::replace_string(path, "\\", "/");
auto canonical = fs::canonical(path, old_path);
new_features[x.first] = fs::relative(canonical, new_path).string();
}
subject->set_feature_filenames(new_features);
Expand Down
15 changes: 12 additions & 3 deletions Python/DeepSSMUtilsPackage/DeepSSMUtils/eval_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def get_mesh_from_DT(DT_list, mesh_dir):
if not os.path.exists(mesh_dir):
os.makedirs(mesh_dir)
mesh_files = []
xml_filename = mesh_dir + "temp.xml"
for input_file in DT_list:
print(' ' + get_prefix(input_file))
output_vtk = mesh_dir + "original_" + get_prefix(input_file) + ".vtk"
Expand All @@ -59,12 +58,22 @@ def get_mesh_from_DT(DT_list, mesh_dir):
return sorted(mesh_files)


def get_mesh(filename, iso_value=0):
if filename.endswith('.nrrd'):
image = sw.Image(filename)
return image.toMesh(iso_value)
else:
return sw.Mesh(filename)


def get_mesh_from_particles(particle_list, mesh_dir, template_particles, template_mesh, planes=None):
if not os.path.exists(mesh_dir):
os.makedirs(mesh_dir)

warp = sw.MeshWarper()
sw_mesh = sw.Mesh(template_mesh)

# Create mesh from file (mesh or segmentation)
sw_mesh = get_mesh(template_mesh)
sw_particles = np.loadtxt(template_particles)
warp.generateWarp(sw_mesh, sw_particles)

Expand Down Expand Up @@ -135,7 +144,7 @@ def get_mesh_distances(pred_particle_files, mesh_list, template_particles, templ
mean_distances.append(-1)
continue
print(f"Computing distance between {mesh_list[index]} and {pred_mesh_list[index]}")
orig_mesh = sw.Mesh(mesh_list[index])
orig_mesh = get_mesh(mesh_list[index], iso_value=0.5)
if planes is not None:
orig_mesh.clip(planes[index][0], planes[index][1], planes[index][2])
pred_mesh = sw.Mesh(pred_mesh_list[index])
Expand Down
2 changes: 1 addition & 1 deletion Python/DeepSSMUtilsPackage/DeepSSMUtils/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def run_data_augmentation(project, num_samples, num_dim, percent_variability, sa
train_image_filenames = []
train_world_particle_filenames = []
for i in get_training_indices(project):
train_image_filenames.append(deepssm_dir + f"/train_images/{i}.nrrd")
train_image_filenames.append(f"deepssm/train_images/{i}.nrrd")
particle_file = subjects[i].get_world_particle_filenames()[0]
train_world_particle_filenames.append(particle_file)

Expand Down
4 changes: 2 additions & 2 deletions Studio/Data/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1102,14 +1102,14 @@ bool Session::get_image_3d_mode() { return params_.get("image_3d_mode", false);

//---------------------------------------------------------------------------
void Session::set_image_share_window_and_level(bool enabled) {
if (enabled == get_image_share_window_and_level() || is_loading()) {
if (enabled == get_image_share_brightness_contrast() || is_loading()) {
return;
}
params_.set("image_share_window_and_level", enabled);
}

//---------------------------------------------------------------------------
bool Session::get_image_share_window_and_level() { return params_.get("image_share_window_and_level", true); }
bool Session::get_image_share_brightness_contrast() { return params_.get("image_share_window_and_level", true); }

//---------------------------------------------------------------------------
void Session::set_image_sync_slice(bool enabled) {
Expand Down
2 changes: 1 addition & 1 deletion Studio/Data/Session.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ class Session : public QObject, public QEnableSharedFromThis<Session> {

// image sync/share window width and level
void set_image_share_window_and_level(bool enabled);
bool get_image_share_window_and_level();
bool get_image_share_brightness_contrast();

// image sync slice
void set_image_sync_slice(bool enabled);
Expand Down
Loading

0 comments on commit 30d9233

Please sign in to comment.