Skip to content

Commit

Permalink
Merge pull request #3049 from MRtrix3/voxel2mesh_fixes
Browse files Browse the repository at this point in the history
voxel2mesh fixes
  • Loading branch information
Lestropie authored Feb 6, 2025
2 parents ff2dedf + f666c76 commit 45d970a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/voxel2mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ void run ()
Surface::Algo::image2mesh_blocky (input, mesh);

} else {

auto input = Image<float>::open (argument[0]);
const default_type threshold = get_option_value ("threshold", Filter::estimate_optimal_threshold (input));
auto opt = get_options("threshold");
const default_type threshold = opt.empty() ? Filter::estimate_optimal_threshold (input) : opt[0][0];
Surface::Algo::image2mesh_mc (input, mesh, threshold);

}
Expand Down
1 change: 1 addition & 0 deletions src/surface/algo/image2mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ namespace MR
const auto existing = vox2vertindex.find (voxels[in_vertex]);
if (existing == vox2vertindex.end()) {
triangle_vertices[out_vertex] = vertices.size();
vox2vertindex.insert(std::make_pair(voxels[in_vertex], vertices.size()));
Eigen::Vector3d pos_voxelspace (default_type(voxels[in_vertex][0]) - 0.5, default_type(voxels[in_vertex][1]) - 0.5, default_type(voxels[in_vertex][2]) - 0.5);
vertices.push_back (transform.voxel2scanner * pos_voxelspace);
} else {
Expand Down

0 comments on commit 45d970a

Please sign in to comment.