-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Mesh_3: Add weighted images #5597
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
Merged
Merged
Changes from all commits
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
a5aaab6
Add weighted images
lrineau 71b85f4
Fix license
lrineau 76d2fcd
Missing header
lrineau a9c2e07
Fix the runtime error without arguments
lrineau d831724
convert a CGAL::Image_3 to ITK format to generate weights for weighte…
janetournois b47cf8e
compute indicator images and fit them to [0; 255]
janetournois 293b28d
perform gaussian smoothing
janetournois 16db150
fix allocation of image
janetournois c07c712
duplicate image before application of filters
janetournois 83c40f2
fix return type
janetournois 3b23b56
generate_weights is now working
janetournois 5828996
the Weights_type is unsigned char, not Image_word_type
janetournois ee6f2f8
wrap debug code in macro CGAL_MESH_3_WEIGHTED_IMAGES_DEBUG
janetournois 445378f
remove writeImage from example
janetournois 89a227a
make 'weights' a boost named parameter of create_labeled_image_mesh_d…
janetournois 89e9269
use using instead of typedef and remove unused typedefs
janetournois d069c07
remove Image_word_type template parameter
janetournois ba95896
add doc for weighted images
janetournois 5edf9d4
improve example for doc
janetournois 255ded5
do not compile weighted images example if ITK not found
janetournois a2a9261
do not compile weighted images example if ITK not found
janetournois 85c2c20
doc tiny fixes
janetournois fc9aed7
doc
janetournois c5a6838
add missing typename
janetournois 2637bf6
add weighted images to the demo
janetournois f46caac
WIP fix weighted images in demo
janetournois ecdb873
move weights to the image_item so that it does not get prematurely de…
janetournois 77327b5
(re)compute weights only if sigma has changed
janetournois d41a8f4
add tooltip to c3t3 generated from image
janetournois a7a9699
fix tab order
janetournois 53cd9a0
fix DoubleEdit content
janetournois 720d1a7
fix types and do not skip label 0
janetournois 834c9d4
Whitelist CGAL/Mesh_3/generate_weights_from_labeled_image.h
lrineau b2d7622
add missing id increment
janetournois c133042
refine less the surface
janetournois d1de29d
improve debug code
janetournois 3d240e6
Merge branch 'Mesh_3-weighted_images-GF' of github.com:lrineau/cgal i…
janetournois 438422e
fix outdated code
janetournois b4932e3
add weighted images figure
janetournois f9f2889
Merge branch 'Mesh_3-weighted_images-GF' of github.com:lrineau/cgal i…
janetournois 4b84c4b
move dump to debug code
janetournois 868e158
improve figure caption
janetournois 77152be
uncomment the use of weights in example
janetournois e1d4c0d
rename generate_weights() to generate_label_weights()
janetournois 2a4090b
rename header in doc
janetournois 4bcbcfd
Change the name of whitelisted header
lrineau 666a540
documents weights size
janetournois e516b19
use Parallel_if_available_tag
janetournois 8bfb4e4
avoid all triple for loops on i,j,k
janetournois 4427415
Merge branch 'Mesh_3-weighted_images-GF' of github.com:lrineau/cgal i…
janetournois 0bc25f9
doc (add dependency and new link)
janetournois 4fdd584
fix indentation
janetournois 1721570
create CGAL::Image_3 for weights before counting non-white pixels
janetournois 6be3be6
make constructor explicit to avoid implicit conversions
janetournois 4a65ce0
Merge branch 'Mesh_3-weighted_images-GF' of github.com:lrineau/cgal i…
janetournois bddb4fc
remove debug code
janetournois 8a882ad
Cmake : use only the required modules of ITK
janetournois 95a4613
Merge branch 'Mesh_3-weighted_images-GF' of github.com:lrineau/cgal i…
janetournois 9c02c24
add missing cmake module requirement
janetournois 3df8c33
Merge remote-tracking branch 'cgal/master' into Mesh_3-weighted_image…
janetournois 4b3fee8
ITK is not needed in c3t3_item, and find with the required components…
janetournois 96ff627
fix CMakeLists.txt
janetournois cf4edab
user manual
janetournois 38122ce
disable the weights menu when ITK is not available
janetournois 992f55b
fix warning
janetournois dd493fd
loop on i because label is not used
janetournois 8a6d92f
use "image of weights" in doc
janetournois a6d486f
add missing cast
janetournois 509ecfa
smoothing/smoother
janetournois 9beac5e
hide menu when the input is not a labeled image
janetournois 5b2e4d1
replace std::unary_function, that is deprecated in C++11
janetournois f5eeffb
remove unnecessary inheritance
janetournois ac7b637
make types consistent with non-weighted label images
janetournois c8918a9
fix conversion warning
janetournois fab7c36
function is in the IO namespace
sloriot b664ee5
workaround deprecation warning of versions < 5 of ITK
janetournois 0498cac
add and use CGAL_ITK_support.cmake
janetournois 70ad367
add CMake warning when ITK is not found
janetournois caa8c74
remove "and" from regex for blue testsuite boxes
janetournois File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| if(ITK_FOUND AND NOT TARGET CGAL::ITK_support) | ||
| add_library(CGAL::ITK_support INTERFACE IMPORTED) | ||
| set_target_properties(CGAL::ITK_support PROPERTIES | ||
| INTERFACE_COMPILE_DEFINITIONS "CGAL_USE_ITK" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${ITK_INCLUDE_DIRS}" | ||
| INTERFACE_LINK_LIBRARIES "${ITK_LIBRARIES}") | ||
| endif() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> | ||
|
|
||
| #include <CGAL/Mesh_triangulation_3.h> | ||
| #include <CGAL/Mesh_complex_3_in_triangulation_3.h> | ||
| #include <CGAL/Mesh_criteria_3.h> | ||
|
|
||
| #include <CGAL/Labeled_mesh_domain_3.h> | ||
| #include <CGAL/Mesh_3/generate_label_weights.h> | ||
| #include <CGAL/make_mesh_3.h> | ||
| #include <CGAL/Image_3.h> | ||
| #include <CGAL/IO/File_binary_mesh_3.h> | ||
| #include <CGAL/tags.h> | ||
|
|
||
| // Domain | ||
| using K = CGAL::Exact_predicates_inexact_constructions_kernel; | ||
| using Mesh_domain = CGAL::Labeled_mesh_domain_3<K>; | ||
|
|
||
| // Triangulation | ||
| using Tr = CGAL::Mesh_triangulation_3<Mesh_domain, | ||
| CGAL::Default, | ||
| CGAL::Parallel_if_available_tag>::type; | ||
| using C3t3 = CGAL::Mesh_complex_3_in_triangulation_3<Tr>; | ||
|
|
||
| // Criteria | ||
| using Mesh_criteria = CGAL::Mesh_criteria_3<Tr>; | ||
|
|
||
| // To avoid verbose function and named parameters call | ||
| using namespace CGAL::parameters; | ||
|
|
||
| int main(int argc, char* argv[]) | ||
| { | ||
| /// [Loads image] | ||
| const char* fname = (argc > 1) ? argv[1] : "data/liver.inr.gz"; | ||
| CGAL::Image_3 image; | ||
| if(!image.read(fname)){ | ||
| std::cerr << "Error: Cannot read file " << fname << std::endl; | ||
| return EXIT_FAILURE; | ||
| } | ||
| /// [Loads image] | ||
|
|
||
| /// [Domain creation] | ||
| const float sigma = 10.f; | ||
lrineau marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CGAL::Image_3 img_weights = | ||
| CGAL::Mesh_3::generate_label_weights(image, sigma); | ||
|
|
||
| Mesh_domain domain | ||
| = Mesh_domain::create_labeled_image_mesh_domain(image, | ||
| weights = img_weights, | ||
| relative_error_bound = 1e-6); | ||
| /// [Domain creation] | ||
|
|
||
| // Mesh criteria | ||
| Mesh_criteria criteria(facet_angle=30, facet_size=6, facet_distance=0.5, | ||
| cell_radius_edge_ratio=3, cell_size=8); | ||
|
|
||
| /// [Meshing] | ||
| C3t3 c3t3 = CGAL::make_mesh_3<C3t3>(domain, criteria); | ||
| /// [Meshing] | ||
|
|
||
| // Output | ||
| std::ofstream medit_file("out.mesh"); | ||
| c3t3.output_to_medit(medit_file); | ||
| std::ofstream bin_file("out.binary.cgal", std::ios_base::binary); | ||
| CGAL::IO::save_binary_file(bin_file, c3t3); | ||
|
|
||
| return 0; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.