<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>PARROT - Platform for AI-guided Radiation Oncology Treatment</title>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>

<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
    <a class="navbar-brand" href="#">PARROT</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="navbarNav">
        <div class="navbar-nav">
            <a class="nav-link active" href="#">Home</a>
            <a class="nav-link" href="documentation.html">Documentation</a>
            <a class="nav-link" href="ai_models.html">AI models</a>
            <a class="nav-link" href="contact.html">Contact</a>
        </div>
    </div>
</nav>

<div class="container mt-5">
    <div class="row">
        <div class="col-lg-8">
            <h1 class="mb-4 mt-4">Welcome to PARROT</h1>
            <p>
                PARROT, which stands for Platform for ARtificial intelligence guided Radiation Oncology Treatment,
                is a user-friendly, free, and open-source web platform. It allows users to visualize DICOM files, run AI models,
                display and evaluate predictions easily. The platform includes several trained state-of-the-art dose prediction
                and contour segmentation models. Users can also add their own models using the embedded code editor.
            </p>
            <p>
                The app consists of a frontend built in React JavaScript, including the graphical interface with a DICOM viewer,
                a selection panel of AI models, an editor of contours predictions, and evaluation tools. The backend is built with Flask
                to handle the predictions of AI models.
            </p>
        </div>
        <div class="col">
            <img src="img/index/parrot-logo.png" alt="PARROT Logo" class="index/parrot-logo img-fluid">
        </div>
    </div>
    <div class="col-lg text-center">
        <button id="downloadButton" class="btn btn-primary">Download Latest Release</button>
    </div>
</div>
<div class="container mt-5">
    <div class="row">
        <div class="col text-center mb-5">
            <h2>
                PARROT allows you to:
            </h2>        
        </div>
    </div>
    <div class="row">
        <div class="col-lg-3 text-center">
            <img src="img/index/research-and-development.png" alt="State-of-the-art models" class="img-fluid w-50 mb-3">
            <p>Run state-of-the-art AI models</p> 
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/ct-scan.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Visualize contours segmented with AI on CT and MR images</p>
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/comparison.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Compare uploaded and/or predicted dose distributions</p>
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/edit.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Correct contours predicted by AI model</p>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-3 text-center">
            <img src="img/index/dicom.PNG" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Full DICOM to DICOM workflow</p> 
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/personal-data.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Local web application to ensure patient data privacy</p>
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/innovation.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Run your own AI models</p>
        </div>
        <div class="col-lg-3 text-center">
            <img src="img/index/evaluation.png" alt="ct scan" class="img-fluid w-50 mb-3">
            <p>Clinical evaluation tools: NTCP, DVH curves, clinical objectives, dose statistics</p>
        </div>
    </div>



</div>


<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

<!--Wei Repo-->
<script>
    $(document).ready(function () {
        // Replace 'YOUR_PROJECT_ID' and 'YOUR_REPO_NAME' with your GitLab project ID and repository name
        var projectId = '25472370';
        var repoName = 'charp-viewer';
        var apiUrl = 'https://gitlab.com/api/v4/projects/'+projectId+'/releases/'
        
        $.ajax({
            url: apiUrl,
            method: 'GET',
            success: function (data) {
                if (data.length > 0) {
                    var latestRelease = data[0];
                    var releaseAssets = latestRelease.assets;
                    // Assuming the first asset is the desired download (e.g., a zip file)
                    var downloadUrl = releaseAssets.sources.length > 0 ? releaseAssets.sources[0].url : '';

                    // Update the download button href attribute
                    $('#downloadButton').attr('onclick', 'window.location.href="' + downloadUrl + '"');
                }
            },
            error: function (error) {
                console.error('Error fetching release information:', error);
            }
        });
    });
</script>

<!-- Parrot repo
<script>
    $(document).ready(function () {
        // Replace 'YOUR_PROJECT_ID' and 'YOUR_REPO_NAME' with your GitLab project ID and repository name
        // Parrot repo
        var projectId = '54838381';
        var repoName = 'PARROT';
        
        var apiUrl = 'https://gitlab.com/api/v4/projects/'+projectId+'/releases/'
        
        $.ajax({
            url: apiUrl,
            method: 'GET',
            success: function (data) {
                if (data.length > 0) {
                    var latestRelease = data[0];
                    // Get the latest release
                    var releaseAssets = latestRelease.assets;
                    // The file is in the link array, and assuming we want to download the first link (.exe), we look for his URL
                    var downloadUrl = releaseAssets.length > 0 ? releaseAssets.links[0].url : '';

                    // Update the download button href attribute
                    $('#downloadButton').attr('onclick', 'window.location.href="' + downloadUrl + '"');
                }
            },
            error: function (error) {
                console.error('Error fetching release information:', error);
            }
        });
    });
</script>
-->

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

</body>
</html>