Web platform for generating 2D unstructured point clouds for meshless mGFD workflows
From images to contours to classified point clouds — with visualization and neighbor analysis
- Overview
- Features
- Installation & Setup
- Quick Start
- Usage Guide
- Visualizations
- API Documentation
- Data Formats
- Project Architecture
- Mathematical Model
- Dataset Structure
- Performance Benchmarks
- Contributing
- Research Team
- Industry Partners Supporting Innovation
- Scientific References
- Citation & License
- Acknowledgments
- Contact
- FAQ
mGFD CloudGenerator 2.0 is a Flask-based web platform that converts images → contours → classified point clouds designed for meshless Generalized Finite Differences (mGFD) workflows. It provides interactive contour extraction, multi-region management (including interior holes), cloud generation with two distribution strategies, high-quality visualizations (PNG/SVG), and region-aware neighbor computation.
🌐 Try it now! Live demo: https://malla.umich.mx/CloudGenerator/
- 🎨 ContourCreator: Single-click region detection (Flood Fill), interactive refinement, brush editing, and optional GrabCut.
- ☁️ CloudGenerator: Regular (grid-like) and Natural (Poisson disk sampling) distributions, optional contour reduction, multi-region support.
- 👁️ CloudViewer: Upload a CSV (contours or clouds) and instantly generate PNG/SVG visualizations.
- :users: NeighborsCalculator: Compute k-nearest neighbors constrained by region boundaries (cKDTree-based).
- 💾 Export & Reproducibility: Standardized CSV formats + verification on export for integrity.
| Field | Application | Use Case |
|---|---|---|
| Computational Fluid Dynamics 🌊 | Irregular domains | Node generation for complex geometries |
| Structural Engineering 🏗️ | Stress analysis | Point sets for meshless discretization |
| Heat Transfer 🔥 | Interface problems | Multi-region clouds with internal boundaries |
| Environmental Modeling 🌿 | Geography-driven domains | Contour-driven discretization from maps |
| Biomedical Engineering 🔬 | Organ shapes | Point cloud generation from silhouettes |
- One-click region detection based on
cv2.floodFill(fast and interactive). - Adaptive tolerance using local texture statistics for robust segmentation.
- Positive/negative seed refinement for add/subtract workflows.
- Brush editing to manually correct masks and boundaries.
- Export single or multi-region contours as normalized CSV coordinates.
- Regular Distribution: uniform grid-style generation inside polygonal regions.
- Natural Distribution: Poisson disk sampling for organic point spacing.
- Contour reduction to simplify boundaries before generation (optional).
- Multi-region support: main region + interior regions (holes) handled explicitly.
- Node classification written to CSV (
boundary,interior, and region-aware classes).
- CSV upload and automatic rendering to PNG and SVG.
- Compatibility with the standardized CSV formats described below.
- Region-constrained neighbor search (no cross-region connections).
- Efficient KD-tree implementation via
scipy.spatial.cKDTree.
| Component | Minimum | Recommended |
|---|---|---|
| Python | 3.9+ | 3.10+ |
| RAM | 4 GB | 8 GB+ |
| CPU | 2 cores | 4+ cores |
| Storage | 1 GB | 5 GB+ (if generating large datasets) |
| OS | Windows/Linux/macOS | Linux (recommended for deployments) |
# Web framework
Flask==3.1.1
Werkzeug==3.1.3
# Computer vision / geometry
opencv-python-headless==4.12.0.88
shapely==2.1.1
# Scientific computing
numpy==2.2.6
scipy==1.15.2
matplotlib==3.10.0# Method 1: Direct installation
git clone https://github.com/gstinoco/mGFD_CloudGenerator.git
cd mGFD_CloudGenerator
pip install -r requirements.txt
# Method 2: Virtual environment (recommended)
python -m venv cloudgen_env
source cloudgen_env/bin/activate # On Windows: cloudgen_env\Scripts\activate
pip install -r requirements.txtpython -c "import flask, cv2, numpy, scipy, shapely, matplotlib; print(':white_check_mark: Installation successful!')"
python app.pyLocal server default:
http://127.0.0.1:5000/
| Step | What to do |
|---|---|
| 1) Run |
|
| 2) Open |
Go to http://127.0.0.1:5000/
|
| 3) Workflow | ContourCreator → export contours CSV → CloudGenerator → export cloud CSV + PNG/SVG → optional NeighborsCalculator. |
Practical workflows for ContourCreator, CloudGenerator, CloudViewer, and NeighborsCalculator
| Step | What to do |
|---|---|
| 1) Upload | Upload an image (PNG/JPG/JPEG/GIF/BMP). Max request size is 16 MB. |
| 2) Detect | Click inside a region to extract it with Flood Fill (adaptive tolerance). |
| 3) Refine | Use positive/negative seeds and brush tools to add/remove pixels from the mask. |
| 4) Export | Export a single region or all regions to CSV with normalized coordinates. |
| Step | What to do |
|---|---|
| 1) Upload CSV | Upload a contour CSV (x,y,region recommended for multi-region). |
| 2) Choose method | Regular (grid-like) or Natural (Poisson disk sampling). |
| 3) Options | Enable contour reduction and/or generate points inside interior regions (holes). |
| 4) Outputs |
CSV: x,y,region,classificationImages: .png and .svg visualizations
|
| Step | What to do |
|---|---|
| 1) Upload CSV | Upload a contour or cloud CSV. |
| 2) Inspect | Get PNG/SVG renderings and point counts for fast validation. |
| Step | What to do |
|---|---|
| 1) Upload Cloud CSV | Upload a cloud CSV containing x,y,region,classification. |
| 2) Set k | Select the number of neighbors (nvec, default is 9). |
| 3) Compute | Neighbors are computed within each region only (no cross-region links). |
The repository includes sample inputs and outputs under static/examples/.
|
Balkhash Input image ![]() Cloud preview ![]() Balkhash_contours.csv ·
Balkhash_cloud.csv
|
Caspio Input image ![]() Cloud preview ![]() Caspio_contours.csv ·
Caspio_cloud.csv
|
Titicaca Input image ![]() Cloud preview ![]() Titicaca_contours.csv ·
Titicaca_cloud.csv
|
Tip: Use these CSV files in CloudViewer/CloudGenerator to reproduce the example outputs.
The application exposes REST endpoints used by the web UI. All endpoints return JSON (except file downloads).
| Endpoint | Method | Purpose |
|---|---|---|
/upload |
POST | Upload an image for ContourCreator |
/detect_region |
POST | One-click region detection (Flood Fill) |
/interactive_segmentation |
POST | Multi-seed segmentation (add/subtract) |
/grabcut_segmentation |
POST | Optional GrabCut segmentation |
/refine_with_brush |
POST | Apply brush strokes to refine the mask |
/export_single_region |
POST | Export one region to CSV (x,y,region) |
/save_all_coordinates |
POST | Export multiple regions to a single CSV (x,y,region) |
/upload_csv |
POST | Upload contour CSV for CloudGenerator |
/generate_cloud |
POST | Generate cloud (Regular distribution) |
/generate_cloud_natural |
POST | Generate cloud (Natural distribution) |
/upload_viewer |
POST | Upload CSV for rendering in CloudViewer |
/upload_neighbors |
POST | Upload cloud CSV and compute neighbors |
/download/<filename> |
GET | Download generated files from the output folder |
Minimal format (single region):
x,y
0.1234,0.5678
0.1240,0.5681
...Recommended format (multi-region / holes):
x,y,region
0.1234,0.5678,1
0.1240,0.5681,1
...All coordinates are normalized to the [0,1] × [0,1] range (with Y-axis inversion from image coordinates to Cartesian coordinates).
x,y,region,classification
0.1234,0.5678,1,boundary
0.2222,0.3333,1,interior
...:package: mGFD_CloudGenerator/
├── app.py # Flask app + API routes
├── requirements.txt # Python dependencies
├── vercel.json # Vercel deployment config (writes to /tmp)
│
├── contour_modules/ # ContourCreator (segmentation + contour extraction)
│ └── detection.py
│
├── cloud_modules/ # Cloud generation pipeline (Regular / Natural)
│ ├── generator.py # Orchestrates the full cloud workflow
│ ├── point_generation.py # Sampling algorithms (grid / Poisson disk)
│ ├── classification.py # Boundary vs interior labeling
│ ├── data_processing.py # CSV loaders / validation
│ ├── reduction.py # Contour reduction (optional)
│ ├── export.py # CSV export utilities
│ ├── visualization.py # PNG/SVG rendering
│ └── utils.py
│
├── analysis_modules/ # Post-processing tools
│ └── neighbors.py # Region-constrained kNN neighbor computation
│
├── templates/ # Web UI (Jinja2)
├── static/ # Frontend assets + examples gallery
│ ├── css/
│ ├── js/
│ ├── images/
│ └── examples/
│
├── logs/ # local rotating logs (not used on Vercel)
│
└── docs/ # Project branding + team images
├── logo/
└── team/
Runtime directories created automatically on startup (local mode):
uploads/(temporary uploads)output/(generated CSV/PNG/SVG)
mGFD CloudGenerator is a preprocessing tool, but several steps are driven by simple, explicit mathematical mappings and geometric algorithms.
ContourCreator works in normalized coordinates and exports points to the Cartesian-like convention used by mGFD workflows.
| Concept | UI / Image Space | Exported Space |
|---|---|---|
| Range |
|
|
| Origin | top-left | bottom-left |
| Y axis | downwards | upwards (inverted) |
The export transformation applied to each point is:
Where
| Scaling method | Notes | ||
|---|---|---|---|
| preserve_aspect_ratio (default) | Preserves aspect ratio in a unit square | ||
| stretch | Stretches to fill the unit square | ||
| custom | user-defined | user-defined | Direct overrides |
Given a set of polygonal contours (optionally multiple regions), CloudGenerator produces boundary and interior nodes:
| Method | Strategy | Typical use |
|---|---|---|
| Regular Distribution | grid-like sampling inside the polygon | structured clouds, fast generation |
| Natural Distribution | Poisson disk sampling (minimum-distance constraint) | more organic spacing, avoids grid artifacts |
Nodes are exported with metadata:
region: integer region ID (Region 1 is the outer domain; Regions 2+ are interior holes when enabled).classification:boundaryorinterior(used by downstream mGFD pipelines).
Neighbor computation is performed per region using a KD-tree search. This prevents cross-region connectivity that would be invalid for disconnected domains or holes.
This repository is organized as a web application plus reusable Python modules. When running locally, files are generated in a small set of runtime folders:
uploads/ # temporary uploaded images/CSVs
output/ # generated CSV/PNG/SVG artifacts
logs/ # local rotating logs (if not in Vercel)
static/examples/ # versioned example inputs/outputs
Typical filenames (written under output/):
- Contour exports:
<region_name>_<timestamp>.csv - Multi-region exports:
<base>_all_regions_<timestamp>.csv - Regular clouds:
<input>_cloud_<timestamp>.csv+ PNG/SVG visualizations - Natural clouds:
<input>_cloud_natural_<timestamp>.csv+ PNG/SVG visualizations
The server periodically removes old files from uploads/ and output/ to avoid disk growth in long-running deployments.
The application is designed for interactive workloads and scales well for typical mGFD preprocessing sizes. Exact runtimes depend on hardware, point counts, and geometry complexity.
| Stage | Core operation | Typical scaling |
|---|---|---|
| Segmentation | Flood Fill / interactive refinement | ~ proportional to affected pixels |
| Cloud generation (Regular) | grid sampling + polygon checks | ~ proportional to generated points |
| Cloud generation (Natural) | Poisson disk sampling | ~ proportional to generated points (higher constant) |
| Neighbors | KD-tree kNN per region | ~ |
| Visualization/Export | CSV + PNG/SVG | ~ proportional to points |
- Search existing issues: Check if the bug has already been reported
- Create a detailed report: Include steps to reproduce and expected vs actual behavior
- Provide context: Operating system, Python version, browser, and relevant parameters (image size, regions, method)
- Describe the feature: Clear and concise description of the proposed functionality
- Justify the need: Explain how it benefits research, reproducibility, or usability
- Provide examples: Use cases, expected inputs/outputs, and acceptance criteria
git clone https://github.com/gstinoco/mGFD_CloudGenerator.git
cd mGFD_CloudGenerator
python -m venv dev_env
source dev_env/bin/activate # On Windows: dev_env\Scripts\activate
pip install -r requirements.txt
git checkout -b feature/your-feature-name| Photo | Student | Institution | Contact |
|---|---|---|---|
|
Gabriela Pedraza-Jiménez |
|
|
|
Eli Chagolla-Inzunza |
|
|
| Photo | Student | Institution | Contact |
|---|---|---|---|
|
Jorge L. González-Figueroa |
|
|
|
Christopher N. Magaña-Barocio |
|
|
| Photo | Student | Institution | Contact |
|---|---|---|---|
|
|
Maria Goretti Fraga-Lopez |
|
|
Collaboration between academia and industry to accelerate real-world impact
|
🎯 Focus areas:
|
- Tinoco-Guerrero, G., Domínguez-Mota, F. J., Guzmán-Torres, J. A., & Tinoco-Ruiz, J. G. (2022). "Numerical Solution of Diffusion Equation using a Method of Lines and Generalized Finite Differences." Revista Internacional de Métodos Numéricos para Cálculo y Diseño en Ingeniería, 38(2). DOI: 10.23967/j.rimni.2022.06.003
- Contour-to-cloud pipeline: interactive image-based contour extraction and multi-region management
- Cloud generation methods: Regular (grid-like) and Natural (Poisson disk sampling) distributions
- Region-aware analysis: neighbor computation constrained by region labels for disconnected domains and holes
If you use this software in your research, please cite:
@software{tinoco2025mGFD_cloudgenerator,
title={mGFD CloudGenerator 2.0: Web platform for generating 2D unstructured point clouds},
author={Tinoco-Guerrero, Gerardo and
Domínguez-Mota, Francisco Javier and
Guzmán-Torres, José Alberto and
Arias-Rojas, Heriberto},
year={2025},
institution={Universidad Michoacana de San Nicolás de Hidalgo},
organization={SIIIA MATH: Soluciones en ingeniería},
url={https://github.com/gstinoco/mGFD_CloudGenerator},
version={2.0},
note={Web-based preprocessing tool for meshless mGFD workflows: image-to-contour extraction, multi-region handling, point-cloud generation (regular/Poisson), node classification, and region-constrained neighbor analysis}
}This project is licensed under the MIT License - see the full license text below:
MIT License
Copyright (c) 2025 Gerardo Tinoco-Guerrero, Francisco Javier Domínguez-Mota,
José Alberto Guzmán-Torres, Heriberto Árias Rojas
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Academic Use: This software is developed for research and educational purposes. Commercial use is permitted under the MIT License terms.
We extend our gratitude to the institutions and partners supporting this research and open-source development
|
Primary Contact
Research group coordination Dr. Gerardo Tinoco Guerrero Morelia, Michoacán, México |
||||||
|
Technical Support
Bug reports, questions, and collaboration requests
|
||||||
|
Collaboration Opportunities
Research and engineering partnerships
|
||||||
|
Student Opportunities
Projects and training in scientific computing
|
||||||
|
Institutional Affiliations
|
Which image formats are supported?
PNG, JPG/JPEG, GIF, and BMP. Maximum request size is 16 MB.
Where are outputs saved when running locally?
Generated files are written to
output/. Uploaded files are stored in uploads/. Both folders are created automatically on startup.
What is the expected CSV format for CloudGenerator?
Contours:
x,y,region (region is optional, but recommended for multi-region). Clouds: x,y,region,classification.
Can I use this in commercial projects?
Yes. The project is released under the MIT License.
How should I cite this work?
Use the BibTeX entry in the Citation section and the referenced DOI in Scientific References.













