Spaces:
Sleeping
Sleeping
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,13 +1,80 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version: 5.
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
short_description: Gradio super-resolution application using a pre-trained
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Cell Image Visualization Tool
|
| 3 |
+
emoji: 🔬
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.49.1
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Cell Image Visualization Tool
|
| 13 |
+
|
| 14 |
+
This Gradio application allows you to visualize data points from spectroscopy measurements on microscopic cell images. It provides interactive controls to adjust image processing parameters for optimal cell boundary detection and coordinate mapping.
|
| 15 |
+
|
| 16 |
+
## Features
|
| 17 |
+
|
| 18 |
+
- **Upload Files**: Upload a cell image (BMP format) and corresponding data file (TXT format)
|
| 19 |
+
- **Interactive Parameter Adjustment**: Fine-tune image processing parameters in real-time
|
| 20 |
+
- **Cell Boundary Detection**: Automatic detection of cell boundaries using adaptive thresholding and morphological operations
|
| 21 |
+
- **Data Point Visualization**: Visualize data points as inside (blue) or outside (orange) the detected cell boundary
|
| 22 |
+
- **Coordinate Transformation**: Adjustable pixels-per-micrometer conversion factor for accurate spatial mapping
|
| 23 |
+
- **Diagnostic Output**: View detailed information about the processing steps and results
|
| 24 |
+
|
| 25 |
+
## How to Use
|
| 26 |
+
|
| 27 |
+
1. **Upload Files**:
|
| 28 |
+
- Upload your cell image (BMP format) using the "Upload Cell Image" button
|
| 29 |
+
- Upload your data file (TXT format with columns: x_um, y_um, z_um/wavelength, count) using the "Upload Data File" button
|
| 30 |
+
|
| 31 |
+
2. **Adjust Parameters**:
|
| 32 |
+
- **Pixels per Micrometer**: Adjust the conversion factor between micrometers and pixels (default: 21.3)
|
| 33 |
+
- **Invert Y-axis**: Toggle to invert the y-axis for coordinate mapping (default: enabled)
|
| 34 |
+
- **Crop Size**: Set the size of the region to process (default: 1000 pixels)
|
| 35 |
+
- **Adaptive Threshold Parameters**: Adjust block size and C value for adaptive thresholding
|
| 36 |
+
- **Morphological Operations**: Adjust kernel sizes for closing and opening operations
|
| 37 |
+
- **Component Filtering**: Set area thresholds for connected component analysis
|
| 38 |
+
- **Contour Filtering**: Set area and circularity thresholds for contour selection
|
| 39 |
+
|
| 40 |
+
3. **Process and Visualize**:
|
| 41 |
+
- Click the "Process and Visualize" button to generate the visualization
|
| 42 |
+
- View the result image with detected cell boundary and plotted data points
|
| 43 |
+
- Check the diagnostics output for detailed information about the processing
|
| 44 |
+
|
| 45 |
+
## Visualization Legend
|
| 46 |
+
|
| 47 |
+
- **Green Ellipse**: Fitted ellipse to detected cell boundary
|
| 48 |
+
- **Blue Contour**: Detected cell boundary
|
| 49 |
+
- **Blue Points**: Data points inside the cell
|
| 50 |
+
- **Orange Points**: Data points outside the cell
|
| 51 |
+
- **Green Cross**: Start point (first row in TXT file)
|
| 52 |
+
- **Red Cross**: End point (last row in TXT file)
|
| 53 |
+
- **White Scale Bar**: 10 µm reference scale
|
| 54 |
+
|
| 55 |
+
## Technical Details
|
| 56 |
+
|
| 57 |
+
The application uses the following image processing pipeline:
|
| 58 |
+
|
| 59 |
+
1. **Image Preprocessing**: Gaussian blur to reduce noise
|
| 60 |
+
2. **Adaptive Thresholding**: Local thresholding to handle varying illumination
|
| 61 |
+
3. **Morphological Operations**: Closing to fill holes, opening to remove noise
|
| 62 |
+
4. **Connected Component Analysis**: Identify and select the main cell component
|
| 63 |
+
5. **Contour Detection**: Find and filter contours based on area and circularity
|
| 64 |
+
6. **Ellipse Fitting**: Fit an ellipse to the detected cell boundary
|
| 65 |
+
7. **Coordinate Transformation**: Map data points from micrometers to pixel coordinates
|
| 66 |
+
8. **Point Classification**: Determine if each data point is inside or outside the cell
|
| 67 |
+
|
| 68 |
+
## Requirements
|
| 69 |
+
|
| 70 |
+
- Python 3.11+
|
| 71 |
+
- gradio
|
| 72 |
+
- opencv-python
|
| 73 |
+
- pandas
|
| 74 |
+
- numpy
|
| 75 |
+
- Pillow
|
| 76 |
+
|
| 77 |
+
## License
|
| 78 |
+
|
| 79 |
+
This application is provided as-is for research and educational purposes.
|
| 80 |
+
|