# spark-in-you/orca-public architecture

> Architecture diagram of the GitHub repository spark-in-you/orca-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spark-in-you/orca-public
- Repository: https://github.com/spark-in-you/orca-public

## Overview

##### Overarching components
- Data Input & I/O: The software expects microscopy images in “.dax” format with corresponding “.inf” files (see README note). The “FigureAndFile_IO” directory and several scripts in “CoreFunctions” and “ChrTracingLib” manage reading, writing and structuring of these files.
- Processing & Analysis Core: A large part of the code is in “matlab-functions”. Under directories like “ChrTracingLib”, “CoreFunctions”, and “DaxViewer”, many MATLAB routines handle everything from alignment (e.g., AlignMosaicsGUI), registration, segmentation, and intensity analysis. These routines embody the core computational routines – including image translation, correction, curve fitting, quantification, drift correction, and 3D registration.
- Visualization & User Interface: Look at the “GUIs” directory that contains several BAT files to launch different GUI tools (e.g., AlignMosaicsGUI.bat, BuildMosaicsGUI.bat, ChrTracer.bat, MosaicAnalyzer.bat) along with MATLAB GUIDE (.fig) files spread across “ChrTracingLib”, “DaxViewer”, and subfolders. This layer is responsible for interactive data exploration.
- External Dependencies and Add-ons: Note the inclusion of external MATLAB tools – many components in “FromFileExchange”, “FromGitHub”, and “FromMatlabSTORM” provide additional processing functions (t-SNE, polyfit tools, image segmentation, etc.) and build on the modular nature of the whole system. There is also a dependency on the MERFISH_analysis repository (as mentioned in the README) which supplies supporting classes for probe construction.

##### Architectural relationships and interactions
- Data flows from the raw input files (".dax" and ".inf") into the I/O modules for parsing (FigureAndFile_IO, some CoreFunctions scripts).
- Once the raw data is acquired, control passes to the processing core where multiple specialized routines (found in ChrTracingLib for spot detection, segmentation, registration, and drift correction) operate in a pipeline fashion.
- The processed data is then forwarded to visualization modules (such as DaxViewer GUIs or mosaic builders) for user review. Interactive GUIs let the user fine tune parameters such as alignment and cropping.
- External utilities and third‑party tools (in the “FromFileExchange” and “FromGitHub” directories) are leveraged as support functions that integrate seamlessly into the analysis pipeline.
- The integration of the MERFISH_analysis repo is added at the MATLAB path level to bring in additional classes for probe design when required.

##### Architectural patterns
- Modular Design: Each directory in “matlab-functions” represents a self-contained module (e.g., image processing, file I/O, core computations) that interacts via defined interfaces.
- Separation of Concerns: There is a clear separation between data handling, core analysis, and user interaction. This makes it easier to maintain or replace specific modules without affecting others.
- Reusability and Extensibility: The project reuses many publicly available MATLAB tools from FileExchange and GitHub. The design encourages the addition of future routines (as mentioned in the README) to extend functionalities.

– Rectangles for processing modules (e.g., “Input Handler”, “Image Processing Core”, “Analysis Algorithms”).
– “FigureAndFile_IO” as “File I/O & Data Structuring Module”.
– “GUIs” as “User Interface Launcher” layer.
– Another could detail the internal architecture of the core analysis module, listing components like drift correction, image segmentation, and fitting routines.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Input Layer
    subgraph "Data Input Layer"
        D1["Raw Microscopy Data (.dax & .inf)"]:::io
        D2["File I/O & Data Structuring Module"]:::io
    end
    D1 --> D2

    %% Processing Core
    subgraph "Processing & Analysis Core"
        P1["Core Utility Functions"]:::processing
        P2["Chromatin Tracing & Registration Module"]:::processing
        P3["Dax Data Visualizations"]:::processing
    end
    D2 --> P1
    P1 --> P2
    P2 --> P3

    %% Visualization & GUI Layer
    subgraph "Visualization & User Interface"
        G1["User Interface Launcher"]:::gui
    end
    P3 --> G1

    %% External Dependencies
    subgraph "External Dependencies & Add-ons"
        E1["MATLAB FileExchange Tools"]:::external
        E2["GitHub Add-ons"]:::external
        E3["MATLAB STORM Tools"]:::external
        E4["MERFISH_analysis Repository"]:::external
    end
    %% External dependencies support processing routines
    E1 ---|"supports"| P1
    E2 ---|"supports"| P1
    E3 ---|"supports"| P1
    E4 ---|"enables"| P2

    %% Click Events for component mapping
    click D2 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/FigureAndFile_IO"
    click P2 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/ChrTracingLib"
    click P1 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/CoreFunctions"
    click P3 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/DaxViewer"
    click G1 "https://github.com/spark-in-you/orca-public/tree/master/GUIs"
    click E1 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/FromFileExchange"
    click E2 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/FromGitHub"
    click E3 "https://github.com/spark-in-you/orca-public/tree/master/matlab-functions/FromMatlabSTORM"

    %% Style Classes
    classDef io fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef processing fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px;
    classDef gui fill:#AED6F1,stroke:#3498DB,stroke-width:2px;
    classDef external fill:#A9DFBF,stroke:#28B463,stroke-width:2px;
```
