# htem/cb2_project_analysis architecture

> Architecture diagram of the GitHub repository htem/cb2_project_analysis, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/htem/cb2_project_analysis
- Repository: https://github.com/htem/cb2_project_analysis

## Overview

##### Main System Components

a) Data Processing Pipeline:
- Input Layer: Raw neural data from BossDB
- Processing Layer: Segmentation networks and analysis tools
- Output Layer: NetworkX graphs and mesh reconstructions

b) Analysis Framework:
- MF-GRC Analysis Module
- PFS-PC Analysis Module
- Dimensionality Simulation Module
- Accuracy Simulation Module

c) Visualization Systems:
- Neuroglancer Integration
- Mesh Rendering Tools
- Analysis Plot Generation

##### Key Architectural Elements

a) Data Flow Components:
- Parallel processing paths for different neural cell types (GRC, PC, MF)
- Mesh generation and visualization pipelines

b) Processing Components:
- Network Training Systems (networks/ directory)
- Synapse Detection Pipeline (networks_synapse/ directory)
- Analysis Pipeline (analysis/ directory)

c) Storage Components:
- Database Systems (database/ directory)
- Graph Storage (graphs/ directory)
- Mesh Storage (mdseg/meshes/ directory)

##### Specific Implementation Details

**Top Level:**
**[Raw Data Sources] → [Processing Pipeline] → [Analysis Framework] → [Visualization Layer]**

**Middle Level (Processing Pipeline):**
**[Network Training] → [Segmentation] → [Synapse Detection] → [Graph Generation]**

**Bottom Level (Analysis Framework):**
**[MF-GRC Analysis] → [PFS-PC Analysis] → [Dimensionality Analysis] → [Accuracy Analysis]**

##### Connection Types

- Double lines: Parallel processing paths

##### Technical Stack Indicators

Technology labels for:
- Python-based analysis tools
- NetworkX for graph processing
- Neuroglancer for visualization
- Daisy for large-scale processing
- MDSeg for proofreading

Remember to maintain a balance between detail and clarity, focusing on the major architectural components while providing enough detail to understand the system's operation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Define styles
    classDef input fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef analysis fill:#f1c40f,stroke:#f39c12,color:black
    classDef visualization fill:#9b59b6,stroke:#8e44ad,color:white
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Data Input Layer
    subgraph DataInput
        RawData[Raw Neural Data]:::input
        BossDB[BossDB Source]:::input
    end

    %% Processing Pipeline
    subgraph ProcessingPipeline
        SegNet["Segmentation Networks"]:::processing
        SynDet["Synapse Detection Pipeline"]:::processing
        GraphGen["Graph Processing"]:::processing
    end

    %% Analysis Framework
    subgraph AnalysisFramework
        MFGRC["MF-GRC Analysis"]:::analysis
        PFSPC["PFS-PC Analysis"]:::analysis
        DimSim["Dimensionality Simulation"]:::analysis
        AccSim["Accuracy Simulation"]:::analysis
    end

    %% Storage Layer
    subgraph StorageLayer
        DB["Database Systems"]:::storage
        GraphStore["Graph Storage"]:::storage
        MeshStore["Mesh Storage"]:::storage
    end

    %% Visualization Layer
    subgraph VisualizationLayer
        NeuroViz["Neuroglancer Integration"]:::visualization
        MeshViz["Mesh Visualization System"]:::visualization
        AnalysisPlots["Analysis Plots"]:::visualization
    end

    %% Connections
    BossDB --> RawData
    RawData --> SegNet
    SegNet --> SynDet
    SynDet --> GraphGen
    GraphGen --> GraphStore
    GraphGen --> |Analysis Input| MFGRC & PFSPC & DimSim & AccSim
    MFGRC & PFSPC & DimSim & AccSim --> AnalysisPlots
    GraphStore --> NeuroViz
    MeshStore --> MeshViz
    DB --> |Metadata| AnalysisFramework

    %% Click events
    click SegNet "https://github.com/htem/cb2_project_analysis/tree/main/networks/"
    click SynDet "https://github.com/htem/cb2_project_analysis/tree/main/networks_synapse/"
    click GraphGen "https://github.com/htem/cb2_project_analysis/tree/main/graphs/"
    click MFGRC "https://github.com/htem/cb2_project_analysis/tree/main/analysis/mf_grc_analysis/"
    click PFSPC "https://github.com/htem/cb2_project_analysis/tree/main/analysis/pfs_pc_analysis/"
    click DimSim "https://github.com/htem/cb2_project_analysis/tree/main/analysis/dimensionality_sim/"
    click AccSim "https://github.com/htem/cb2_project_analysis/tree/main/analysis/accuracy_sim/"
    click MeshViz "https://github.com/htem/cb2_project_analysis/tree/main/mdseg/"
    click DB "https://github.com/htem/cb2_project_analysis/tree/main/database/"
    click NeuroViz "https://github.com/htem/cb2_project_analysis/blob/main/networks/ng.py"
    click GraphStore "https://github.com/htem/cb2_project_analysis/tree/main/graphs/new_graphs/"
    click MeshStore "https://github.com/htem/cb2_project_analysis/tree/main/mdseg/meshes/"

    %% Set diagram dimensions
    %%{init: {'flowchart': {'width': 1900, 'height': 600}}}%%
```
