Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studio fixed domains #2141

Merged
merged 23 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2a584d5
Resolve #1517 by adding an option to copy free form constraints from
akenmorris Aug 24, 2023
4f9c404
Revert table startup changes.
akenmorris Aug 24, 2023
31b4d8d
Fix problem where FFCs may not show for project saved with feature ma…
akenmorris Aug 24, 2023
072e9df
Fix shapes not disappearing from light table when removed via data ta…
akenmorris Aug 24, 2023
ac9d432
Resolve #2113 - autosave after optimization.
akenmorris Aug 24, 2023
363ed81
Switch to safer suffix check.
akenmorris Aug 24, 2023
411a717
Allow loading projects where some subjects don't have particles.
akenmorris Aug 24, 2023
e23b7ad
Also accept yes/no for Variant bool.
akenmorris Aug 24, 2023
449532a
Add support for `fixed` flag in project.
akenmorris Aug 24, 2023
cb347a4
Add blue border for fixed subjects
akenmorris Aug 24, 2023
65a5253
Remove `this->` from Groom.cpp
akenmorris Aug 24, 2023
8546ebd
Cleanup
akenmorris Aug 24, 2023
c1aaf3c
Added the ability to groom with fixed subjects.
akenmorris Aug 24, 2023
b31878e
Cleanup
akenmorris Aug 25, 2023
10cc5a7
Sampler cleanup
akenmorris Aug 25, 2023
615583b
Cleanup
akenmorris Aug 25, 2023
8b7ddea
New fixed subjects support via project file / Studio.
akenmorris Aug 25, 2023
25e07ac
Handle case when no transforms are present.
akenmorris Aug 25, 2023
0033d5a
Update ellipsoid_fd use case to use particle files instead of landmar…
akenmorris Aug 25, 2023
2195915
Update to use new fixed domains support
akenmorris Aug 25, 2023
ea8285b
Update python scripts for fixed domains changes.
akenmorris Aug 25, 2023
847fdcd
Fix typo
akenmorris Aug 25, 2023
4bbe65f
Fix fixed domains with distance transforms, narrow band
akenmorris Aug 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Examples/Python/deep_ssm.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def Run_Pipeline(args):
The required grooming steps are:
1. Load mesh
2. Apply clipping with planes for finding alignment transform
3. Find reflection tansfrom
3. Find reflection transfrom
4. Select reference mesh
5. Find rigid alignment transform
For more information on grooming see docs/workflow/groom.md
Expand Down Expand Up @@ -479,7 +479,8 @@ def Run_Pipeline(args):
transform = [ train_transforms[i].flatten() ]
subject.set_groomed_transforms(transform)
subject.set_constraints_filenames(rel_plane_files)
subject.set_landmarks_filenames([train_local_particles[i]])
subject.set_local_particle_filenames([train_local_particles[i]])
subject.set_world_particle_filenames([train_local_particles[i]])
subject.set_extra_values({"fixed": "yes"})
subjects.append(subject)
# Add new validation shapes
Expand All @@ -500,7 +501,8 @@ def Run_Pipeline(args):
transform = [ val_transforms[i].flatten() ]
subject.set_groomed_transforms(transform)
subject.set_constraints_filenames(rel_plane_files)
subject.set_landmarks_filenames(rel_particle_files)
subject.set_local_particle_filenames(rel_particle_files)
subject.set_world_particle_filenames(rel_particle_files)
subject.set_extra_values({"fixed": "no"})
subjects.append(subject)
project = sw.Project()
Expand All @@ -512,11 +514,7 @@ def Run_Pipeline(args):
parameter_dictionary["procrustes"] = 0
parameter_dictionary["procrustes_interval"] = 0
parameter_dictionary["procrustes_scaling"] = 0
parameter_dictionary["use_landmarks"] = 1
parameter_dictionary["use_fixed_subjects"] = 1
parameter_dictionary["narrow_band"] = 1e10
parameter_dictionary["fixed_subjects_column"] = "fixed"
parameter_dictionary["fixed_subjects_choice"] = "yes"
for key in parameter_dictionary:
parameters.set(key, sw.Variant(parameter_dictionary[key]))
project.set_parameters("optimize", parameters)
Expand Down
11 changes: 5 additions & 6 deletions Examples/Python/ellipsoid_fd.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ def Run_Pipeline(args):
rel_particle_files = sw.utils.get_relative_paths([os.getcwd() + "/" + fixed_local_particles[i]], project_location)
subject.set_original_filenames(original_groom_files)
subject.set_groomed_filenames(rel_groom_files)
subject.set_landmarks_filenames(rel_particle_files)
subject.set_local_particle_filenames(rel_particle_files)
subject.set_world_particle_filenames(rel_particle_files)
subject.set_extra_values({"fixed": "yes"})
subjects.append(subject)

Expand All @@ -135,7 +136,8 @@ def Run_Pipeline(args):
rel_particle_files = sw.utils.get_relative_paths([os.getcwd() + "/" + mean_shape_path], project_location)
subject.set_original_filenames(original_groom_files)
subject.set_groomed_filenames(rel_groom_files)
subject.set_landmarks_filenames(rel_particle_files)
subject.set_local_particle_filenames(rel_particle_files)
subject.set_world_particle_filenames(rel_particle_files)
subject.set_extra_values({"fixed": "no"})
subjects.append(subject)

Expand All @@ -160,11 +162,7 @@ def Run_Pipeline(args):
"procrustes_scaling": 0,
"save_init_splits": 0,
"verbosity": 0,
"use_landmarks": 1,
"use_fixed_subjects": 1,
"narrow_band": 1e10,
"fixed_subjects_column": "fixed",
"fixed_subjects_choice": "yes"
}

for key in parameter_dictionary:
Expand All @@ -186,6 +184,7 @@ def Run_Pipeline(args):

# Run optimization
optimize_cmd = ('shapeworks optimize --progress --name ' + spreadsheet_file).split()
print(optimize_cmd)
subprocess.check_call(optimize_cmd)

# If tiny test or verify, check results and exit
Expand Down
20 changes: 10 additions & 10 deletions Libs/Analyze/Shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ void Shape::clear_reconstructed_mesh() { reconstructed_meshes_ = MeshGroup(subje
bool Shape::import_global_point_files(std::vector<std::string> filenames) {
for (int i = 0; i < filenames.size(); i++) {
Eigen::VectorXd points;
if (!Shape::import_point_file(filenames[i], points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
if (filenames[i] != "") {
if (!Shape::import_point_file(filenames[i], points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
}
}
global_point_filenames_.push_back(filenames[i]);
particles_.set_world_particles(i, points);
Expand All @@ -160,8 +162,10 @@ bool Shape::import_global_point_files(std::vector<std::string> filenames) {
bool Shape::import_local_point_files(std::vector<std::string> filenames) {
for (int i = 0; i < filenames.size(); i++) {
Eigen::VectorXd points;
if (!Shape::import_point_file(filenames[i], points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
if (filenames[i] != "") {
if (!Shape::import_point_file(filenames[i], points)) {
throw std::invalid_argument("Unable to import point file: " + filenames[i]);
}
}
local_point_filenames_.push_back(filenames[i]);
particles_.set_local_particles(i, points);
Expand Down Expand Up @@ -307,9 +311,7 @@ bool Shape::store_constraints() {
Eigen::VectorXd Shape::get_global_correspondence_points() { return particles_.get_combined_global_particles(); }

//---------------------------------------------------------------------------
Eigen::VectorXd Shape::get_local_correspondence_points() {
return particles_.get_combined_local_particles();
}
Eigen::VectorXd Shape::get_local_correspondence_points() { return particles_.get_combined_local_particles(); }

//---------------------------------------------------------------------------
int Shape::get_id() { return id_; }
Expand Down Expand Up @@ -699,9 +701,7 @@ void Shape::set_particle_transform(vtkSmartPointer<vtkTransform> transform) {
}

//---------------------------------------------------------------------------
void Shape::set_alignment_type(int alignment) {
particles_.set_alignment_type(alignment);
}
void Shape::set_alignment_type(int alignment) { particles_.set_alignment_type(alignment); }

//---------------------------------------------------------------------------
vtkSmartPointer<vtkTransform> Shape::get_reconstruction_transform(int domain) {
Expand Down
Loading
Loading