File size: 2,497 Bytes
534218d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash

# Quick Start Script for Pneumonia Consolidation Segmentation
# This script sets up the environment and runs initial tests

echo "🫁 Pneumonia Consolidation Segmentation - Quick Start"
echo "======================================================"
echo ""

# Check if we're in the right directory
if [ ! -f "dice_calculator_app.py" ]; then
    echo "❌ Error: Please run this script from the dice/ directory"
    exit 1
fi

echo "βœ“ Directory check passed"
echo ""

# Step 1: Install dependencies
echo "πŸ“¦ Step 1: Installing dependencies..."
echo "Command: pip install -r requirements.txt"
echo ""
read -p "Press Enter to continue or Ctrl+C to cancel..."
pip install -r requirements.txt

if [ $? -eq 0 ]; then
    echo "βœ“ Dependencies installed successfully"
else
    echo "❌ Error installing dependencies"
    exit 1
fi
echo ""

# Step 2: Test Streamlit installation
echo "πŸ§ͺ Step 2: Testing Streamlit installation..."
streamlit --version
if [ $? -eq 0 ]; then
    echo "βœ“ Streamlit is working"
else
    echo "❌ Streamlit test failed"
    exit 1
fi
echo ""

# Step 3: Create sample test images (optional)
echo "πŸ“Έ Step 3: Would you like to preprocess sample images now?"
echo "This will enhance chest X-rays for better consolidation visibility."
echo ""
read -p "Enter 'y' to preprocess images, or 'n' to skip: " preprocess

if [ "$preprocess" = "y" ]; then
    echo ""
    echo "Enter the path to your input directory (e.g., ../data/Pacientes/):"
    read input_dir
    
    if [ -d "$input_dir" ]; then
        echo "Processing images from: $input_dir"
        echo "Output will be saved to: ./enhanced_images/"
        python preprocessing_consolidation.py \
            --input "$input_dir" \
            --output ./enhanced_images/ \
            --batch \
            --extension .jpg
        
        echo "βœ“ Preprocessing complete"
    else
        echo "❌ Directory not found: $input_dir"
    fi
fi
echo ""

# Step 4: Launch Streamlit app
echo "πŸš€ Step 4: Launch Dice Calculator App"
echo ""
echo "The Streamlit app will open in your browser."
echo "You can then upload images and masks to calculate Dice scores."
echo ""
read -p "Press Enter to launch the app, or Ctrl+C to exit..."

streamlit run dice_calculator_app.py

echo ""
echo "βœ“ Setup complete!"
echo ""
echo "Next steps:"
echo "1. Annotate your images using CVAT or Label Studio"
echo "2. Use the Dice Calculator to validate annotations"
echo "3. See TODO.md for complete project roadmap"