File size: 1,590 Bytes
70884da |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import argparse
from scripts.slide_processor_parallel import SlideProcessor
def main():
parser = argparse.ArgumentParser(description='Process whole slide images from a directory.')
# Required arguments
parser.add_argument('-d', '--directory', type=str, required=True,
help='Directory containing whole slide image files.')
parser.add_argument('-o', '--output_dir', type=str, required=True,
help='Directory to save the processed tiles.')
# Optional arguments with defaults
parser.add_argument('-t', '--tile_size', type=int, default=1024,
help='Size of the tile in pixels (default: 1024).')
parser.add_argument('-v', '--overlap', type=int, default=0,
help='Overlap of tiles in pixels (default: 0).')
parser.add_argument('-th', '--tissue_threshold', type=float, default=0.65,
help='Threshold for tissue detection as a float (default: 0.65).')
parser.add_argument('-w', '--max_workers', type=int, default=30,
help='Maximum number of worker threads/processes (default: 30).')
args = parser.parse_args()
# Initialize the SlideProcessor with the parsed arguments
processor = SlideProcessor(
tile_size=args.tile_size,
overlap=args.overlap,
tissue_threshold=args.tissue_threshold,
max_workers=args.max_workers
)
# Start the processing
processor.parallel_process(base_dir=args.directory, output_dir=args.output_dir)
if __name__ == '__main__':
main()
|