Skip to content

Commit

Permalink
updated stain detection to use concrete post-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpcshangbo committed Apr 24, 2024
1 parent 137e879 commit 3503e18
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime

# Define flags for processing
concrete_pre_filter = False
concrete_mask = True
process_crack = True
process_stain = True
process_spall = True # if crack is not processed, spall won't be processed.
Expand Down Expand Up @@ -40,9 +40,9 @@ def main(): # sourcery skip: extract-duplicate-method
log_message("Create raw, mask, overlay, mvs folders in run_timestamp folder.")
call_in_conda_env("python UpdateRawMaskOverlayConfigs.py")

# if concrete_pre_filter:
# log_message("Running concrete mask...")
# call_in_conda_env("python concretemask.py")
if concrete_mask:
log_message("Running concrete mask...")
call_in_conda_env("python concretemask.py")

# log_message("Running filter raw...")
# call_in_conda_env("python filterRaw.py")
Expand All @@ -54,13 +54,13 @@ def main(): # sourcery skip: extract-duplicate-method
log_message("Running crack segmentation...")
call_in_conda_env("python cracksegmentation.py")

log_message("Running concrete mask...")
call_in_conda_env("python concretemask.py")

log_message("Running concrete post filter...")
call_in_conda_env("python concretePostFilter.py")

exit()
# log_message("Running concrete mask...")
# call_in_conda_env("python concretemask.py")
if concrete_post_filter:
log_message("Running concrete post filter...")
call_in_conda_env("python concretePostFilter.py")


log_message("Converting crack masks to 3 categories according to directions...")
call_in_conda_env("python crack23directions.py")
Expand Down
6 changes: 3 additions & 3 deletions stainoverlay.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

# Paths for the mask images, raw images, and output images
# Read from the INI file
mask_dir = config["StainSegmentation"]["mask_directory"]
mask_dir = config["StainSegmentation"]["mask_directory"].replace("stainmask", "filteredStainMasks")
raw_dir = config["Settings"]["image_path"]
output_dir = config["StainOverlay"]["overlay_directory"]
output_dir = config["StainOverlay"]["overlay_directory"].replace("stainoverlay", "filteredStainOverlays")

# Ensure the output directory exists
if not os.path.exists(output_dir):
Expand All @@ -19,7 +19,7 @@
# Iterate over the files in the mask directory
for mask_name in os.listdir(mask_dir):
# Extract the image name from the filename
raw_name = mask_name.split(".")[0] + ".JPG"
raw_name = mask_name.split(".")[0] + ".jpg"

# Load the mask and raw images
mask = cv2.imread(os.path.join(mask_dir, mask_name), cv2.IMREAD_GRAYSCALE)
Expand Down

0 comments on commit 3503e18

Please sign in to comment.