A Flutter-based mobile application that uses AI to classify brain tumor types from MRI images using TensorFlow Lite. The app features a modern, animated interface with robust error handling and can detect four types of conditions: Glioma, Meningioma, Pituitary Tumor, and No Tumor.
- π¬ AI-Powered Classification: Uses a trained TensorFlow Lite model for accurate brain tumor detection
- πΈ Multiple Input Sources: Support for both camera capture and gallery image selection
- π Detailed Analysis: Provides confidence scores for all tumor types with visual progress indicators
- β‘ Real-time Processing: On-device inference for fast, private analysis
- π‘οΈ Privacy-First: All processing happens locally on the device
- π± Cross-Platform: Built with Flutter for iOS and Android compatibility
- β¨ Animated Background: Dynamic geometric shapes with smooth floating and rotating animations
- π Glassmorphism Design: Modern frosted glass effects with gradient overlays
- π Hero Animations: Smooth transitions between different app states
- π± Responsive Layout: Adaptive design that works across different screen sizes
- π Loading States: Professional loading indicators with contextual messages
β οΈ Enhanced Error Handling: User-friendly error messages with recovery options
- π Image Validation: Comprehensive file existence and format verification
- π Smart Resizing: Automatic image optimization for better performance
- πΎ Memory Management: Efficient image processing to prevent crashes
- π― State Management: Robust BLoC pattern implementation with proper error propagation
- π§ͺ Error Recovery: Graceful handling of edge cases and network issues
| Tumor Type | Description | Color Code | Confidence Display |
|---|---|---|---|
| Glioma | A type of brain tumor that occurs in the brain and spinal cord | π΄ Red | Progress indicator |
| Meningioma | A tumor that arises from the meninges | π Orange | Progress indicator |
| Pituitary Tumor | A tumor that forms in the pituitary gland | π΅ Blue | Progress indicator |
| No Tumor | Healthy brain tissue with no detectable tumor | π’ Green | Progress indicator |
- Framework: Flutter 3.8.1+
- Language: Dart
- AI/ML: TensorFlow Lite
- State Management: BLoC Pattern
- Image Processing: Dart Image Library
- Animations: Flutter Animations API with CustomPainter
- Architecture: Clean Architecture with Service Layer
- Modern Header: Animated glassmorphism design with brand icon
- Image Section: Hero animations with loading states and error handling
- Results Display: Color-coded confidence meters with smooth animations
- Action Buttons: Gradient-styled buttons with hover effects
- Background: Dynamic animated shapes (circles, triangles, squares, hexagons)
- Floating Elements: Subtle up/down movement (4-second cycles)
- Rotating Shapes: Continuous geometric rotations (20-second cycles)
- Fade Transitions: Smooth opacity changes between states
- Scale Animations: Entrance effects for UI components
- Custom Painting: Hardware-accelerated background rendering
- Flutter SDK (3.8.1 or higher)
- Dart SDK
- Android Studio / VS Code
- Android device or emulator / iOS simulator
-
Clone the repository
git clone <repository-url> cd brisc_detector
-
Install dependencies
flutter pub get
-
Verify your Flutter installation
flutter doctor
-
Run the app
flutter run
-
π App Launch:
- Open BRISC Detector on your device
- Enjoy the animated background while the app initializes
-
π€ Model Loading:
- The app automatically loads the AI model
- Visual loading indicator shows progress
- First launch may take a few seconds
-
πΈ Image Selection: Choose your preferred input method:
- π· Camera: Capture a new MRI image with real-time preview
- πΌοΈ Gallery: Select an existing image from your device storage
-
π Processing:
- Selected image displays with smooth hero animation
- Loading overlay appears during AI analysis
- Progress indicators show processing status
-
π Results:
- Primary classification with confidence percentage
- Detailed breakdown of all four predictions
- Color-coded visual indicators with animations
- Confidence meters with smooth progress animations
-
π Reset:
- Use "New Analysis" button to clear results
- Smooth transition back to selection state
- Use clear, high-contrast MRI images
- Ensure good lighting for camera captures
- Center the brain region in the image
- Use standard MRI formats (JPEG, PNG)
- Model Type: TensorFlow Lite (
.tflite) - Input Size: 224x224x3 (RGB)
- Output: 4-class classification probabilities
- Preprocessing: Automatic image resizing and normalization
- Inference: On-device processing for privacy and speed
- Error Handling: Comprehensive validation and recovery
assets/model_unquant.tflite- The trained classification modelassets/labels.txt- Class labels mapping
The app follows clean architecture principles with enhanced error handling:
lib/
βββ core/
β βββ services/
β β βββ tflite_service.dart # Enhanced TensorFlow Lite operations
β βββ utils/
β βββ assets_manager.dart # Asset path management
βββ home/
β βββ controllers/
β β βββ home_bloc.dart # Robust business logic with error handling
β β βββ home_event.dart # User interaction events
β β βββ home_state.dart # Comprehensive app states
β βββ data/
β β βββ models/
β β βββ brisc_status.dart # Tumor type enumeration
β β βββ classification_result.dart # Enhanced result model
β βββ views/
β βββ home_view.dart # Main UI with animated background
β βββ widgets/
β βββ animated_background.dart # Dynamic shape animations
β βββ modern_header.dart # Glassmorphism header design
β βββ image_section.dart # Enhanced image display with error handling
β βββ results_section.dart # Animated results display
β βββ action_buttons.dart # Modern button components
β βββ modern_app_bar.dart # Styled app bar
βββ main.dart # App entry point
flutter- UI framework with animation supporttflite_flutter: ^0.10.4- TensorFlow Lite inferenceimage_picker: ^1.0.7- Enhanced image selectionimage: ^4.1.7- Image processing and manipulationflutter_bloc: ^8.1.4- State management with error handling
flutter_test- Testing frameworkflutter_lints: ^5.0.0- Linting rules
// Modify animation durations in animated_background.dart
_floatingController = AnimationController(
duration: const Duration(seconds: 4), // Floating speed
vsync: this,
);
_rotationController = AnimationController(
duration: const Duration(seconds: 20), // Rotation speed
vsync: this,
);- New Classification Types: Update the
BriscStatusenum and retrain the model - UI Improvements: Modify widgets following Material Design 3 guidelines
- Animation Enhancements: Extend
BackgroundShapesPainterfor new effects - Performance Optimization: Enhance the
TFLiteServicefor better inference speed
# Run unit tests
flutter test
# Run integration tests
flutter drive --target=test_driver/app.dart
# Test error handling
flutter test test/error_handling_test.dart# Android APK
flutter build apk --release
# Android App Bundle (recommended)
flutter build appbundle --release
# iOS
flutter build ios --releaseThe app includes comprehensive error handling for:
- Image Loading Failures: Shows broken image indicator with retry option
- Model Loading Issues: Clear error messages with reload functionality
- File Access Problems: Validates file existence and permissions
- Memory Constraints: Automatic image resizing to prevent crashes
- Network Issues: Graceful degradation for offline usage
- Invalid File Formats: User-friendly format validation messages
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Flutter/Dart style guidelines
- Maintain the existing animation design language
- Include error handling for new features
- Add appropriate documentation
- Test on multiple devices and screen sizes
This project is licensed under the MIT License - see the LICENSE file for details.
- TensorFlow team for the TensorFlow Lite framework
- Flutter team for the excellent cross-platform framework and animation APIs
- Medical imaging research community for advancing AI in healthcare
- Material Design team for design inspiration
For support, please open an issue in the GitHub repository or contact the development team.
If you encounter any issues:
- Check Flutter doctor for environment setup
- Ensure device has sufficient memory for image processing
- Verify model files are properly included in assets
- Test with different image formats if classification fails
- v2.0.0: Added animated background, enhanced error handling, modern UI
- v1.0.0: Initial release with basic classification functionality
Built with β€οΈ using Flutter, TensorFlow Lite, and Modern Animation APIs
Experience the future of medical AI with beautiful, responsive design