"""
CORE - Cell-Level Coarse-to-Fine Image Registration Engine

A comprehensive framework for multi-stain whole-slide image registration.

Originally developed by eshasadia/CORE Team.
Extended and packaged by Avishek8136.
"""

__version__ = "1.0.1"
__author__ = "CORE Team (eshasadia), Extended by Avishek8136"
__license__ = "MIT"

from core.config import (
    RegistrationParams,
    VisualizationParams,
    PREPROCESSING_RESOLUTION,
    REGISTRATION_RESOLUTION,
    PATCH_SIZE,
    PATCH_STRIDE,
)

# Registration modules
from core.registration.registration import (
    perform_rigid_registration,
    perform_shape_aware_registration,
    find_mutual_nearest_neighbors,
    perform_cpd_registration,
    create_displacement_field,
    perform_icp_registration,
)

from core.registration.rigid import (
    rigid_registration,
    Trimorph,
    XFeatReg,
    ShapeAwarePointSetRegistration,
    register_wsi_with_fine_tuning,
    extract_corresponding_tiles,
)

from core.registration.nonrigid import (
    initialize_deformation_field,
    build_reference_coordinate_system,
    apply_deformation_field,
    scale_deformation_field,
    create_multiscale_representation,
    compute_normalized_cross_correlation,
    deformation_loss,
)

# Preprocessing modules
from core.preprocessing.preprocessing import (
    load_wsi_images,
    preprocess_images,
    extract_tissue_masks,
    adjust_gamma,
    scale_transformation_matrix,
    pad_images_np,
    pad_to_same_size,
)

from core.preprocessing.nuclei_analysis import (
    extract_patches_from_wsi,
    detect_nuclei_patch_watershed,
    process_fixed_patch,
    process_moving_patch,
    process_nuclei_in_patches,
    save_nuclei_data_to_csv,
    load_nuclei_coordinates,
)

from core.preprocessing.tissuemask import (
    FlorenceTissueMaskExtractor,
    UNetTissueMaskExtractor,
)

from core.preprocessing.stainnorm import StainNormalizer

from core.preprocessing.padding import (
    pad_images,
    pad_landmarks,
    remove_padding,
    pad_image_src,
)

# Evaluation modules
from core.evaluation.evaluation import (
    tre,
    rtre,
    load_landmark_points,
    transform_points_homogeneous,
    evaluate_registration_tre,
    apply_displacement_field_to_points,
    ngf_metric,
)

# Visualization modules
from core.visualization.visualization import (
    setup_bokeh_notebook,
    visualize_cluster_alignment,
    visualize_overlays,
    visualize_patches,
    create_nuclei_overlay_plot,
    create_registration_comparison_plot,
    visualize_shape_aware_registration,
)

# Utility modules
from core.utils.util import (
    skip_subsample,
    gamma_corrections,
    create_displacement_field_for_wsi,
    matrix_df,
    combine_deformation,
    scale_transformation_matrix,
    create_pyramid,
)

__all__ = [
    # Version info
    "__version__",
    "__author__",
    "__license__",
    
    # Config
    "RegistrationParams",
    "VisualizationParams",
    "PREPROCESSING_RESOLUTION",
    "REGISTRATION_RESOLUTION",
    "PATCH_SIZE",
    "PATCH_STRIDE",
    
    # Registration
    "perform_rigid_registration",
    "perform_shape_aware_registration",
    "find_mutual_nearest_neighbors",
    "perform_cpd_registration",
    "create_displacement_field",
    "perform_icp_registration",
    "rigid_registration",
    "Trimorph",
    "XFeatReg",
    "ShapeAwarePointSetRegistration",
    "register_wsi_with_fine_tuning",
    "extract_corresponding_tiles",
    "initialize_deformation_field",
    "build_reference_coordinate_system",
    "apply_deformation_field",
    "scale_deformation_field",
    "create_multiscale_representation",
    "compute_normalized_cross_correlation",
    "deformation_loss",
    
    # Preprocessing
    "load_wsi_images",
    "preprocess_images",
    "extract_tissue_masks",
    "adjust_gamma",
    "scale_transformation_matrix",
    "pad_images_np",
    "pad_to_same_size",
    "extract_patches_from_wsi",
    "detect_nuclei_patch_watershed",
    "process_fixed_patch",
    "process_moving_patch",
    "process_nuclei_in_patches",
    "save_nuclei_data_to_csv",
    "load_nuclei_coordinates",
    "FlorenceTissueMaskExtractor",
    "UNetTissueMaskExtractor",
    "StainNormalizer",
    "pad_images",
    "pad_landmarks",
    "remove_padding",
    "pad_image_src",
    
    # Evaluation
    "tre",
    "rtre",
    "load_landmark_points",
    "transform_points_homogeneous",
    "evaluate_registration_tre",
    "apply_displacement_field_to_points",
    "ngf_metric",
    
    # Visualization
    "setup_bokeh_notebook",
    "visualize_cluster_alignment",
    "visualize_overlays",
    "visualize_patches",
    "create_nuclei_overlay_plot",
    "create_registration_comparison_plot",
    "visualize_shape_aware_registration",
    
    # Utilities
    "skip_subsample",
    "gamma_corrections",
    "create_displacement_field_for_wsi",
    "matrix_df",
    "combine_deformation",
    "create_pyramid",
]