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

Improved 'direct method' for converting contours to meshes #24

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3b389bb
CompareMeshes: Added operation to compare meshes
tiffanymatthe Feb 26, 2023
5e7aa2c
Added script to compare meshes with reconstructed versions
misprit7 Mar 5, 2023
5bf3f07
Added volume comparison
Renu-R Mar 6, 2023
194a860
Add more shapes to bash script (#5)
tiffanymatthe Mar 12, 2023
0470ee6
Add box mesh with conic issue in compare mesh script (#4)
tiffanymatthe Mar 12, 2023
c30cb50
added vol comparison to script (#6)
Renu-R Mar 23, 2023
4a2536e
Fix average contour normal bug (#7)
tiffanymatthe Mar 23, 2023
9745f73
Check for contour intersection (#10)
Renu-R Mar 23, 2023
e7733c6
Created a new operation which lets us create custom contours, for tes…
DominicKlukas Mar 24, 2023
4e1d55c
Implemented first version of CreateCustomContour
DominicKlukas Mar 24, 2023
f3dc1c9
Merge pull request #11 from tiffanymatthe/create_custom_contours
DominicKlukas Mar 24, 2023
f502f44
Fix capping issue (#9)
tiffanymatthe Apr 5, 2023
fbea4df
Upgraded CreateCustomContour, Fixed an N-to-N bug which results in op…
DominicKlukas Apr 9, 2023
ea3aa54
Nested contour handling
Renu-R Apr 9, 2023
cb12c46
Manifold metric (#15)
tiffanymatthe Apr 10, 2023
d4872e2
Two to one branching (#13)
tiffanymatthe Apr 10, 2023
9ccbbce
Graph tiling (#16)
misprit7 Apr 11, 2023
f4062cf
replaced tiling methods (#17)
Renu-R Apr 11, 2023
0dc5276
Fixed limites for graph construction (#18)
misprit7 Apr 11, 2023
cb58a4a
clean code (#19)
tiffanymatthe Apr 24, 2023
54c8b3f
Added downsampling (#20)
misprit7 Apr 24, 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
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
rsync -avP /out/ ./Windows/
strip ./Windows/usr/bin/*exe
strip ./Windows/usr/lib/*a
git config --global --add safe.directory '*' || true
- name: test
run: |
export DEBIAN_FRONTEND='noninteractive'
Expand All @@ -47,7 +48,7 @@ jobs:
./integration_tests/Run.sh -v
- name: create_zip
run: |
export short_sha="$(git rev-parse --short HEAD)"
export short_sha="$(git rev-parse --short HEAD || printf 'unknown')"
export DEBIAN_FRONTEND="noninteractive"
apt-get update --yes
apt-get install --yes --no-install-recommends coreutils binutils findutils rsync openssh-client patchelf zip
Expand Down Expand Up @@ -86,6 +87,7 @@ jobs:
run: |
( ( while true ; do sleep 225 ; printf '\n\n' ; df -h ; printf '\n\n' ; free || true ; printf '\n\n' ; done ) &)
./docker/builders/ci/implementation_ci_debian_oldstable.sh
git config --global --add safe.directory '*' || true
- name: test
run: |
./integration_tests/Run.sh -v
Expand Down
5 changes: 3 additions & 2 deletions compile_and_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ shopt -s nocasematch

# The temporary location in which to build.
#BUILDROOT="/home/hal/Builds/DICOMautomaton/"
BUILDROOT="/tmp/dcma_build"
#BUILDROOT="build"
# BUILDROOT="/tmp/dcma_build"
BUILDROOT="build"

DISTRIBUTION="auto" # used to tailor the build process for specific distributions/environments.

Expand Down Expand Up @@ -190,6 +190,7 @@ elif [[ "${DISTRIBUTION}" =~ .*debian.* ]] ; then
-DWITH_ASAN=OFF \
-DWITH_TSAN=OFF \
-DWITH_MSAN=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
../
fi
JOBS=$(nproc)
Expand Down
138 changes: 138 additions & 0 deletions scripts/compare_all_meshes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/bin/bash
POSITIONAL_ARGS=()
OPERATIONS=""
VERBOSE=0

while [[ $# -gt 0 ]]; do
case $1 in
-s|--show)
OPERATIONS+="-o SDL_Viewer"
shift # past argument
;;
-v|--verbose)
VERBOSE=1
shift # past argument
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
shift # past argument
;;
esac
done

tri_force_shape="
subtract(){
join(){
plane(0,0,0, 1,1,0, 10);
plane(0,0,0, 0,1,1, 10);
plane(0,0,0, 1,0,1, 10);

plane(10,10,10, -1,-1,-0, 10);
plane(10,10,10, -0,-1,-1, 10);
plane(10,10,10, -1,-0,-1, 10);
};

join(){
plane(0,0,0, 1,2,0, 10);
plane(0,0,0, 0,1,2, 10);
plane(0,0,0, 2,0,1, 10);

plane(10,10,10, -2,-1,-0, 10);
plane(10,10,10, -0,-2,-1, 10);
plane(10,10,10, -1,-0,-2, 10);
};
};
"

default_res="0.25,0.25,0.25"

declare -a shape_labels=("Sphere(10)" "aa_box(1.0,2.0,4.0)" "tri-force" "chamfered(box-sphere)")
declare -a shapes=("Sphere(10)" "aa_box(1.0,2.0,4.0)" "$tri_force_shape" "chamfer_subtract(2.0){aa_box(8.0,20.0,20.0);sphere(12.0);}")
declare -a resolutions=("$default_res" "0.25,0.25,0.75" "0.25,0.25,0.75" "$default_res")

printf "| %-20s | %-13s | %-13s | %-15s | %-15s | %-10s | %-10s | %-10s | %-10s| %-8s | %-8s | \n\n" Shape "Hausdorff 1" "Hausdorff 2" "Surface Area 1" "Surface Area 2" "Area Diff" "Vol 1" "Vol 2" "Vol Diff" "Manifold 1" "Manifold 2"

for i in ${!shapes[@]}
do
shape=${shapes[$i]}
res=${resolutions[$i]}
shape_label=${shape_labels[$i]}

OUTPUT="$(dicomautomaton_dispatcher \
-v \
-o GenerateMeshes \
-p resolution=$res \
-p MeshLabel="original" \
-p Objects="$shape" \
-o GenerateSyntheticImages \
-p NumberOfImages='128' \
-p NumberOfRows='64', \
-p NumberOfColumns='64' \
-p NumberOfChannels='1' \
-p SliceThickness='1' \
-p SpacingBetweenSlices='1' \
-p VoxelWidth='1.0' \
-p VoxelHeight='1.0' \
-p ImageAnchor='-14.0, -14.0, -14.0' \
-p ImagePosition='0.0, 0.0, 0.0' \
-p ImageOrientationColumn='1.0, 0.0, 0.0' \
-p ImageOrientationRow='0.0, 1.0, 0.0' \
-p InstanceNumber='1' \
-p AcquisitionNumber='1' \
-p VoxelValue='0.0' \
-p StipleValue='nan' \
-o ConvertMeshesToContours \
-p ROILabel="original contours" \
-p MeshSelection="last" \
-p ImageSelection="last" \
-o ConvertContoursToMeshes \
-p NormalizedROILabelRegex=".*" \
-p ROILabelRegex=".*" \
-p MeshLabel="reconstructed" \
-p Method="direct" \
-o CompareMeshes \
-p MeshSelection1="#-0" \
-p MeshSelection2="#-1" \
$OPERATIONS 2>&1)"
if [ "$VERBOSE" == 1 ]; then
echo "$OUTPUT"
fi
HD_LINE=$(grep "HAUSDORFF DISTANCE" <<< "$OUTPUT")
SA_LINE=$(grep "SURFACE AREA: First mesh" <<< "$OUTPUT")
SA_DIFF_LINE=$(grep "SURFACE AREA (%) difference" <<< "$OUTPUT")
VOL_LINE=$(grep "VOLUME: First mesh" <<< "$OUTPUT")
VOL_DIFF_LINE=$(grep "VOLUME (%) difference" <<< "$OUTPUT")
MA_LINE=$(grep "MANIFOLD: First mesh" <<< "$OUTPUT")

HD1=$(sed -r "s/.*([0-9]+\.[0-9]+) or.*/\1/g" <<< $HD_LINE)
HD2=$(sed -r "s/.*or ([0-9]+\.[0-9]+).*/\1/g" <<< $HD_LINE)

SA1=$(sed -r "s/.*First mesh = ([0-9]+\.[0-9]+).*/\1/g" <<< $SA_LINE)
SA2=$(sed -r "s/.*second mesh = ([0-9]+\.[0-9]+).*/\1/g" <<< $SA_LINE)

SA_DIFF=$(sed -r "s/.*difference: (-?[0-9]+\.[0-9]+).*/\1/g" <<< $SA_DIFF_LINE)

V1=$(sed -r "s/.*First mesh = ([0-9]+\.[0-9]+).*/\1/g" <<< $VOL_LINE)
V2=$(sed -r "s/.*second mesh = ([0-9]+\.[0-9]+).*/\1/g" <<< $VOL_LINE)

V_DIFF=$(sed -r "s/.*difference: (-?[0-9]+\.[0-9]+).*/\1/g" <<< $VOL_DIFF_LINE)

MA1=$(sed -r "s/.*First mesh = ([0-9]+).*/\1/g" <<< $MA_LINE)
MA2=$(sed -r "s/.*second mesh = ([0-9]+).*/\1/g" <<< $MA_LINE)

printf "| %-20s | %-13.3f | %-13.3f | %-15.3f | %-15.3f | %-10.3f | %-10.3f | %-10.3f | %-10.3f | %-8s | %-8s |\n\n" $shape_label $HD1 $HD2 $SA1 $SA2 $SA_DIFF $V1 $V2 $V_DIFF $MA1 $MA2

done









5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ set_target_properties( Standard_Scripts_obj PROPERTIES POSITION_INDEPENDENT_COD
add_library( Surface_Meshes_obj OBJECT Surface_Meshes.cc )
set_target_properties( Surface_Meshes_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE )

add_library( Complex_Branching_Meshing_obj OBJECT Complex_Branching_Meshing.cc )
set_target_properties( Complex_Branching_Meshing_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE )

add_library( Simple_Meshing_obj OBJECT Simple_Meshing.cc )
set_target_properties( Simple_Meshing_obj PROPERTIES POSITION_INDEPENDENT_CODE TRUE )

Expand Down Expand Up @@ -368,6 +371,7 @@ add_executable (dicomautomaton_dispatcher
$<TARGET_OBJECTS:Insert_Contours_obj>
$<TARGET_OBJECTS:Surface_Meshes_obj>
$<TARGET_OBJECTS:Simple_Meshing_obj>
$<TARGET_OBJECTS:Complex_Branching_Meshing_obj>
$<TARGET_OBJECTS:Regex_Selectors_obj>
$<TARGET_OBJECTS:String_Parsing_obj>
$<TARGET_OBJECTS:Metadata_obj>
Expand Down Expand Up @@ -463,6 +467,7 @@ if(WITH_WT)
$<TARGET_OBJECTS:Insert_Contours_obj>
$<TARGET_OBJECTS:Surface_Meshes_obj>
$<TARGET_OBJECTS:Simple_Meshing_obj>
$<TARGET_OBJECTS:Complex_Branching_Meshing_obj>
$<TARGET_OBJECTS:Regex_Selectors_obj>
$<TARGET_OBJECTS:String_Parsing_obj>
$<TARGET_OBJECTS:Metadata_obj>
Expand Down
Loading