Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions Atif/Gsoc-HealingStones/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
> 📌 New contributors: see README_ONBOARDING.md for setup and usage instructions.

# mayan_stele_readme

# Mayan Stele Fragment Reconstruction System
Expand Down
70 changes: 70 additions & 0 deletions Atif/Gsoc-HealingStones/README_ONBOARDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Mayan Stele Fragment Reconstruction Pipeline - Onboarding Guide

This document provides instructions for getting started with the fragment reconstruction pipeline.

## Quick Start

```bash
cd HealingStones/Atif/Gsoc-HealingStones
python main_pipeline.py input_dir output_dir
```

## Running via CLI

### Basic CLI Usage Examples

```bash
# Show help
python main_pipeline.py --help

# Basic run
python main_pipeline.py input_fragments/ output_results/

# With visualizations
python main_pipeline.py input/ output/ --visualize-steps

# With custom config
python main_pipeline.py input/ output/ --config configs/high_selectivity_config.json
```

## Batch Processing via CLI

The `batch_processor.py` script provides validation and preprocessing utilities.

### Basic Batch Processing Examples

```bash
# Show help
python batch_processor.py --help

# Validate PLY files in a directory
python batch_processor.py validate input_dir/

# Preprocess PLY files
python batch_processor.py preprocess input_dir/ output_dir/

# Preprocess with options
python batch_processor.py preprocess input/ output/ --no-normalize
```

### Available Arguments

| Argument | Type | Default | Description |
|----------|------|---------|-------------|
| `--input-dir` | string | None | Input directory (optional) |
| `--output-dir` | string | None | Output directory (optional) |
| `--config` | string | `configs/high_selectivity_config.json` | Config file path |

> **Note:** `--config` is parsed but not yet wired into batch processing logic.

## Configuration

The pipeline uses JSON config files in `configs/`. Default: `high_selectivity_config.json`.

## Output

Results saved to output directory:
- Reconstructed fragment meshes
- `quality_metrics.json`
- `surface_matches.json`
- `transformations.json`
81 changes: 75 additions & 6 deletions Atif/Gsoc-HealingStones/batch_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,8 +498,45 @@ def preprocess_directory(self, input_dir: str, output_dir: str, **kwargs) -> Dic
return results

# CLI Interface
def main():
parser = argparse.ArgumentParser(description="PLY Preprocessing and Validation Tools")
def parse_args():
"""
Parse command-line arguments for batch processing.

Returns:
argparse.Namespace: Parsed arguments
"""
parser = argparse.ArgumentParser(
description="PLY Preprocessing and Validation Tools",
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Examples:
python batch_processor.py validate input/
python batch_processor.py preprocess input/ output/
python batch_processor.py --input-dir input/ --output-dir output/
python batch_processor.py --config configs/high_selectivity_config.json
"""
)

# Top-level optional arguments (work without subcommands)
parser.add_argument(
"--input-dir",
type=str,
default=None,
help="Input directory containing PLY files (optional)"
)
parser.add_argument(
"--output-dir",
type=str,
default=None,
help="Output directory for processed files (optional)"
)
parser.add_argument(
"--config",
type=str,
default="configs/high_selectivity_config.json",
help="Path to JSON configuration file (default: configs/high_selectivity_config.json)"
)

subparsers = parser.add_subparsers(dest='command', help='Available commands')

# Validation command
Expand All @@ -517,8 +554,11 @@ def main():
preprocess_parser.add_argument('--no-center', action='store_true', help='Skip centering')
preprocess_parser.add_argument('--no-enhance-colors', action='store_true', help='Skip color enhancement')

args = parser.parse_args()

return parser.parse_args()


def run_command(args):
"""Execute the appropriate command based on parsed args."""
if args.command == 'validate':
validator = PLYValidator()

Expand Down Expand Up @@ -589,7 +629,36 @@ def main():
exit(1)

else:
parser.print_help()
# No command specified, show help
print("No command specified. Use --help for usage information.")


def cli_main():
"""
Entry point for batch processing CLI.

Supports both subcommands (validate, preprocess) and top-level optional args.
Running with no arguments prints help and exits gracefully.
"""
args = parse_args()

# TODO: --config is parsed but not yet wired into the processing logic.
# When config-based processing is needed, load and apply config here.
if args.config and args.config != "configs/high_selectivity_config.json":
print(f"Note: --config '{args.config}' provided but not yet used by batch processor")

# Handle top-level --input-dir/--output-dir if no subcommand specified
if args.command is None:
if args.input_dir is not None or args.output_dir is not None:
# User provided top-level args but no subcommand
print("Note: --input-dir and --output-dir are parsed but require a subcommand.")
print("Use 'validate' or 'preprocess' subcommand, e.g.:")
print(f" python batch_processor.py validate {args.input_dir or 'INPUT_DIR'}")
print(f" python batch_processor.py preprocess {args.input_dir or 'INPUT_DIR'} {args.output_dir or 'OUTPUT_DIR'}")
return

run_command(args)


if __name__ == "__main__":
main()
cli_main()